/* ============================================================
   ALL EARS — base: reset, typography, grain, cursor, nav, monogram
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }

/* window must stay the scroller (Lenis + ScrollTrigger drive it):
   no fixed heights, and clip (not hidden) so no scroll container forms */
html.lenis, html.lenis body { height: auto; }
html, body { overflow-x: clip; }
body {
  /* ONE continuous sheet behind the whole page — sections are only washes */
  background: #F2E5CB url("../assets/real/paper-base.jpg") top center / 1400px auto repeat;
  color: var(--fg);
  font-family: var(--mono);
  font-size: var(--step-0);
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--brick); color: var(--paper); }

/* Smooth-scroll is JS-driven (Lenis). Keep native anchor smoothness as fallback. */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ---- Layout helpers ---- */
.wrap { width: min(100% - (var(--gutter) * 2), 1360px); margin-inline: auto; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.eyebrow-hand {
  font-family: var(--hand);
  font-size: var(--step-1);
  color: var(--accent);
  line-height: 1;
}

/* one sheet of fiber over the whole page — the paper is a global layer,
   so the color grade below can flow without ever breaking the material */
.fiber {
  position: fixed; inset: 0; z-index: 8985; pointer-events: none;
  background: url("../assets/real/paper-base.jpg") top center / 1400px auto repeat;
  mix-blend-mode: multiply; opacity: 0.34;
}

/* ============================================================
   FILM GRAIN — fixed, pointer-events none (perf-safe)
   ============================================================ */
.grain {
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: var(--grain-op, 0.38);
  mix-blend-mode: multiply;
  transition: opacity 0.25s linear;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.86' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.42'/></svg>");
  background-size: 240px 240px;
}
@media (prefers-reduced-motion: no-preference) {
  .grain { animation: grain-shift 0.6s steps(3) infinite; }
}
@keyframes grain-shift {
  0%   { transform: translate(0, 0); }
  33%  { transform: translate(-4px, 3px); }
  66%  { transform: translate(3px, -5px); }
  100% { transform: translate(0, 0); }
}

/* ============================================================
   "UP CLOSE" CURSOR — enhancement over the native cursor
   Native cursor stays visible. Disabled on touch + reduced-motion.
   ============================================================ */
.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 26px; height: 26px;
  border: 1px solid var(--brick);
  border-radius: 50%;
  z-index: var(--z-cursor);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease, background-color 0.35s ease, border-color 0.35s ease;
  will-change: transform;
  mix-blend-mode: multiply;
}
.cursor.is-ready { opacity: 1; }
.cursor__label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: var(--paper);
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.cursor.is-hover { background: var(--brick); border-color: var(--brick); mix-blend-mode: normal; }
.cursor.is-hover .cursor__label { opacity: 1; transform: scale(0.4); }
@media (pointer: coarse) { .cursor { display: none; } }
@media (prefers-reduced-motion: reduce) { .cursor { display: none; } }

/* ============================================================
   THE MONOGRAM — AE ligature (serif) + the 4-point star
   Letters are type; the star is a crafted, animated SVG.
   ============================================================ */
.monogram {
  display: inline-flex;
  align-items: center;
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  color: currentColor;
  user-select: none;
}
.monogram__a, .monogram__e { display: inline-block; }
.monogram__star {
  width: 0.42em;
  height: 0.42em;
  margin: 0 -0.06em;
  flex: none;
  transform-origin: center;
  color: var(--accent);
}
.monogram__star svg { width: 100%; height: 100%; overflow: visible; }
.monogram__star path { fill: currentColor; }

@media (prefers-reduced-motion: no-preference) {
  .monogram__star { animation: twinkle 4.2s var(--ease-inout) infinite; }
  .monogram.is-lit .monogram__star { animation: star-in 0.9s var(--ease-out) both, twinkle 4.2s var(--ease-inout) 0.9s infinite; }
}
@keyframes twinkle {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
  46%      { transform: scale(0.82) rotate(0deg); opacity: 0.72; }
  54%      { transform: scale(1.12) rotate(0deg); opacity: 1; }
}
@keyframes star-in {
  0%   { transform: scale(0) rotate(-120deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 68px;
  z-index: var(--z-nav);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: var(--gutter);
  color: var(--paper);
  mix-blend-mode: normal;
  transition: color 0.5s ease;
  -webkit-backdrop-filter: blur(5px);
          backdrop-filter: blur(5px);
}
/* a soft scrim so scrolled copy never collides with the mark —
   universal (works over any section tone), never a hard bar */
.nav::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(13, 10, 6, 0.4), rgba(13, 10, 6, 0));
  pointer-events: none;
}
.nav.on-light::before { background: linear-gradient(180deg, rgba(255, 244, 224, 0.72), rgba(255, 244, 224, 0)); }
.nav.on-light { color: var(--espresso); }
.nav__brand { display: inline-flex; align-items: center; gap: 0.55em; font-size: 1.15rem; }
.nav__mono {
  width: 34px; height: 21px; flex: none; background: currentColor;
  -webkit-mask: url("../assets/brand/monogram-ink.png") left center / contain no-repeat;
          mask: url("../assets/brand/monogram-ink.png") left center / contain no-repeat;
}
.nav__brand-word { font-family: var(--serif); font-weight: 500; letter-spacing: 0.01em; }
.nav__links { display: flex; align-items: center; gap: clamp(1rem, 2.4vw, 2.4rem); }
.nav__link {
  font-family: var(--sans);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 500;
  position: relative;
  padding-block: 0.4em;
}
.nav__link::after {
  content: ""; position: absolute; left: 0; bottom: 0.1em;
  width: 100%; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right; transition: transform 0.5s var(--ease-out);
}
.nav__link:hover::after { transform: scaleX(1); transform-origin: left; }
.nav__cta {
  font-family: var(--sans);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  padding: 0.6em 1.15em;
  border: 1px solid currentColor;
  border-radius: 999px;
  transition: background-color 0.4s var(--ease-out), color 0.4s var(--ease-out);
}
.nav__cta:hover { background: var(--paper); color: var(--brick); }
.nav.on-light .nav__cta:hover { background: var(--brick); color: var(--paper); }
@media (max-width: 720px) {
  .nav__links { gap: 0.9rem; }
  .nav__link { display: none; }
}

/* ============================================================
   BUTTONS / LINKS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  font-family: var(--sans);
  font-weight: 600;
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 0.95em 1.6em;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.25s var(--ease-out), background-color 0.4s var(--ease-out), color 0.4s var(--ease-out);
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn--solid { background: var(--paper); color: var(--brick); }
.btn--solid:hover { background: var(--brick); color: var(--paper); }
.btn--ghost { border-color: currentColor; color: currentColor; }
.btn--ghost:hover { background: var(--espresso); color: var(--paper); }
.btn__dot { width: 0.5em; height: 0.5em; border-radius: 50%; background: currentColor; }

.textlink {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-weight: 600;
  color: var(--brick);
  letter-spacing: 0.01em;
}
.textlink .arrow { transition: transform 0.4s var(--ease-out); }
.textlink:hover .arrow { transform: translateX(6px); }
