/* =====================================================================
   PREMIUM DESIGN LAYER - loaded after every other stylesheet (before safe-area.css).
   One consistent system for all pages. Remove this file + premium.js to go back.

   Principles applied
   - Emil Kowalski: strong ease-out curves, UI motion <= 300ms, press feedback scale(.97),
     hover only on hover-capable devices, transform + opacity only, no transition:all,
     reduced motion = fewer animations (not none).
   - Impeccable: one element wins the eye, no mixed radii, 44px tap targets, visible focus,
     contrast, no gradient text, motion supports the interface.
   - Taste: a deliberate direction (dark forest room, gold as the single accent), one palette,
     real hierarchy, consistent margins at every width.
   ===================================================================== */

/* ---------- 1 - tokens ---------- */
:root {
  --ease: cubic-bezier(.23, 1, .32, 1);          /* strong ease-out (enter / exit) */
  --ease-io: cubic-bezier(.77, 0, .175, 1);      /* on-screen movement */
  --sp-ease: var(--ease);
  --t-press: 140ms;
  --t-fast: 180ms;
  --t-ui: 260ms;

  --r-card: 22px;       /* every card / panel */
  --r-field: 14px;      /* inputs */
  --r-media: 14px;      /* photos inside cards */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 72px;
  --gold: #D4B27A;
  --gold-line: rgba(212, 178, 122, .42);
  --tap: 44px;
}
html { scroll-padding-top: calc(var(--header-h) + 12px); overscroll-behavior-y: none; }
body { font-kerning: normal; font-optical-sizing: auto; }

/* ---------- 2 - typography ---------- */
h1, h2, h3, .page-title, .section-title, .hero-heading, .ab-title { text-wrap: balance; }
p, li, .page-sub, .section-lede { text-wrap: pretty; }
.page-title, .section-title, .hero-heading { font-weight: 400; }
/* solid headline: no gradient text */
.hero-heading { background: none; -webkit-background-clip: border-box; background-clip: border-box; color: #F7F3EB; }
.page-title { font-size: clamp(54px, 11vw, 168px); line-height: .9; }
.page-sub { max-width: 46ch; line-height: 1.3; }
.notes-stats, .nt-stat, .lk-count, .memory-date, .card-index, .social-num, .explore-num, time { font-variant-numeric: tabular-nums; }

/* About page: same serif display voice as the rest of the site */
.ab-title, .ab-head h2, .ab-title--sub {
  font-family: var(--f-display); font-weight: 400; text-transform: none; letter-spacing: -.025em;
}
.ab-title { font-size: clamp(48px, 9.4vw, 128px); line-height: .95; }
.ab-head h2 { font-size: clamp(34px, 6.4vw, 64px); line-height: 1; margin-bottom: 14px; }
.ab-card h3 { font-weight: 600; }
.ab-lead { font-weight: 300; }

/* ---------- 3 - rhythm: same page-hero spacing everywhere ---------- */
.page-hero { padding-bottom: clamp(40px, 5vw, 72px); }
.page-hero + .section { padding-top: clamp(40px, 6vw, 80px); }
.section-head { margin-bottom: clamp(32px, 5vw, 64px); }

/* ---------- 4 - one corner radius for surfaces ---------- */
.card, .social-card, .project-card, .memory, .ab-card, .share-box, .auth-panel, .confirm-box, .tool-card,
.lk-card, .note-card, .explore-row a, .g-toolbar, .empty-note, .mem-card, .nt-hero, .read-callout { border-radius: var(--r-card); }
.field input, .field select, .field textarea { border-radius: var(--r-field); }
.tile { border-radius: var(--r-media); }
.memory img, .project-media { border-radius: 0; }

/* ---------- 5 - one accent: gold (red kept only for the JT mark ring) ---------- */
.eyebrow, .ab-label, .eyebrow::before { color: var(--gold); }
.eyebrow::before, .ab-rule, .ab-head::after { background: var(--gold); }
.nav a::after, .explore-row a::before { background: var(--gold); }
.card-index { color: var(--gold); }
.social-arrow, .explore-arrow, .project-tag, .memory-date, .section-title em { color: var(--gold); }
.text-link, .strip-link { border-bottom-color: var(--gold); }
.footer-links a:hover, .footer-bottom a:hover { color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
.field input:focus, .lk-search input:focus, .nt-search input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 178, 122, .18); outline: none; }
.perm input { accent-color: var(--gold); }

/* ---------- 6 - buttons: crisp press, calm hover ---------- */
.btn {
  min-height: var(--tap);
  transition: background-color var(--t-ui) var(--ease), border-color var(--t-ui) var(--ease), color var(--t-ui) var(--ease),
              box-shadow var(--t-ui) var(--ease), transform var(--t-press) var(--ease);
}
.btn-sm { min-height: var(--tap); }
.btn:active { transform: scale(.97); transition-duration: var(--t-press); }
.btn[disabled], .btn[aria-busy="true"] { cursor: not-allowed; }
.btn[aria-busy="true"] { position: relative; color: transparent !important; pointer-events: none; }
.btn[aria-busy="true"]::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(20, 32, 26, .25); border-top-color: #14201A; animation: jt-spin .7s linear infinite;
}
@keyframes jt-spin { to { transform: rotate(360deg); } }
.btn .arr, .btn svg { transition: transform var(--t-ui) var(--ease); }

/* hover effects only where a real pointer exists */
@media (hover: none) {
  .btn:hover, .card:hover, .social-card:hover, a.project-card:hover, .tool-card:hover, .lk-card:hover, .note-card:hover,
  .explore-row a:hover, .tile.is-loaded:hover, .ab-card:hover { transform: none; }
}
@media (hover: hover) and (pointer: fine) {
  .btn:hover { transform: translateY(-1px); }
  .btn:active { transform: scale(.97); }
  .lk-card:hover, .note-card:hover, .tool-card:hover { transform: translateY(-3px); border-color: var(--gold-line); }
}

/* ---------- 7 - cards: specific transitions (no transition:all), same feel ---------- */
.card, .social-card, .project-card, .memory, .ab-card, .tool-card, .lk-card, .note-card, .explore-row a, .tile {
  transition: transform var(--t-ui) var(--ease), border-color var(--t-ui) var(--ease), box-shadow var(--t-ui) var(--ease), background-color var(--t-ui) var(--ease);
}
.lk-card:active, .note-card:active, .tool-card:active, .social-card:active, .explore-row a:active, .ab-card:active { transform: scale(.985); transition-duration: var(--t-press); }
.note-card, .lk-card, .tool-card { box-shadow: inset 0 1px 0 var(--sp-hi, rgba(255,255,255,.07)), var(--sp-shadow-1, 0 14px 30px -18px rgba(0,0,0,.65)); }
.card-media, .project-media img { transition-duration: .8s; }

/* pointer light also on links / notes / tools cards (premium.js feeds --mx / --my) */
.lk-card::before, .note-card::before { content: ""; position: absolute; inset: 0; z-index: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .4s ease;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), var(--sp-glow, rgba(212,178,122,.09)), transparent 65%); }
@media (hover: hover) and (pointer: fine) { .lk-card:hover::before, .note-card:hover::before { opacity: 1; } }

/* ---------- 8 - header & navigation ---------- */
.nav a, .nav-panel a.nav-link { transition: color var(--t-ui) var(--ease); }
.nav a::after { transition: transform var(--t-ui) var(--ease); transform-origin: left; }
.nav a:hover::after { transform: scaleX(1); }
.theme-toggle, .burger { min-width: var(--tap); min-height: var(--tap); }
.theme-toggle { width: var(--tap); height: var(--tap); transition: border-color var(--t-ui) var(--ease), background-color var(--t-ui) var(--ease), transform var(--t-press) var(--ease); }
.theme-toggle:active, .burger:active { transform: scale(.94); }
.theme-toggle:hover { border-color: var(--gold); }
.header-action .btn { min-height: 40px; }
/* mobile menu: quicker, same curve, links rise with a short stagger */
.nav-panel { transition: opacity var(--t-ui) var(--ease), visibility var(--t-ui); }
.nav-panel a.nav-link { transition: transform .5s var(--ease), color var(--t-ui) var(--ease); transition-delay: calc(var(--i, 0) * 45ms + 60ms); }
.nav-panel li:has(a[aria-current="page"]) { border-bottom-color: var(--gold-line); }
.nav-panel a[aria-current="page"] { color: var(--gold); }
.burger span { transition: transform .35s var(--ease), opacity .2s; }

/* skip link (keyboard / screen reader) */
.skip-link {
  position: fixed; left: 16px; top: calc(var(--sat, 0px) + 10px); z-index: 400; padding: 12px 18px; border-radius: 999px;
  background: #F4F1EA; color: #14201A; font-weight: 700; font-size: 14px; transform: translateY(-180%);
  transition: transform var(--t-ui) var(--ease);
}
.skip-link:focus { transform: none; }
main:focus { outline: none; }

/* ---------- 9 - forms: visible labels, no iOS zoom, clear states ---------- */
.field input, .lk-search input, .nt-search input { font-size: 16px; min-height: 48px; transition: border-color var(--t-ui) var(--ease), box-shadow var(--t-ui) var(--ease), background-color var(--t-ui) var(--ease); }
.field input::placeholder { color: var(--mute); opacity: .7; }
.g-notice.is-error, .ts-note.is-error { color: #E8A5A3; }
html[data-theme="light"] .g-notice.is-error { color: #9B1C1C; }

/* ---------- 10 - chips: comfortable tap size ---------- */
.chip, .chips-row .chip, .nt-chip { min-height: 40px; transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-press) var(--ease); }
.chip:active, .nt-chip:active { transform: scale(.96); }
@media (pointer: coarse) { .chip, .nt-chip { min-height: var(--tap); } .footer-links a { padding: 10px 0; } .footer-bottom a { padding: 12px 0; display: inline-block; } }

/* ---------- 11 - loading & entry states ---------- */
/* thin gold bar while the next page loads (premium.js toggles html.is-navigating) */
html::after {
  content: ""; position: fixed; left: 0; top: var(--sat, 0px); height: 2px; width: 100%; z-index: 310; pointer-events: none;
  background: var(--gold); transform: scaleX(0); transform-origin: left; opacity: 0;
}
html.is-navigating::after { opacity: 1; transform: scaleX(.82); transition: transform 2.4s cubic-bezier(.1, .7, .2, 1), opacity .2s; }

/* images fade in once loaded (premium.js adds .img-ready) */
img.jt-img { opacity: 0; transition: opacity .4s var(--ease); }
img.jt-img.img-ready { opacity: 1; }

/* skeleton blocks for any grid that is still empty */
.jt-skeleton { border-radius: var(--r-card); min-height: 120px; background: linear-gradient(110deg, rgba(255,255,255,.04) 30%, rgba(255,255,255,.09) 50%, rgba(255,255,255,.04) 70%); background-size: 200% 100%; animation: shimmer 1.8s linear infinite; }
html[data-theme="light"] .jt-skeleton { background-image: linear-gradient(110deg, rgba(20,32,26,.05) 30%, rgba(20,32,26,.1) 50%, rgba(20,32,26,.05) 70%); }

/* smooth cross-page fade where the browser supports it (header stays put) */
@supports (view-transition-name: x) {
  @view-transition { navigation: auto; }
  .site-header { view-transition-name: jt-header; }
  ::view-transition-old(root) { animation: jt-vt-out 140ms var(--ease) both; }
  ::view-transition-new(root) { animation: jt-vt-in 260ms var(--ease) both; }
  ::view-transition-group(jt-header) { animation-duration: 0s; }
}
@keyframes jt-vt-out { to { opacity: 0; } }
@keyframes jt-vt-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- 12 - scrollbars, selection ---------- */
html { scrollbar-width: thin; scrollbar-color: rgba(212, 178, 122, .35) transparent; }
::selection { background: var(--gold); color: #111; }

/* ---------- 13 - light theme touches ---------- */
html[data-theme="light"] { --gold-line: rgba(138, 106, 47, .45); }
html[data-theme="light"] .eyebrow, html[data-theme="light"] .ab-label { color: #8A6A2F; }
html[data-theme="light"] .eyebrow::before, html[data-theme="light"] .ab-rule, html[data-theme="light"] .ab-head::after { background: #8A6A2F; }
html[data-theme="light"] .hero .hero-heading { color: #F7F3EB; }
html[data-theme="light"] .nav a::after { background: #8A6A2F; }
html[data-theme="light"] .hero .nav a::after, html[data-theme="light"] .site-footer a:hover { background: var(--gold); }
html[data-theme="light"] .btn[aria-busy="true"]::after { border-color: rgba(244,241,234,.3); border-top-color: #F4F1EA; }
html[data-theme="light"] .skip-link { background: #14201A; color: #F4F1EA; }

/* ---------- 14 - small screens ---------- */
@media (max-width: 700px) {
  .page-title { font-size: clamp(48px, 15vw, 84px); }
  .section-title { font-size: clamp(40px, 12vw, 64px); }
  .ab-title { font-size: clamp(40px, 12.5vw, 72px); }
  .cta-row .btn { width: 100%; justify-content: center; }
}

/* ---------- 15 - reduced motion: keep fades, drop movement ---------- */
@media (prefers-reduced-motion: reduce) {
  .btn:hover, .btn:active, .card:hover, .lk-card:hover, .note-card:hover, .tool-card:hover, .social-card:hover,
  .explore-row a:hover, .tile:hover, .ab-card:hover { transform: none !important; }
  html.is-navigating::after { transition: opacity .2s; transform: scaleX(1); }
  @view-transition { navigation: none; }
  .jt-skeleton { animation: none; }
}

/* article titles keep their own (smaller) scale */
.page-title.note-title { font-size: clamp(34px, 6vw, 64px); line-height: 1.03; }

/* touch: every link/button reaches a 44px target without changing the look */
@media (pointer: coarse) {
  .brand, .footer-links a, .note-pill, .nav-panel-foot a { min-height: var(--tap); display: inline-flex; align-items: center; }
  .text-link, .strip-link { min-height: var(--tap); align-items: center; }
  .footer-links { gap: 4px 24px; }
}
