/* Zag Store — Refraction prototype styles.
   Art direction: "The Z as a light source". Every colour comes from
   tokens.css; brand primitives (var(--zag-*)) are used only decoratively. */

/* Registered properties (animatable custom properties) ------------------- */
@property --sheen { syntax: "<percentage>"; inherits: false; initial-value: -60%; }
@property --btn-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

/* Base ------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  background: var(--bg-canvas);
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-optical-sizing: auto;
  overflow-x: clip;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

::selection { background: color-mix(in srgb, var(--accent-fill) 28%, transparent); }

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 6px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  left: 16px; top: -100px;
  z-index: 100;
  padding: 12px 18px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: var(--elevation-2);
  font-weight: 600;
}
.skip-link:focus { top: calc(env(safe-area-inset-top) + 12px); }

/* Atmosphere ------------------------------------------------------------- */
.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.atmo {
  position: absolute;
  width: 90vmax;
  height: 90vmax;
  border-radius: 50%;
  will-change: transform;
}
.atmo--a { left: -46vmax; top: -44vmax; background: radial-gradient(closest-side, var(--atmo-a), transparent); animation: drift-a 38s ease-in-out infinite alternate; }
.atmo--b { right: -48vmax; top: 10vmax; background: radial-gradient(closest-side, var(--atmo-b), transparent); animation: drift-b 46s ease-in-out infinite alternate; }
.atmo--c { left: 10vmax; bottom: -64vmax; background: radial-gradient(closest-side, var(--atmo-c), transparent); animation: drift-a 52s ease-in-out infinite alternate-reverse; }
.atmo-grain {
  position: absolute;
  inset: 0;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes drift-a { to { transform: translate3d(8vmax, 6vmax, 0) scale(1.08); } }
@keyframes drift-b { to { transform: translate3d(-10vmax, 8vmax, 0) scale(0.94); } }

/* Typography system ------------------------------------------------------
   Display: SF Pro Display (optical sizing) set tight and heavy.
   Labels:  uppercase, generously tracked, case-sensitive punctuation.
   Indices: monospaced numerals — the "chapter" system shared by the
            navigation, section kickers and footer. */
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-feature-settings: "case" 1;
}
.kicker__num {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}
.kicker__num::after {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--spectrum-brand);
}
.kicker--center { justify-content: center; }

.h2 {
  font-size: var(--text-h2);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.05em;
  text-wrap: balance;
}
.h2--xl { font-size: clamp(2.5rem, 6.2vw, 6rem); letter-spacing: -0.056em; line-height: 0.95; }

.spectrum-text {
  background: var(--spectrum-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding-bottom: 0.06em;
}

.line { display: block; overflow: hidden; padding: 0.04em 0.08em 0.12em; margin: 0 -0.08em -0.12em; }
.line__inner { display: inline-block; will-change: transform; }

.body-lg {
  color: var(--text-secondary);
  font-size: var(--text-lede);
  line-height: 1.6;
  text-wrap: pretty;
  max-width: 44ch;
}

.sample-note {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
}

.status-dot {
  display: inline-block;
  flex: none;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--status-live);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--status-live) 18%, transparent);
}

/* Buttons ----------------------------------------------------------------
   One system, three sizes. Uppercase tracked labels that roll on hover,
   an icon "lens" whose arrow exits and re-enters, a spectral edge that
   turns once on hover, a pointer-following light, and a firm press. */
.btn {
  --h: 54px;
  --pad: 26px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--h);
  padding: 0 calc((var(--h) - var(--icon)) / 2) 0 var(--pad);
  --icon: calc(var(--h) - 12px);
  border: 0;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-feature-settings: "case" 1;
  white-space: nowrap;
  cursor: pointer;
  isolation: isolate;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    box-shadow 500ms var(--ease-out-quart),
    background-color 400ms var(--ease-out-quart),
    color 300ms linear;
}
.btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 4px; border-radius: var(--radius-pill); }

/* Label roll (the copy is visual only: alt text "" keeps it out of the accessible name) */
.btn__label {
  position: relative;
  display: inline-grid;
  overflow: hidden;
  line-height: 1.35;
  margin-right: -0.15em;
}
.btn__label > span,
.btn__label::after {
  grid-area: 1 / 1;
  transition: transform 650ms var(--ease-out-expo);
}
.btn__label::after {
  content: attr(data-label);
  content: attr(data-label) / "";
  transform: translateY(102%);
}

.btn__icon {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: var(--icon);
  height: var(--icon);
  border-radius: 50%;
  overflow: hidden;
  transition: transform 600ms var(--ease-out-expo), background-color 400ms var(--ease-out-quart);
}
.btn__arrow {
  grid-area: 1 / 1;
  width: 17px;
  height: 17px;
  transition: transform 650ms var(--ease-out-expo);
}
.btn__arrow--next { transform: translateX(-190%); }

/* Spectral edge: a 1px conic ring masked to the outline */
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--btn-angle), var(--zag-cyan-500), var(--zag-blue-500), var(--zag-magenta-500), var(--zag-cyan-300), var(--zag-cyan-500));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0;
  transition: opacity 500ms var(--ease-out-quart), --btn-angle 1600ms var(--ease-out-expo);
  pointer-events: none;
}
/* Pointer light */
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(140px circle at var(--mx, 50%) var(--my, 50%), var(--btn-ink-glow), transparent 65%);
  opacity: 0;
  transition: opacity 400ms var(--ease-out-quart);
  pointer-events: none;
}

.btn--primary {
  background: var(--btn-ink-bg);
  color: var(--btn-ink-text);
  box-shadow: var(--btn-ink-shadow);
}
.btn--primary::before { opacity: 0.55; }
.btn--primary .btn__icon {
  background: var(--spectrum-brand);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -6px 12px rgba(20, 20, 120, 0.25);
}

.btn--ghost {
  background: var(--btn-ghost-fill);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
}
.btn--ghost .btn__icon { box-shadow: inset 0 0 0 1px var(--border-strong); }

@media (hover: hover) {
  .btn:hover .btn__label > span { transform: translateY(-102%); }
  .btn:hover .btn__label::after { transform: translateY(0); }
  .btn:hover .btn__arrow { transform: translateX(190%); }
  .btn:hover .btn__arrow--next { transform: translateX(0); }
  .btn:hover::before { opacity: 1; --btn-angle: 360deg; }
  .btn:hover::after { opacity: 1; }
  .btn--primary:hover { box-shadow: var(--btn-ink-shadow-hover); }
  .btn--ghost:hover { background: var(--btn-ghost-fill-hover); box-shadow: inset 0 0 0 1px transparent; }
}
/* Press feedback stays inside the button: the icon dips and the surface dims. */
.btn:active .btn__icon { transform: scale(0.88); transition-duration: 120ms; }
.btn:active { filter: brightness(0.94); }

.btn--sm { --h: 42px; --pad: 18px; gap: 12px; font-size: 11px; }
.btn--sm .btn__arrow { width: 14px; height: 14px; }
.btn--lg { --h: 62px; --pad: 32px; font-size: 12.5px; }
.btn--block { width: 100%; }

/* Header ----------------------------------------------------------------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
}
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--header-scrolled-bg);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  backdrop-filter: blur(22px) saturate(170%);
  border-bottom: 1px solid var(--border-subtle);
  opacity: 0;
  transition: opacity 600ms var(--ease-out-quart);
}
.site-header.is-scrolled::before { opacity: 1; }

.site-header__bar {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 76px;
  max-width: 1680px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
  box-sizing: content-box;
  transition: height 600ms var(--ease-out-expo);
}
.site-header.is-scrolled .site-header__bar { height: 64px; }

.brand { display: inline-flex; align-items: center; gap: 10px; justify-self: start; }
.brand__mark { width: 28px; height: 28px; object-fit: contain; }
.brand__name { font-size: 15.5px; font-weight: 700; letter-spacing: -0.035em; }

.primary-nav {
  display: flex;
  align-items: center;
  gap: clamp(30px, 3.3vw, 52px);
}
.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 12px 0;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  font-feature-settings: "case" 1;
  transition: color 300ms linear;
}
.nav-link__label {
  display: inline-grid;
  overflow: hidden;
  line-height: 1.3;
  margin-top: -0.15em;
  margin-right: -0.17em; /* optical: cancel trailing tracking */
}
.nav-link__label > span,
.nav-link__label::after {
  grid-area: 1 / 1;
  transition: transform 600ms var(--ease-out-expo);
}
.nav-link__label::after {
  content: attr(data-label);
  content: attr(data-label) / "";
  color: var(--text-primary);
  transform: translateY(102%);
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0.17em;
  bottom: 4px;
  height: 1px;
  background: var(--spectrum-brand);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 700ms var(--ease-out-expo);
}
@media (hover: hover) {
  .nav-link:hover .nav-link__label > span { transform: translateY(-102%); }
  .nav-link:hover .nav-link__label::after { transform: translateY(0); }
  .nav-link:hover::after { transform: scaleX(1); transform-origin: left; }
}
.nav-link[aria-current] { color: var(--text-primary); }
.nav-link[aria-current]::after { transform: scaleX(1); transform-origin: left; }

.site-header__actions { display: flex; align-items: center; gap: 12px; justify-self: end; }

.menu-toggle {
  display: none;
  width: 44px; height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.menu-toggle__bars { display: grid; gap: 6px; width: 20px; margin: auto; }
.menu-toggle__bars span { display: block; height: 1.5px; border-radius: 2px; background: currentColor; transition: transform var(--dur-base) var(--ease-out-expo); }
.menu-toggle__bars span:last-child { width: 70%; justify-self: end; }
.menu-toggle[aria-expanded="true"] .menu-toggle__bars span:first-child { transform: translateY(3.75px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle__bars span:last-child { width: 100%; transform: translateY(-3.75px) rotate(-45deg); }

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  align-content: start;
  gap: 34px;
  padding: calc(env(safe-area-inset-top) + 92px) var(--gutter) calc(env(safe-area-inset-bottom) + 28px);
  overflow-y: auto;
  background: var(--header-scrolled-bg);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  backdrop-filter: blur(28px) saturate(170%);
}
.mobile-menu[hidden] { display: none; }
html.menu-open, html.menu-open body { overflow: hidden; }
.mobile-menu__nav { display: grid; }
.mobile-menu__nav a {
  display: flex;
  align-items: baseline;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 26px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.mobile-menu__nav a[aria-current] { color: var(--accent-text); }
.mobile-menu__nav a[aria-current]::after {
  content: "";
  width: 7px; height: 7px;
  margin-left: auto;
  align-self: center;
  border-radius: 50%;
  background: var(--spectrum-brand);
}
.mobile-menu__appearance { display: grid; gap: 14px; }

/* Appearance selector ---------------------------------------------------- */
.appearance {
  --opt: 30px;
  --i: 0;
  position: relative;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--opt);
  margin: 0;
  padding: 3px;
  min-inline-size: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  background: var(--selector-track);
}
.appearance:has(input[value="light"]:checked) { --i: 1; }
.appearance:has(input[value="dark"]:checked) { --i: 2; }

.appearance__thumb {
  position: absolute;
  top: 3px; bottom: 3px; left: 3px;
  width: var(--opt);
  border-radius: var(--radius-pill);
  background: var(--selector-thumb);
  box-shadow: var(--elevation-1);
  transform: translateX(calc(var(--i) * 100%));
  transition: transform 520ms var(--ease-out-expo);
}
.appearance__thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--spectrum-brand);
  opacity: calc(0.3 + var(--line-glow) * 0.5);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}

.appearance__option {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  height: var(--opt);
  border-radius: var(--radius-pill);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color var(--dur-base) var(--ease-out-quart);
}
.appearance__option:hover { color: var(--text-primary); }
.appearance__option:has(input:checked) { color: var(--text-primary); }
.appearance__option svg { width: 16px; height: 16px; min-width: 16px; max-width: none; }
.appearance__option input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.appearance__option:has(input:focus-visible) {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Labelled variant (menu, footer, "try it") */
.appearance--labelled {
  --opt: auto;
  grid-auto-columns: 1fr;
  width: 100%;
  max-width: 380px;
}
.appearance--labelled .appearance__option {
  grid-auto-flow: column;
  gap: 8px;
  height: 46px;
  padding: 0 14px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.appearance--labelled .appearance__thumb { width: calc((100% - 6px) / 3); }

/* The stage --------------------------------------------------------------
   A product-reveal set: light from above (beam), an opening aperture behind,
   a spectral horizon the Z rises through, its mirror on a glossy floor, and
   coloured light refracted through the glass onto that floor. Only light
   around the artwork changes per appearance — never the artwork itself. */
.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1236 / 1272;
  perspective: 1500px;
}
.stage__tilt {
  position: absolute;
  inset: 0;
  will-change: transform;
}
.stage__light,
.stage__floor { position: absolute; inset: 0; pointer-events: none; }
.stage__beam {
  position: absolute;
  left: 50%;
  bottom: 30%;
  width: 170%;
  height: 150svh;
  transform: translateX(-50%);
  background: linear-gradient(to top, transparent 0%, var(--stage-beam) 18%, color-mix(in srgb, var(--stage-beam) 50%, transparent) 55%, transparent 90%);
  -webkit-mask: radial-gradient(ellipse 22% 100% at 50% 100%, #000 15%, transparent 75%);
  mask: radial-gradient(ellipse 22% 100% at 50% 100%, #000 15%, transparent 75%);
  pointer-events: none;
}
.stage__aperture {
  position: absolute;
  inset: -30%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--stage-core) 0%, color-mix(in srgb, var(--stage-core) 40%, transparent) 38%, transparent 72%);
  pointer-events: none;
}
.stage__aperture::before,
.stage__aperture::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.stage__aperture::before {
  inset: 11%;
  padding: 1px;
  background: conic-gradient(from 200deg, var(--zag-cyan-500), transparent 22%, var(--zag-blue-500) 42%, transparent 58%, var(--zag-magenta-500) 78%, var(--zag-cyan-500));
  opacity: var(--stage-ring-opacity);
}
.stage__aperture::after {
  inset: 24%;
  padding: 1px;
  background: conic-gradient(from 20deg, transparent, var(--border-strong) 30%, transparent 50%, var(--border-strong) 80%, transparent);
}
.stage__horizon {
  position: absolute;
  left: -70%;
  right: -70%;
  top: 96.9%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-1) 32%, var(--line-2) 50%, var(--line-3) 68%, transparent);
  opacity: var(--horizon-opacity);
}
.stage__horizon::after {
  content: "";
  position: absolute;
  left: 25%;
  right: 25%;
  top: -6px;
  height: 13px;
  background: inherit;
  filter: blur(8px);
  opacity: calc(0.25 + var(--line-glow) * 0.45);
}
.stage__caustic {
  position: absolute;
  left: -14%;
  right: -14%;
  top: 92%;
  height: 34%;
  background:
    radial-gradient(ellipse 26% 34% at 30% 24%, var(--caustic-a), transparent 72%),
    radial-gradient(ellipse 26% 34% at 70% 28%, var(--caustic-b), transparent 72%),
    radial-gradient(ellipse 40% 26% at 50% 18%, var(--caustic-c), transparent 72%),
    radial-gradient(ellipse 34% 10% at 50% 8%, var(--contact-shadow), transparent 75%);
  filter: blur(10px);
  pointer-events: none;
}
.stage__reflection {
  position: absolute;
  left: 0;
  right: 0;
  top: 93.8%;
  height: 100%;
  transform: scaleY(-1);
  opacity: var(--reflect-opacity);
  -webkit-mask: linear-gradient(to top, #000 0%, rgba(0, 0, 0, 0.4) 18%, transparent 42%);
  mask: linear-gradient(to top, #000 0%, rgba(0, 0, 0, 0.4) 18%, transparent 42%);
  pointer-events: none;
}
.stage__reflection img { width: 100%; height: 100%; object-fit: contain; }

:root { --z-art: url("../brand/zag-z-800.png"); }
@supports (mask-image: image-set(url("x.avif") type("image/avif"))) {
  :root { --z-art: image-set(url("../brand/zag-z-mask-320.avif") type("image/avif"), url("../brand/zag-z-800.png") type("image/png")); }
}
.z-mark { position: absolute; inset: 0; }
.z-mark__img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
/* Light around the Z.
   Kept apart from the artwork so nothing that clips or animates the artwork
   (the rising entrance uses clip-path) can ever cut the light into a box.
   Each glow is a Z-shaped mask, blurred inside a box padded well beyond the
   blur's reach (about 3.5 sigma), so its edges are already ~0 — even if a
   browser clips a composited layer to its own bounds (WebKit), nothing shows. */
.z-light {
  --glow-pad: 140px;
  position: absolute;
  inset: calc(-1 * var(--glow-pad));
  pointer-events: none;
  transition: opacity 450ms var(--ease-out-quart);
}
.z-glow {
  position: absolute;
  inset: 0;
  padding: var(--glow-pad);
  filter: blur(var(--b));
  transform: translateY(var(--y));
}
.z-glow > span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--c);
  -webkit-mask: var(--z-art) center / contain no-repeat;
  mask: var(--z-art) center / contain no-repeat;
  transition: background-color 900ms var(--ease-out-quart);
}
.z-glow--near { --b: var(--z-glow-near-blur); --y: var(--z-glow-near-y); --c: var(--z-glow-near); }
.z-glow--far { --b: var(--z-glow-far-blur); --y: var(--z-glow-far-y); --c: var(--z-glow-far); }

.z-mark__sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent calc(var(--sheen) - 14%), rgba(255, 255, 255, 0.55) var(--sheen), transparent calc(var(--sheen) + 14%));
  -webkit-mask: var(--z-art) center / contain no-repeat;
  mask: var(--z-art) center / contain no-repeat;
  mix-blend-mode: soft-light;
}
img[data-zmark] { object-fit: contain; }

/* Unzag layers: three copies of the unmodified artwork, each clipped to one
   stroke. Hidden unless the scroll scene is actively separating them; at
   rest the intact image is what you see, so it always reassembles exactly. */
.z-parts { position: absolute; inset: 0; visibility: hidden; }
.z-part {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  will-change: transform, opacity;
}
.z-part--top { clip-path: inset(0 0 69.8% 0); }
.z-part--diag {
  --feather: 0%;
  clip-path: inset(30.2% 0 30% 0);
  -webkit-mask: linear-gradient(to bottom, transparent 30.2%, #000 calc(30.2% + var(--feather)), #000 calc(70% - var(--feather)), transparent 70%);
  mask: linear-gradient(to bottom, transparent 30.2%, #000 calc(30.2% + var(--feather)), #000 calc(70% - var(--feather)), transparent 70%);
}
.z-part--bottom { clip-path: inset(70% 0 0 0); }
.stage.is-unzagging .z-mark__img,
.stage.is-unzagging .z-mark__sheen { visibility: hidden; }
.stage.is-unzagging .z-parts { visibility: visible; }
.stage.is-unzagging .z-light { opacity: 0; }

/* Arrival choreography — pure CSS, so it never depends on JavaScript.
   'backwards' fills only cover the delay; every element ends at its normal,
   visible style. */
@media (prefers-reduced-motion: no-preference) {
  .stage--hero .stage__horizon { animation: horizon-draw 1.2s var(--ease-out-expo) 0.05s backwards; }
  .stage--hero .stage__beam { animation: fade-in 2.4s ease 0.1s backwards; }
  .stage--hero .stage__aperture { animation: aperture-open 2.4s var(--ease-out-expo) 0.3s backwards; }
  .stage--hero .z-mark__img,
  .stage--hero .stage__reflection img { animation: z-rise 1.7s var(--ease-out-expo) 0.4s backwards; }
  .stage--hero .stage__caustic { animation: fade-in 1.8s ease 1.1s backwards; }
  .stage--hero .z-light { animation: fade-in 1.5s var(--ease-out-quart) 0.85s backwards; }
  .stage--hero .z-mark__sheen { animation: sheen 1.9s cubic-bezier(0.45, 0, 0.2, 1) 1.6s both; }
}
@keyframes horizon-draw { from { transform: scaleX(0); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes aperture-open { from { transform: scale(0.55); opacity: 0; } }
@keyframes z-rise {
  from { transform: translateY(58%); clip-path: inset(0 0 58% 0); opacity: 0; }
  12% { opacity: 1; }
  to { transform: none; clip-path: inset(0 0 0 0); opacity: 1; }
}
@keyframes sheen { from { --sheen: -60%; } to { --sheen: 160%; } }

/* Hero (scene 1) ---------------------------------------------------------- */
.intro { position: relative; }

.hero {
  --z: min(50svh, 31vw, 600px);
  --col-gap: clamp(16px, 2.6vw, 52px);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--z) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  column-gap: var(--col-gap);
  min-height: 100svh;
  max-width: 1680px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 92px) var(--gutter) calc(env(safe-area-inset-bottom) + 34px);
}
.stage--hero {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  z-index: 1;
  margin-top: -4svh;
}

.hero__title {
  grid-column: 1 / -1;
  grid-row: 1;
  align-self: center;
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--z) minmax(0, 1fr);
  column-gap: var(--col-gap);
  margin-top: -4svh;
  font-size: clamp(2.7rem, 5.5vw, 6.4rem);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.058em;
  pointer-events: none;
}
/* The two lines sit on the Z's own diagonal: upper-left, lower-right. */
.hero__line { display: block; will-change: transform; }
.hero__line--a { grid-column: 1; justify-self: end; text-align: right; position: relative; top: calc(var(--z) * -0.2); }
.hero__line--b { grid-column: 3; justify-self: start; position: relative; top: calc(var(--z) * 0.2); }

.hero__eyebrow {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
  justify-self: end;
  position: relative;
  top: calc(var(--z) * -0.2 - clamp(2.7rem, 5.5vw, 6.4rem) * 1.25);
  z-index: 2;
}

.hero__foot {
  grid-column: 1 / -1;
  grid-row: 2;
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 24px;
}
.hero__lede {
  justify-self: start;
  max-width: 34ch;
  color: var(--text-secondary);
  font-size: 15.5px;
  line-height: 1.6;
  text-wrap: pretty;
}
.hero__actions { justify-self: end; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }

.scroll-cue {
  display: grid;
  justify-items: center;
  gap: 12px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}
.scroll-cue > span:last-child { margin-right: -0.32em; }
.scroll-cue__line {
  position: relative;
  width: 1px;
  height: 46px;
  overflow: hidden;
  background: var(--border-subtle);
}
.scroll-cue__line::after {
  content: "";
  position: absolute;
  left: 0;
  top: -40%;
  width: 1px;
  height: 40%;
  background: linear-gradient(to bottom, transparent, var(--line-2));
  animation: cue 2.6s var(--ease-out-quart) infinite;
}
@keyframes cue { to { top: 100%; } }

/* Discover (scene 2). Static layout = default; cinematic overlay below. */
.discover {
  position: relative;
  padding: 120px 0 140px;
  text-align: center;
}
.discover__head {
  position: relative;
  z-index: 3;
  display: grid;
  justify-items: center;
  gap: 24px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.discover__head .body-lg { margin: 0 auto; }
.icon-river {
  --tile: clamp(58px, 6.4vw, 86px);
  --gap: clamp(12px, 1.4vw, 20px);
  display: grid;
  gap: var(--gap);
  margin: 0 0 64px;
  overflow: hidden;
}
.icon-row {
  display: flex;
  gap: var(--gap);
  width: max-content;
  will-change: transform;
}
.icon-row[data-row="1"] { margin-left: calc(var(--tile) * -0.5); }
.discover .sample-note { position: absolute; left: var(--gutter); bottom: 22px; }

.tile {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: var(--tile);
  height: var(--tile);
  border-radius: 23%;
  background: linear-gradient(150deg, var(--t1), var(--t2));
  box-shadow: var(--tile-shadow);
  color: rgba(255, 255, 255, 0.96);
}
.tile svg { width: 46%; height: 46%; }
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 48%);
  pointer-events: none;
}

/* Cinematic layout: pinned intro, discover overlays the hero stage */
@media (prefers-reduced-motion: no-preference) and (min-height: 600px) {
  html.motion-ok .intro { height: 100svh; overflow: hidden; }
  html.motion-ok .hero { height: 100svh; min-height: 0; }
  html.motion-ok .discover {
    /* One row under the header and one at the bottom, the same gap from each edge;
       the headline is centred in the space between header and bottom, so between the rows. */
    --hdr: 64px;
    --edge: 32px;
    position: absolute;
    inset: 0;
    display: grid;
    align-items: center;
    padding: calc(env(safe-area-inset-top) + var(--hdr)) 0 env(safe-area-inset-bottom);
    pointer-events: none;
  }
  html.motion-ok .discover__head { pointer-events: auto; }
  html.motion-ok .icon-river {
    position: absolute;
    inset: 0;
    display: block;
    margin: 0;
    --tile: clamp(52px, min(6vw, 8.5svh), 84px);
  }
  html.motion-ok .icon-row { position: absolute; left: 0; }
  html.motion-ok .icon-row[data-row="0"] { top: calc(env(safe-area-inset-top) + var(--hdr) + var(--edge)); }
  html.motion-ok .icon-row[data-row="1"] { bottom: calc(env(safe-area-inset-bottom) + var(--edge)); }
  html.motion-ok .discover__head { gap: 20px; }
  html.motion-ok .discover .sample-note { left: auto; right: var(--gutter); bottom: auto; top: calc(env(safe-area-inset-top) + var(--hdr) + var(--edge) + var(--tile) + 16px); }

  /* Initial states (GSAP animates to final). Text only — never the Z. */
  html.motion-ok .discover__head > *,
  html.motion-ok .icon-row,
  html.motion-ok .discover .sample-note { opacity: 0; }
}

/* Intro text initial states whenever motion is allowed (GSAP reveals them;
   the boot script's safety timer removes motion-ok if scripts never run). */
@media (prefers-reduced-motion: no-preference) {
  html.motion-ok [data-intro-item],
  html.motion-ok .hero .line__inner,
  html.motion-ok .site-header__bar { opacity: 0; }
}

/* Footer (scene 6) ------------------------------------------------------- */
.site-footer {
  padding: 96px var(--gutter) calc(env(safe-area-inset-bottom) + 32px);
  border-top: 1px solid var(--border-subtle);
}
.site-footer__top,
.site-footer__inner,
.site-footer__base { max-width: 1360px; margin: 0 auto; }
.site-footer__top {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: end;
  gap: 48px;
  padding-bottom: 64px;
  border-bottom: 1px solid var(--border-subtle);
}
.site-footer__statement {
  font-size: clamp(2.2rem, 5vw, 4.6rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.055em;
}
.site-footer__appearance { display: grid; gap: 14px; justify-items: start; }
.site-footer__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 48px;
  padding-top: 48px;
}
.site-footer__nav { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
/* Headings read as headings: sentence case, heavier and brighter than the uppercase links below. */
.site-footer__nav .kicker { display: block; margin-bottom: 14px; color: var(--text-primary); font-size: 15px; font-weight: 700; letter-spacing: -0.01em; text-transform: none; }
.footer-link {
  display: block;
  width: fit-content;
  padding: 6px 0;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: linear-gradient(var(--text-primary), var(--text-primary)) left 100% / 0 1px no-repeat;
  transition: color 300ms linear, background-size 600ms var(--ease-out-expo);
}
.footer-link:hover { color: var(--text-primary); background-size: 100% 1px; }
.site-footer__base {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 64px;
  padding-top: 22px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  font-size: 12px;
}
.site-footer__status { display: inline-flex; align-items: center; gap: 10px; }

/* Theme transitions ------------------------------------------------------ */
.refraction-ring {
  display: none;
  position: fixed;
  left: var(--rx, 50vw);
  top: var(--ry, 0px);
  width: calc(var(--rr, 100vmax) * 2);
  height: calc(var(--rr, 100vmax) * 2);
  margin-left: calc(var(--rr, 100vmax) * -1);
  margin-top: calc(var(--rr, 100vmax) * -1);
  z-index: 9999;
  border-radius: 50%;
  pointer-events: none;
  background: conic-gradient(from 200deg, var(--zag-cyan-500), var(--zag-blue-500), var(--zag-magenta-500), var(--zag-cyan-300), var(--zag-blue-300), var(--zag-cyan-500));
  -webkit-mask: radial-gradient(closest-side, transparent 0 95.2%, rgba(0, 0, 0, 0.35) 97.4%, #000 99%, transparent 100%);
  mask: radial-gradient(closest-side, transparent 0 95.2%, rgba(0, 0, 0, 0.35) 97.4%, #000 99%, transparent 100%);
}
html.is-refracting .refraction-ring { display: block; view-transition-name: refraction-ring; }

html[data-vt="refraction"]::view-transition-old(root),
html[data-vt="refraction"]::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
html[data-vt="refraction"]::view-transition-group(refraction-ring) { animation: none; }

html[data-vt="soft"]::view-transition-old(root),
html[data-vt="soft"]::view-transition-new(root) {
  animation-duration: 1100ms;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Prototype review tools ------------------------------------------------- */
.review {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  z-index: 60;
  display: grid;
  gap: 10px;
  justify-items: end;
  font-size: 12px;
}
.review__toggle {
  order: 2;
  padding: 7px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-glass-strong);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  cursor: pointer;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.review__body {
  width: 270px;
  padding: 14px;
  display: grid;
  gap: 8px;
  border-radius: var(--radius-md);
  background: var(--surface-glass-strong);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--elevation-3);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
.review__body[hidden] { display: none; }
.review__state { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 0 0 6px; }
.review__state dt { color: var(--text-tertiary); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; }
.review__state dd { margin: 0; font-family: var(--font-mono); font-size: 12px; }
.review__btn {
  padding: 9px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  text-align: left;
  font-size: 12.5px;
  cursor: pointer;
}
.review__btn:hover { border-color: var(--border-strong); }
.review__note { color: var(--text-tertiary); font-size: 11.5px; line-height: 1.5; }

.compare {
  width: min(92vw, 760px);
  padding: 28px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: var(--elevation-3);
}
.compare::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.compare h2 { font-size: 20px; letter-spacing: -0.02em; margin-bottom: 18px; }
.compare__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.compare figure { margin: 0; display: grid; gap: 10px; }
.compare img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); background: var(--bg-canvas); }
.compare figcaption { color: var(--text-secondary); font-size: 13px; }

/* Responsive ------------------------------------------------------------- */
@media (max-width: 1180px) {
  .primary-nav { gap: 26px; }
}
@media (max-width: 1000px) {
  .primary-nav { display: none; }
}

@media (max-width: 799px) {
  .site-header__bar { height: 64px; grid-template-columns: 1fr auto; }
  .site-header.is-scrolled .site-header__bar { height: 58px; }
  html.motion-ok .discover { --hdr: 58px; }
  .site-header__actions .appearance,
  .header-cta { display: none; }
  .menu-toggle { display: grid; }
  .site-header:has(.menu-toggle[aria-expanded="true"])::before { opacity: 0; }

  .hero {
    --z: min(64vw, 34svh, 340px);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    align-content: center;
    justify-items: center;
    row-gap: 0;
    padding-top: calc(env(safe-area-inset-top) + 84px);
    padding-bottom: calc(env(safe-area-inset-bottom) + 28px);
    text-align: center;
  }
  .stage--hero { grid-column: 1; grid-row: 1; width: var(--z); margin: 0 0 44px; }
  .hero__eyebrow { grid-column: 1; grid-row: 2; justify-self: center; top: 0; margin-bottom: 18px; }
  .hero__title {
    grid-column: 1;
    grid-row: 3;
    display: block;
    margin: 0;
    font-size: clamp(2.6rem, 12vw, 3.6rem);
  }
  .hero__line--a,
  .hero__line--b { top: 0; text-align: center; }
  .hero__line .line { display: inline-block; }
  .hero__foot { grid-column: 1; grid-row: 4; grid-template-columns: 1fr; justify-items: center; gap: 22px; margin-top: 22px; }
  .hero__lede { justify-self: center; text-align: center; font-size: 15px; }
  .hero__actions { justify-self: stretch; justify-content: center; flex-wrap: nowrap; gap: 10px; }
  .hero__actions .btn--primary { flex: 1 1 auto; }
  /* Secondary becomes a round icon button; its label stays for screen readers */
  .hero__actions .btn--ghost { flex: none; width: var(--h); padding: 0; justify-content: center; }
  .hero__actions .btn--ghost .btn__label {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
  .hero__actions .btn--ghost .btn__icon { box-shadow: none; }
  .scroll-cue { display: none; }
  .stage__beam { height: 60svh; }

  .site-footer { padding-top: 72px; }
  .site-footer__top,
  .site-footer__inner { grid-template-columns: 1fr; gap: 36px; }
  .site-footer__top { padding-bottom: 44px; }
  .site-footer__base { flex-direction: column; }
  .review { bottom: calc(env(safe-area-inset-bottom) + 12px); }
}

@media (max-width: 380px) {
  .hero__actions { flex-wrap: wrap; }
  .hero__actions .btn { flex: 1 1 100%; }
}

/* Reduced motion --------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .atmo, .scroll-cue__line::after { animation: none; }
  .appearance__thumb, .btn, .btn *, .btn::before, .btn::after, .nav-link *, .nav-link::after { transition: none; }
  .scroll-cue__line::after { display: none; }
}
