/* =========================================================================
   The Vial — design system
   Colour tokens arrive as --wp--preset--color--tv-* from theme.json, which
   is generated from brand/identity/tokens.json. Never hardcode a brand hex
   here; reference the presets so a token change propagates everywhere.
   Motion follows the apple-design skill: instant press feedback, springs
   only where momentum exists, translucent chrome, reduced-motion respected.
   ========================================================================= */

:root {
  --tv-bone:  var(--wp--preset--color--tv-bone);
  --tv-ink:   var(--wp--preset--color--tv-ink);
  --tv-muted: var(--wp--preset--color--tv-ink-muted);
  --tv-rule:  var(--wp--preset--color--tv-rule);
  --tv-slate: var(--wp--preset--color--tv-slate);
  --tv-ease-out: cubic-bezier(0.22, 1, 0.36, 1);       /* settle, no bounce */
  --tv-dur: 480ms;
  --tv-nav-h: 64px;
}

html { scroll-behavior: smooth; }
body {
  background: var(--tv-bone);
  color: var(--tv-ink);
  font-family: "neue-haas-grotesk-display", "Helvetica Neue", Helvetica, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  margin: 0;
}
img { max-width: 100%; height: auto; display: block; }

/* ---- type scale: tracking tightens as size grows (apple-design §15) ---- */
.tv-display {
  font-size: clamp(2.9rem, 7.2vw, 6.2rem);
  font-weight: 300;
  line-height: 1.04;
  letter-spacing: -0.022em;
  margin: 0;
  text-wrap: balance;
}
.tv-h2 {
  font-size: clamp(1.9rem, 3.6vw, 3rem);
  font-weight: 300;
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
.tv-eyebrow {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tv-muted);
  margin: 0 0 1.25rem;
}
.tv-lede {
  font-size: clamp(1.0625rem, 1.5vw, 1.25rem);
  line-height: 1.55;
  color: var(--tv-muted);
  max-width: 34em;
  margin: 1.2rem auto 0;
}
.tv-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
}

/* ---- layout ------------------------------------------------------------ */
.tv-section {
  padding: clamp(5rem, 12vh, 9rem) clamp(1.25rem, 4vw, 3rem);
  position: relative;
}
.tv-wrap { max-width: 1200px; margin: 0 auto; }
.tv-center { text-align: center; }

/* alternating grounds — rhythm comes from tonal shifts between sections */
.tv-ground-porcelain { background: var(--wp--preset--color--tv-porcelain); }
.tv-ground-ink       { background: var(--tv-ink); color: var(--tv-bone); }
.tv-ground-ink .tv-eyebrow, .tv-ground-ink .tv-lede { color: color-mix(in srgb, var(--tv-bone) 72%, transparent); }
.tv-ground-espresso  { background: var(--wp--preset--color--tv-espresso); color: var(--tv-bone); }
.tv-ground-espresso .tv-eyebrow, .tv-ground-espresso .tv-lede { color: color-mix(in srgb, var(--tv-bone) 75%, transparent); }

/* ---- glass navigation (apple-design §12) ------------------------------- */
.tv-nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  height: var(--tv-nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
  background: color-mix(in srgb, var(--tv-bone) 72%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid transparent;
  transition: border-color 300ms ease, background-color 300ms ease;
}
.tv-nav.is-scrolled { border-bottom-color: var(--tv-rule); }
.tv-nav__logo { display: flex; align-items: center; }
.tv-nav__logo img { height: 20px; width: auto; }
.tv-nav__links { display: flex; gap: clamp(1rem, 3vw, 2.25rem); align-items: center; list-style: none; margin: 0; padding: 0; }
.tv-nav__links a {
  color: var(--tv-ink); text-decoration: none;
  font-size: 0.9375rem; font-weight: 500; letter-spacing: 0.01em;
  padding: 0.5rem 0.125rem;
  transition: opacity 150ms ease;
}
.tv-nav__links a:hover { opacity: 0.6; }
.tv-nav__links a:active { opacity: 0.4; }
.tv-nav__cta {
  background: var(--tv-ink); color: var(--tv-bone) !important;
  border-radius: 999px; padding: 0.55rem 1.15rem !important;
}
.tv-nav__cta:hover { opacity: 0.85 !important; }

/* ---- buttons: respond on press, instantly (apple-design §1) ------------ */
.tv-btn {
  display: inline-block;
  background: var(--wp--preset--color--tv-espresso);
  color: var(--tv-bone);
  border-radius: 999px;
  padding: 1rem 2rem;
  font-size: 1.0625rem; font-weight: 500;
  text-decoration: none;
  transition: transform 100ms ease-out, background-color 200ms ease;
  will-change: transform;
}
.tv-btn:hover { background: var(--wp--preset--color--tv-umber); }
.tv-btn:active { transform: scale(0.97); transition-duration: 50ms; }
.tv-btn--ghost {
  background: transparent; color: inherit;
  box-shadow: inset 0 0 0 1px currentColor;
}
.tv-btn--ghost:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
.tv-btn--bone { background: var(--tv-bone); color: var(--tv-ink); }
.tv-btn--bone:hover { background: var(--wp--preset--color--tv-porcelain); }

/* ---- hero -------------------------------------------------------------- */
.tv-hero {
  min-height: 100svh;
  display: grid; place-items: center;
  text-align: center;
  padding: calc(var(--tv-nav-h) + 2rem) 1.5rem 2rem;
  background: #FAF8F2;
  overflow: hidden;
}
.tv-hero__stack { max-width: 900px; }
.tv-hero__vial {
  /* background-free cutout: no mask, no feather, no box — just the bottle */
  width: min(250px, 42vw);
  margin: 1.4rem auto 0;
  will-change: transform;
}
.tv-hero__actions { margin-top: 2rem; display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.tv-hero__hint {
  margin-top: 3rem; color: var(--tv-muted);
  font-size: 0.875rem; letter-spacing: 0.04em;
}

/* ---- proof band: slate is the ONLY cool tone — verification lives here -- */
.tv-proof__grid {
  display: grid; gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  background: var(--tv-rule);
  border-block: 1px solid var(--tv-rule);
}
.tv-proof__cell {
  background: var(--tv-bone);
  padding: 2.5rem 2rem;
  text-align: center;
}
.tv-proof__num {
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  font-weight: 300; letter-spacing: -0.015em;
  color: var(--tv-slate);
  font-variant-numeric: tabular-nums;
}
.tv-proof__label { margin-top: 0.4rem; color: var(--tv-muted); font-size: 0.9375rem; }
.tv-proof__cite { margin-top: 2rem; }
.tv-proof__cite a { color: var(--tv-slate); }

/* ---- families: the palette does the navigating ------------------------- */
.tv-families__grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-top: 3rem;
}
.tv-family {
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tv-ink) 10%, transparent);
  aspect-ratio: 3 / 4;
  padding: 1.25rem;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start;
  text-decoration: none;
  transition: transform var(--tv-dur) var(--tv-ease-out);
  will-change: transform;
}
.tv-family:hover { transform: translateY(-6px); }
.tv-family:active { transform: translateY(-2px) scale(0.99); transition-duration: 80ms; }
.tv-family__name { font-size: 1.0625rem; font-weight: 500; line-height: 1.25; }
.tv-family__count { font-size: 0.8125rem; opacity: 0.7; margin-top: 0.2rem; }
/* per-family grounds + correct text colour (contrast table, categories.md) */
.tv-family--porcelain { background: var(--wp--preset--color--tv-porcelain); color: var(--tv-ink); }
.tv-family--ivory     { background: var(--wp--preset--color--tv-ivory);     color: var(--tv-ink); }
.tv-family--sand      { background: var(--wp--preset--color--tv-sand);      color: var(--tv-ink); }
.tv-family--tan       { background: var(--wp--preset--color--tv-tan);       color: var(--tv-ink); }
.tv-family--amber     { background: var(--wp--preset--color--tv-amber);     color: var(--tv-ink); }
.tv-family--umber     { background: var(--wp--preset--color--tv-umber);     color: var(--tv-bone); }
.tv-family--espresso  { background: var(--wp--preset--color--tv-espresso);  color: var(--tv-bone); }

/* ---- product cards ------------------------------------------------------ */
.tv-products__grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  margin-top: 3rem;
}
.tv-card {
  background: #fff;
  border: 1px solid var(--tv-rule);
  border-radius: 18px;
  overflow: hidden;
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column;
  transition: transform var(--tv-dur) var(--tv-ease-out), border-color 200ms ease;
  will-change: transform;
}
.tv-card:hover { transform: translateY(-6px); border-color: color-mix(in srgb, var(--tv-ink) 18%, transparent); }
.tv-card:active { transform: translateY(-2px) scale(0.995); transition-duration: 80ms; }
.tv-card__media { position: relative; background: #F0EAE7; aspect-ratio: 1; }
.tv-card__media img { width: 100%; height: 100%; object-fit: cover; }
.tv-card__purity {
  position: absolute; top: 12px; left: 12px;
  background: color-mix(in srgb, var(--tv-bone) 82%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  backdrop-filter: blur(12px) saturate(160%);
  color: var(--tv-slate);
  border: 1px solid color-mix(in srgb, var(--tv-slate) 30%, transparent);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem; font-weight: 500;
}
.tv-card__body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; gap: 0.3rem; flex: 1; }
.tv-card__name { font-size: 1.0625rem; font-weight: 500; letter-spacing: 0.005em; }
.tv-card__price { color: var(--tv-muted); font-size: 0.9375rem; }
.tv-card__price del { opacity: 0.55; margin-right: 0.4em; }
.tv-card__coa {
  margin-top: auto; padding-top: 0.7rem;
  color: var(--tv-slate); font-size: 0.8125rem; font-weight: 500;
  letter-spacing: 0.03em;
}
.tv-products__all { margin-top: 3rem; }

/* ---- value band --------------------------------------------------------- */
.tv-value .tv-wrap { max-width: 880px; }
.tv-value__points {
  display: grid; gap: 2.5rem 3rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 4rem; text-align: left;
}
.tv-value__point h3 { font-size: 1.0625rem; font-weight: 500; margin: 0 0 0.45rem; }
.tv-value__point p { margin: 0; font-size: 0.9375rem; line-height: 1.55; color: color-mix(in srgb, var(--tv-bone) 70%, transparent); }

/* ---- COA teaser --------------------------------------------------------- */
.tv-coa { text-align: center; }
.tv-coa__panel {
  max-width: 720px; margin: 3rem auto 0;
  background: color-mix(in srgb, var(--tv-bone) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--tv-bone) 14%, transparent);
  border-radius: 20px;
  padding: 2.5rem 2rem;
}
.tv-coa__row {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.85rem 0.25rem;
  border-bottom: 1px solid color-mix(in srgb, var(--tv-bone) 10%, transparent);
  font-size: 0.9375rem;
}
.tv-coa__row:last-child { border-bottom: 0; }
.tv-coa__row dt { color: color-mix(in srgb, var(--tv-bone) 60%, transparent); }
.tv-coa__row dd { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.875rem; color: #8FB0BD; }

/* ---- footer ------------------------------------------------------------- */
.tv-footer { background: var(--tv-ink); color: var(--tv-bone); padding: 4rem clamp(1.25rem,4vw,3rem) 3rem; }
.tv-footer__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 2rem; flex-wrap: wrap; max-width: 1200px; margin: 0 auto; }
.tv-footer__logo img { height: 18px; width: auto; }
.tv-footer__nav { display: flex; gap: 2rem; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.tv-footer__nav a { color: var(--tv-bone); opacity: 0.75; text-decoration: none; font-size: 0.9375rem; }
.tv-footer__nav a:hover { opacity: 1; }
.tv-footer__disclaimer {
  max-width: 1200px; margin: 3rem auto 0; padding-top: 2rem;
  border-top: 1px solid color-mix(in srgb, var(--tv-bone) 12%, transparent);
  font-size: 0.8125rem; line-height: 1.6;
  color: color-mix(in srgb, var(--tv-bone) 55%, transparent);
}
.tv-footer__disclaimer strong { color: color-mix(in srgb, var(--tv-bone) 80%, transparent); }
.tv-footer__meta { max-width: 1200px; margin: 2rem auto 0; font-size: 0.8125rem; color: color-mix(in srgb, var(--tv-bone) 45%, transparent); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }

/* ---- scroll reveal ------------------------------------------------------ */
/* Visible by default. JS applies .tv-out only to elements it has measured
   as below the fold, then removes it as they scroll in — so broken JS or a
   broken viewport can never hide content. */
.tv-reveal { transition: opacity 600ms ease, transform 700ms var(--tv-ease-out); }
.tv-out { opacity: 0; transform: translateY(26px); }
.tv-reveal[data-delay="1"] { transition-delay: 90ms; }
.tv-reveal[data-delay="2"] { transition-delay: 180ms; }
.tv-reveal[data-delay="3"] { transition-delay: 270ms; }

/* ---- reduced motion / transparency (apple-design §14) ------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tv-reveal, .tv-out { opacity: 1; transform: none; transition: none; }
  .tv-hero__vial { transform: none !important; }
  .tv-family, .tv-card, .tv-btn { transition: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .tv-nav { background: var(--tv-bone); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .tv-card__purity { background: var(--tv-bone); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* ---- small screens ------------------------------------------------------ */
@media (max-width: 640px) {
  .tv-nav__links li.tv-nav__hide-sm { display: none; }
  .tv-families__grid { grid-template-columns: repeat(2, 1fr); }
  .tv-family { aspect-ratio: 4 / 3; }
}
@media (max-width: 640px) {
  .tv-value__points { grid-template-columns: 1fr; }
}

/* =========================================================================
   MOTION TIERS — all ship dark behind ?tv_motion=N
   ========================================================================= */
.tv-hero__media { position: relative; width: min(250px, 42vw); margin: 1.4rem auto 0; }
.tv-hero__media .tv-hero__vial { width: 100%; margin: 0; }

/* --- Tier 1: the loop, clipped to the bottle's own silhouette ------------
   The camera is locked, so the silhouette is identical in every frame — one
   static mask removes the entire background from a format that has no alpha. */
.tv-hero__media--masked { aspect-ratio: 1; }
.tv-hero__video {
  width: 100%; height: 100%; object-fit: cover; display: block;
  -webkit-mask-image: url("/wp-content/uploads/tv-seq/silhouette.png");
  mask-image: url("/wp-content/uploads/tv-seq/silhouette.png");
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
.tv-hero__pause {
  position: absolute; top: 4px; right: -10px;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid color-mix(in srgb, var(--tv-ink) 12%, transparent);
  background: color-mix(in srgb, var(--tv-bone) 70%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  backdrop-filter: blur(12px) saturate(160%);
  color: var(--tv-ink); cursor: pointer; transition: transform 100ms ease-out;
}
.tv-hero__pause:active { transform: scale(0.94); }
.tv-hero__pause[aria-pressed="true"] svg { display: none; }
.tv-hero__pause[aria-pressed="true"]::after {
  content: ""; width: 0; height: 0; margin-left: 3px;
  border: 6px solid transparent; border-left: 10px solid currentColor;
}

/* --- Tier 2: 36 transparent frames scrubbed by scroll position ----------- */
.tv-hero__media--scrub { width: min(230px, 40vw); }
.tv-hero__media--scrub img { width: 100%; height: auto; }

/* --- Tier 3: ambient plate behind a section ----------------------------- */
.tv-value { overflow: hidden; }
.tv-plate {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0.30;
  mix-blend-mode: soft-light;
  filter: blur(7px) saturate(0.7);
  pointer-events: none;
  z-index: 0;
}
.tv-value .tv-wrap { position: relative; z-index: 1; }

@media (prefers-reduced-motion: reduce) {
  .tv-plate { display: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .tv-hero__pause { background: var(--tv-bone); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .tv-plate { display: none; }
}
