/* ==========================================================================
   knewAline — base.css (foundation: tokens, reset, type, header, buttons,
   view switching, reveal utility, footer). Owned by the lead.
   Free fonts only: Figtree + Mrs Saint Delafield (Google Fonts, SIL OFL).
   ========================================================================== */

:root {
  /* colour */
  --bg: #000;
  --bg-2: #07080a;
  --ink: #f3f3f1;
  --ink-2: rgba(243, 243, 241, .74);
  --ink-3: rgba(243, 243, 241, .48);
  --ink-4: rgba(243, 243, 241, .26);
  --hair: rgba(255, 255, 255, .14);
  --hair-2: rgba(255, 255, 255, .28);
  --silver: linear-gradient(180deg, #ffffff 0%, #e4e6ea 34%, #9a9da4 58%, #e9ebee 100%);
  --silver-h: linear-gradient(100deg, #8e9198 0%, #ffffff 22%, #c9ccd2 48%, #ffffff 70%, #a3a6ad 100%);

  /* type */
  --font: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-sign: "Mrs Saint Delafield", "Snell Roundhand", "Brush Script MT", cursive;
  --fs-eyebrow: clamp(11px, .9vw, 13px);
  --fs-body: clamp(16px, 1.15vw, 19px);
  --fs-lead: clamp(17px, 1.5vw, 22px);
  --fs-h1: clamp(46px, 7.4vw, 112px);
  --fs-h2: clamp(38px, 5.2vw, 80px);
  --track-eyebrow: .52em;

  /* layout */
  --header-h: clamp(64px, 7vw, 84px);
  /* landscape phones (viewport-fit=cover): never less than the notch / Dynamic Island side inset; env() is 0 elsewhere */
  --gutter: max(clamp(20px, 4vw, 56px), env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  --maxw: 1280px;
  --measure: 34em;

  /* motion */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --dur: .9s;

  /* layers */
  --z-stage: 0;
  --z-content: 2;
  --z-header: 20;
  --z-veil: 40;
  --z-cursor: 60;
  --z-preloader: 80;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); color-scheme: dark; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, video, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, p, ol, ul, dl, dd { margin: 0; padding: 0; }
ol, ul { list-style: none; }
[hidden] { display: none !important; }
::selection { background: rgba(255, 255, 255, .88); color: #000; }
:focus-visible { outline: 1px solid rgba(255, 255, 255, .85); outline-offset: 4px; border-radius: 2px; }
/* headings that receive focus programmatically (skip link, view switch, Learn More — js/app.js) are not controls */
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; }

html.is-loading { overflow: hidden; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 100;
  padding: 10px 16px; background: #fff; color: #000; border-radius: 999px; font-size: 14px;
  transition: top .3s var(--ease-out);
}
.skip-link:focus { top: 12px; }

/* ---------- stage canvas ---------- */
.stage {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh; height: 100lvh;
  z-index: var(--z-stage);
  pointer-events: none;
}

/* ---------- typography primitives ---------- */
.eyebrow {
  font-size: var(--fs-eyebrow);
  font-weight: 400;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--ink-2);
  margin-right: calc(var(--track-eyebrow) * -1); /* optically centre tracked text */
}
.silver-text {
  background: var(--silver);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.k-mark { fill: currentColor; }

/* ---------- header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0;
  z-index: var(--z-header);
  height: var(--header-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 var(--gutter);
  pointer-events: none;
}
.site-header > * { pointer-events: auto; }
.site-header__brand { justify-self: start; display: inline-flex; padding: 8px 4px; }
.site-header__brand .k-mark { height: clamp(24px, 2.2vw, 30px); width: auto; }
.site-nav { position: relative; display: flex; gap: clamp(28px, 4.4vw, 64px); }
.site-nav__link {
  position: relative;
  font-size: clamp(13px, calc(7px + .5vw), 20px); /* ≈14.2px at 1440, ≈19.8px at 2560 */
  letter-spacing: .01em;
  color: var(--ink-2);
  padding: 8px 0;
  transition: color .4s var(--ease-out);
}
.site-nav__link[aria-current="page"] { color: var(--ink); }
.site-nav__indicator {
  position: absolute; left: 0; bottom: 2px;
  height: 1px; width: 0;
  background: var(--ink);
  transform-origin: left;
  transition: transform .7s var(--ease-out), width .7s var(--ease-out);
}
.site-header__actions { justify-self: end; display: flex; align-items: center; gap: clamp(10px, 1.4vw, 18px); }

/* ---------- buttons ---------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; gap: .6em;
  font-size: clamp(13px, calc(7px + .5vw), 20px);
  letter-spacing: .01em;
  white-space: nowrap;
  transition: color .4s var(--ease-out), background-color .4s var(--ease-out), border-color .4s var(--ease-out);
}
.btn--pill {
  padding: .72em 1.45em;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 999px;
}
.btn--line {
  padding: .9em 0;
  font-size: clamp(14px, 1.1vw, 17px);
  border-bottom: 1px solid var(--hair-2);
}

/* ---------- views ---------- */
main { position: relative; z-index: var(--z-content); overflow-x: clip; } /* decorative scrims (::before) may bleed; clip keeps sticky working */
.view { position: relative; }

/* bottle anchors: empty boxes the WebGL bottle is fitted into */
.bottle-anchor { position: relative; touch-action: pan-y pinch-zoom; -webkit-tap-highlight-color: transparent; } /* horizontal = turn (stage) */
/* iOS: a long press on the (empty) anchor started a text selection of the copy nearby + the Copy/Look Up menu
   while the bottle turned — the bottle is not text */
.bottle-anchor { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.bottle-anchor:focus-visible { outline: none; }
/* keyboard focus: hairline viewfinder corners around the bottle (the stage fits it at 92% of the anchor height,
   centred, base on the anchor bottom; the frame leaves room for a quarter turn) */
html:not(.no-webgl) .bottle-anchor:focus-visible::after {
  --c: rgba(255, 255, 255, .82);
  --arm: 16px;
  content: ""; position: absolute; left: 50%; bottom: -14px; z-index: 1;
  height: calc(92% + 30px); aspect-ratio: .42;
  transform: translateX(-50%);
  pointer-events: none;
  background:
    linear-gradient(var(--c) 0 0) 0 0 / var(--arm) 1px, linear-gradient(var(--c) 0 0) 0 0 / 1px var(--arm),
    linear-gradient(var(--c) 0 0) 100% 0 / var(--arm) 1px, linear-gradient(var(--c) 0 0) 100% 0 / 1px var(--arm),
    linear-gradient(var(--c) 0 0) 0 100% / var(--arm) 1px, linear-gradient(var(--c) 0 0) 0 100% / 1px var(--arm),
    linear-gradient(var(--c) 0 0) 100% 100% / var(--arm) 1px, linear-gradient(var(--c) 0 0) 100% 100% / 1px var(--arm);
  background-repeat: no-repeat;
  animation: kn-focus-in .7s var(--ease-out) both;
}
@keyframes kn-focus-in { from { opacity: 0; transform: translateX(-50%) scale(1.05); } }
/* no-WebGL photo fallback (release.css uses the anchor's pseudo-elements there): a quiet hairline frame */
html.no-webgl .bottle-anchor:focus-visible { outline: 1px solid rgba(255, 255, 255, .6); outline-offset: 8px; border-radius: 14px; }
.bottle-fallback { display: none; }
html.no-webgl .bottle-fallback {
  display: block; height: 100%; width: auto; margin: 0 auto; object-fit: contain;
  -webkit-mask-image: linear-gradient(180deg, #000 82%, transparent);
          mask-image: linear-gradient(180deg, #000 82%, transparent);
}

/* ---------- reveal utility (js/utils.js observeReveals) ----------
   <el data-reveal>            fade + rise
   <el data-reveal="mask">     children .line > .line__inner slide up from a mask (use splitLines)
   style="--d: .2s"            per-element delay                                   */
[data-reveal] { --d: 0s; }
html.js [data-reveal]:not([data-reveal="mask"]) {
  opacity: 0; transform: translate3d(0, 28px, 0);
  transition: opacity 1.1s var(--ease-out) var(--d), transform 1.3s var(--ease-out) var(--d);
}
html.js [data-reveal].is-in:not([data-reveal="mask"]) { opacity: 1; transform: none; }
.line { display: block; overflow: hidden; padding-bottom: .08em; margin-bottom: -.08em; }
.line__inner { display: block; will-change: transform; }
html.js [data-reveal="mask"] .line__inner {
  transform: translate3d(0, 105%, 0);
  transition: transform 1.25s var(--ease-out) calc(var(--d) + var(--i, 0) * .09s);
}
html.js [data-reveal="mask"].is-in .line__inner { transform: none; }

/* ---------- footer ---------- */
.site-footer {
  position: relative; z-index: var(--z-content);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; /* copyright on the page axis */
  padding: 40px var(--gutter) calc(40px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--hair);
  font-size: 13px; color: var(--ink-3);
}
.site-footer__mark { justify-self: start; height: 22px; width: auto; color: var(--ink-2); }
.site-footer__line { text-align: center; }
.site-footer__link { justify-self: end; color: var(--ink-2); transition: color .3s; }

/* hover looks only where a real pointer hovers: on touch a tapped link / the muted sound toggle stayed lit (sticky :hover) */
@media (hover: hover) and (pointer: fine) {
  .site-nav__link:hover { color: var(--ink); }
  .btn--pill:hover { background: #fff; color: #000; border-color: #fff; }
  .btn--line:hover { border-color: var(--ink); }
  .site-footer__link:hover { color: var(--ink); }
}
/* touch: a brief dim instead of the browser's tap-highlight box */
@media (hover: none) {
  .site-nav__link:active, .btn:active, .site-footer__link:active, .sound-toggle:active, .site-header__brand:active { opacity: .7; }
}
/* touch: ≥ 44 px hit areas around the small header / footer controls — invisible, no layout change */
@media (pointer: coarse) {
  .site-nav__link::after { content: ""; position: absolute; inset: -4px -8px; }
  .site-header__brand { position: relative; }
  .site-header__brand::after { content: ""; position: absolute; inset: -2px -10px; }
  .site-footer__link { position: relative; }
  .site-footer__link::after { content: ""; position: absolute; inset: -12px -4px; }
  .btn--pill::after { content: ""; position: absolute; inset: -2px; border-radius: inherit; }
}

/* ---------- responsive header + footer ---------- */
@media (max-width: 720px) {
  .site-header { grid-template-columns: auto 1fr auto; gap: 12px; }
  .site-nav { justify-self: center; gap: 22px; }
  .site-nav__link { font-size: 13px; }
  .site-header .btn--pill { display: none; }
  .site-footer { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 14px; }
  .site-footer__mark, .site-footer__link { justify-self: center; }
}

/* ---------- static page (index.html boot guard: the modules never started) ----------
   Content stays readable: no preloader/veil/cursor, the photo bottle (html.no-webgl), plain hash routing. */
html.no-app .preloader, html.no-app .veil, html.no-app .cursor, html.no-app .sound-toggle { display: none !important; }

/* ---------- ?og: share-image layout (assets/img/og-1200x630.jpg is captured from it) ---------- */
html.og .site-nav, html.og .site-header__actions, html.og .r-hero__hint, html.og .r-hero__meta, html.og .grain { visibility: hidden; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0s !important; }
  html.js [data-reveal], html.js [data-reveal="mask"] .line__inner { opacity: 1 !important; transform: none !important; }
}
