/* ════════════════════════════════════════════════════════════
   LEMON — Homepage Redesign · Shared base
   Tokens via lemon-tokens.css · Fraunces speaks · Inter works
   Geist Mono for meta · Ink on Cream · Amber acts
   ════════════════════════════════════════════════════════════ */
@import url("lemon-tokens.css");

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream:        #FAF7F0;
  --cream-deep:   #F4EFE4;
  --ink:          #1C1A17;
  --ink-soft:     #26231F;
  --amber:        #FEC107;
  --amber-deep:   #E9AC00;
  --graphite:     #57534E;
  --graphite-soft:#7A746C;
  --coral:        #FF6A3D;
  --violet:       #6B4EE6;
  --teal:         #1BB69E;
  --card:         #FFFFFF;
  --line:         rgba(28,26,23,0.12);
  --line-soft:    rgba(28,26,23,0.07);
  --line-cream:   rgba(250,247,240,0.16);
  --line-cream-soft: rgba(250,247,240,0.09);
  --radius:       14px;
  --radius-lg:    20px;
  --shadow-md:    0 18px 50px rgba(28,26,23,0.08);
  --maxw:         1280px;
  --ease-out:     cubic-bezier(0.22, 1, 0.36, 1);
  --dur:          0.9s;
}

html { scroll-behavior: smooth; }

body {
  background: var(--cream);
  color: var(--graphite);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { color: var(--ink); }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
strong { color: var(--ink); font-weight: 600; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(1.4rem, 4vw, 3rem); }

/* ─── Type voices ─── */
.f-display {
  font-family: var(--font-display);
  font-weight: 300;
  font-variation-settings: "opsz" 144;
  letter-spacing: -0.025em;
  line-height: 1.02;
  color: var(--ink);
}
.f-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-variation-settings: "opsz" 144;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink);
}
.f-italic { font-style: italic; font-weight: 400; }
.mono {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--graphite-soft);
}
.mono.amber { color: var(--amber-deep); }
.lead {
  font-size: clamp(1.08rem, 1.5vw, 1.25rem);
  line-height: 1.55;
  color: var(--graphite);
  text-wrap: pretty;
}

/* Eyebrow: mono with amber dash */
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.7rem; white-space: nowrap;
  font-family: var(--font-mono); font-weight: 500; font-size: 11px;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--graphite);
}
.eyebrow::before {
  content: ''; display: block; width: 28px; height: 2px;
  background: var(--amber); border-radius: 2px;
}
.eyebrow .idx { color: var(--amber-deep); }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  font-family: var(--font-sans); font-size: 0.93rem; font-weight: 600;
  letter-spacing: 0.01em; padding: 1rem 1.85rem; min-height: 48px;
  border-radius: 10px; cursor: pointer; border: 1.5px solid transparent;
  transition: background 0.45s var(--ease-out), color 0.45s var(--ease-out), border-color 0.45s var(--ease-out);
  position: relative;
}
.btn-primary { background: var(--amber); color: var(--ink); }
.btn-primary:hover { background: var(--amber-deep); color: var(--ink); }
.btn-outline { background: transparent; color: var(--ink); border-color: rgba(28,26,23,0.25); }
.btn-outline:hover { border-color: rgba(28,26,23,0.45); background: rgba(28,26,23,0.06); color: var(--ink); }
.on-ink .btn-outline { color: var(--cream); border-color: rgba(250,247,240,0.35); }
.on-ink .btn-outline:hover { background: rgba(250,247,240,0.14); color: var(--cream); border-color: rgba(250,247,240,0.6); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.92rem; font-weight: 600; color: var(--ink); min-height: 44px;
}
.btn-ghost::after { content: '→'; transition: transform 0.45s var(--ease-out); }
.btn-ghost:hover::after { transform: translateX(5px); }
.btn-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* ─── Nav ─── */
#navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  padding: 1.2rem 0;
  transition: background 0.4s ease, padding 0.3s ease, box-shadow 0.4s ease;
}
#navbar.scrolled {
  background: rgba(250,247,240,0.92);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  padding: 0.7rem 0;
  box-shadow: 0 1px 0 var(--line);
}
#navbar.on-dark:not(.scrolled) .nav-links a { color: rgba(250,247,240,0.75); }
#navbar.on-dark:not(.scrolled) .nav-links a:hover { color: var(--cream); }
#navbar.on-dark:not(.scrolled) .wordmark { color: var(--cream); }
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(1.4rem, 4vw, 3rem);
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
}
.nav-logo { display: flex; align-items: center; gap: 0.6rem; }
.nav-logo img { height: 44px; width: auto; border-radius: 9px; transition: height 0.3s ease; }
#navbar.scrolled .nav-logo img { height: 38px; }
.wordmark { font-family: var(--font-display); font-weight: 400; font-size: 1.5rem; color: var(--ink); transition: color 0.4s ease; }
.nav-links { display: flex; align-items: center; gap: 1.7rem; list-style: none; }
.nav-links a {
  font-size: 0.82rem; font-weight: 500; letter-spacing: 0.04em;
  color: var(--graphite); transition: color 0.3s ease; padding: 0.5rem 0;
}
.nav-links a:hover { color: var(--ink); }
.nav-cta {
  font-size: 0.82rem; font-weight: 600; color: var(--ink); background: var(--amber);
  padding: 0.65rem 1.25rem; border-radius: 9px;
  transition: background 0.45s var(--ease-out), color 0.45s var(--ease-out);
  white-space: nowrap;
}
.nav-cta:hover { background: var(--amber-deep); color: var(--ink); }
@media (max-width: 920px) { .nav-links { display: none; } }

/* ─── Footer ─── */
footer { background: var(--cream-deep); padding: 3.4rem 0 2.4rem; border-top: 1px solid var(--line); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1.5rem; }
.footer-left { display: flex; align-items: center; gap: 0.7rem; }
.footer-left img { height: 34px; border-radius: 7px; }
.footer-left .wordmark { font-size: 1.15rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.4rem; }
.footer-links a { font-size: 0.84rem; color: var(--graphite); transition: color 0.3s ease; padding: 0.4rem 0; }
.footer-links a:hover { color: var(--ink); }
.footer-copy {
  width: 100%; text-align: center; padding-top: 1.8rem; margin-top: 1.8rem;
  border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--graphite-soft);
}

/* ─── Word-by-word reveal ───
   JS wraps each word in .w > .wi with a trailing NBSP glyph for
   spacing; .w is inline-block so lines can break between words. */
[data-words] .w { display: inline-block; }
[data-words] .wi { display: inline-block; will-change: transform, opacity; }
@media (prefers-reduced-motion: no-preference) {
  html[data-motion] [data-words]:not(.in) .wi { transform: translateY(0.5em); opacity: 0; }
  [data-words] .wi { transition: transform 1s var(--ease-out), opacity 0.8s ease; transition-delay: calc(var(--wd, 0) * 1s); }
}

/* ─── Brush underline (lemon-underline.png, drawn left→right) ─── */
.brush-u { position: relative; display: inline-block; white-space: nowrap; }
.brush-u::after {
  content: ''; position: absolute; left: -2%; right: -2%; bottom: -0.18em; height: 0.22em;
  background: url('../assets/lemon-underline.png') no-repeat center / 100% 100%;
  pointer-events: none;
}
.brush-u.u-amber::after {
  filter: invert(69%) sepia(94%) saturate(1395%) hue-rotate(2deg) brightness(104%) contrast(99%);
}
@media (prefers-reduced-motion: no-preference) {
  .brush-u::after { clip-path: inset(0 100% 0 0); transition: clip-path 0.9s var(--ease-out) 0.2s; }
  .brush-u.in::after { clip-path: inset(0 0 0 0); }
}
@media (prefers-reduced-motion: reduce) { .brush-u::after { clip-path: none; } }

/* ─── Scroll reveals ─── */
@media (prefers-reduced-motion: no-preference) {
  [data-reveal] { opacity: 0; transform: translateY(26px); transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out); transition-delay: calc(var(--rd, 0) * 1s); }
  [data-reveal].in { opacity: 1; transform: none; }
  [data-reveal="left"] { transform: translateX(-30px); }
  [data-reveal="right"] { transform: translateX(30px); }
  [data-reveal="scale"] { transform: scale(0.94); }
  [data-reveal].in { transform: none; }
  html[data-motion="calm"] [data-reveal] { transform: translateY(12px); }
  html[data-motion="calm"] [data-reveal].in { transform: none; }
}

/* ─── Parallax media ─── */
.px-wrap { overflow: hidden; position: relative; }
.px-wrap img, .px-wrap .px-inner { will-change: transform; }
[data-parallax] { will-change: transform; }

/* ─── Marquee ─── */
.marquee { overflow: hidden; white-space: nowrap; display: flex; }
.marquee-track { display: flex; align-items: center; gap: 3.2rem; padding-right: 3.2rem; flex-shrink: 0; min-width: 100%; }
@media (prefers-reduced-motion: no-preference) {
  .marquee-track { animation: marquee var(--marquee-dur, 36s) linear infinite; }
  html[data-motion="calm"] .marquee-track { animation-duration: calc(var(--marquee-dur, 36s) * 1.8); }
}
@keyframes marquee { to { transform: translateX(calc(-100% - 3.2rem)); } }

/* ─── Grain overlay (cinematic only) ─── */
.grain {
  position: fixed; inset: -50%; width: 200%; height: 200%; z-index: 999; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.05; mix-blend-mode: multiply;
}
html[data-motion="calm"] .grain { opacity: 0.025; }
@media (prefers-reduced-motion: no-preference) {
  html[data-motion="cinematic"] .grain { animation: grain 0.9s steps(4) infinite; }
}
@keyframes grain {
  0% { transform: translate(0,0); } 25% { transform: translate(-2%,1%); }
  50% { transform: translate(1%,-2%); } 75% { transform: translate(-1%,2%); } 100% { transform: translate(0,0); }
}

/* ─── Imagery density ─── */
html[data-imagery="lean"] .img-rich { display: none !important; }

/* ─── Image fallback placeholder (set by JS onerror) ─── */
.img-fallback {
  background: repeating-linear-gradient(-45deg, var(--cream-deep) 0 14px, rgba(28,26,23,0.045) 14px 28px);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--graphite-soft); min-height: 200px;
}

/* ─── Direction switcher (prototype chrome) ─── */
.dir-switch {
  position: fixed; left: 1.2rem; bottom: 1.2rem; z-index: 1000;
  display: flex; align-items: center; gap: 0.15rem;
  background: rgba(28,26,23,0.92); border-radius: 50px; padding: 0.3rem 0.5rem 0.3rem 1rem;
  backdrop-filter: blur(10px); box-shadow: 0 8px 30px rgba(28,26,23,0.25);
}
.dir-switch .ds-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; color: rgba(250,247,240,0.55); margin-right: 0.6rem; white-space: nowrap;
}
.dir-switch a {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em;
  color: rgba(250,247,240,0.6); padding: 0.42rem 0.65rem; border-radius: 50px;
  transition: color 0.25s ease, background 0.25s ease; white-space: nowrap;
}
.dir-switch a:hover { color: var(--cream); }
.dir-switch a.active { background: var(--amber); color: var(--ink); font-weight: 500; }

/* ─── Scroll cue ─── */
.scroll-cue { display: inline-flex; flex-direction: column; align-items: center; gap: 0.7rem; }
.scroll-cue .line { width: 1px; height: 56px; background: currentColor; opacity: 0.35; position: relative; overflow: hidden; }
@media (prefers-reduced-motion: no-preference) {
  .scroll-cue .line::after {
    content: ''; position: absolute; left: 0; top: -100%; width: 100%; height: 100%;
    background: var(--amber); animation: cue 2.2s var(--ease-out) infinite;
  }
}
@keyframes cue { 0% { top: -100%; } 60%, 100% { top: 100%; } }

/* ─── Suspended-rendering guard (set by lemon-motion.js) ───
   When frames aren't flowing (hidden iframe, capture, print),
   collapse all motion so content shows in its final state. */
html.no-anim *, html.no-anim *::before, html.no-anim *::after {
  transition-duration: 0s !important;
  transition-delay: 0s !important;
  animation-duration: 0s !important;
  animation-delay: 0s !important;
}

/* ─── Floating hover preview (created by lemon-motion.js) ─── */
.float-preview {
  position: fixed; left: 0; top: 0; z-index: 300; pointer-events: none;
  width: 270px; aspect-ratio: 4/3; border-radius: 12px; overflow: hidden;
  opacity: 0; transition: opacity 0.35s ease;
  box-shadow: 0 24px 60px rgba(28,26,23,0.28);
  background: var(--cream-deep);
}
.float-preview.on { opacity: 1; }
.float-preview img { width: 100%; height: 100%; object-fit: cover; }
html[data-imagery="lean"] .float-preview { display: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .grain { animation: none; }
}
