/* ===========================================================================
   HOME — the redesigned front-page surfaces: layered parallax hero, fact
   marquee, photographic category slices, annotated-jar editorial, kinetic
   manifesto, glowing closing CTA. Everything resolves from tokens.css +
   primitives.css; no brand literal lives here.

   Motion contract: base CSS renders every section complete and static.
   home.js (GSAP) only ADDS movement, and only when
   (prefers-reduced-motion: no-preference).
   =========================================================================== */

/* ---------------------------------------------------------------------------
   HERO — full-bleed photograph, copy left on the page axis
--------------------------------------------------------------------------- */
.ms-hero3 {
  position: relative; overflow: clip; isolation: isolate;
  display: flex; align-items: center;
  min-height: min(88dvh, 46rem);          /* dvh, never vh — vh jumps on iOS */
  background: var(--background);
}
/* layer 0: photograph. Parallax moves THIS wrapper; the img inside owns the
   object-fit, so the two never fight over `transform`. */
.ms-hero3__bg { position: absolute; inset: -8% 0; z-index: 0; }
.ms-hero3__bg picture, .ms-hero3__bg img {
  display: block; width: 100%; height: 100%; object-fit: cover; object-position: 68% 50%;
}
/* legibility scrim — canvas at the copy edge, clear over the light show */
.ms-hero3__scrim {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(100deg,
      var(--background) 0%,
      color-mix(in oklab, var(--background) 92%, transparent) 26%,
      color-mix(in oklab, var(--background) 55%, transparent) 44%,
      transparent 62%),
    linear-gradient(to top,
      color-mix(in oklab, var(--background) 55%, transparent) 0%, transparent 30%);
}
.ms-hero3__inner { position: relative; z-index: 3; width: 100%; }
.ms-hero3__copy {
  display: flex; flex-direction: column; align-items: flex-start;
  max-width: 34rem; padding-block: clamp(3.5rem, 9vh, 6rem);
}
.ms-hero3__h1 {
  margin: 1.25rem 0 0;
  font-size: clamp(2.4rem, 4.6vw, 4rem);
  line-height: 1.03; letter-spacing: -0.035em; font-weight: 600;
  color: var(--foreground); text-wrap: balance;
}
.ms-hero3__accent { color: var(--brand); }
.ms-hero3__sub { margin: 1.25rem 0 0; max-width: 30rem; color: var(--ink-2); }
.ms-hero3__cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }

/* mono chips annotating the photographed jar */
.ms-hero3__notes { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.ms-chipcard--n0 { right: max(4%, calc(50% - 30rem)); top: 26%; transform: rotate(-1.5deg); }
.ms-chipcard--n1 { right: max(6%, calc(50% - 26rem)); bottom: 24%; transform: rotate(1.25deg); }
@media (max-width: 1023px) { .ms-hero3__notes { display: none; } }

@media (max-width: 767px) {
  .ms-hero3 { min-height: auto; align-items: flex-start; }
  .ms-hero3__bg { inset: 0; }
  .ms-hero3__bg img { object-position: 50% 62%; }
  .ms-hero3__scrim {
    background: linear-gradient(to bottom,
      var(--background) 0%,
      color-mix(in oklab, var(--background) 88%, transparent) 34%,
      color-mix(in oklab, var(--background) 40%, transparent) 56%,
      transparent 78%);
  }
  .ms-hero3__copy { max-width: none; padding-block: 2.5rem 22rem; }
  .ms-hero3__cta { align-self: stretch; flex-direction: column; }
  .ms-hero3__cta .btn { width: 100%; }
}

/* chip card — shared by the hero notes and the editorial figure */
.ms-chipcard {
  position: absolute; display: flex; flex-direction: column; gap: 0.1875rem;
  padding: 0.625rem 0.875rem;
  border: 1px solid color-mix(in oklab, var(--foreground) 10%, transparent);
  border-radius: var(--radius-xl);
  background: color-mix(in oklab, var(--background) 82%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: var(--elevation-card), inset 0 1px 0 color-mix(in oklab, white 55%, transparent);
}
.ms-chipcard__k {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.625rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-3);
}
.ms-chipcard__v { font-size: 0.875rem; font-weight: 600; letter-spacing: -0.01em; color: var(--foreground); white-space: nowrap; }

.ms-proofstrip--hero {
  justify-content: flex-start; width: auto; margin: 2.25rem 0 0; padding: 1.25rem 0 0;
  border-top: 1px solid color-mix(in oklab, var(--border-strong) 60%, transparent);
}

/* ---------------------------------------------------------------------------
   MARQUEE — thin ink band, seamless -50% loop
--------------------------------------------------------------------------- */
.ms-marquee {
  overflow: hidden; background: var(--ink-band);
  border-block: 1px solid color-mix(in oklab, var(--p-neutral-0) 8%, transparent);
  padding-block: 0.875rem;
}
.ms-marquee__track { display: flex; width: max-content; animation: ms-marquee-scroll 30s linear infinite; }
.ms-marquee__seq { display: flex; align-items: center; flex-shrink: 0; }
.ms-marquee__item {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.75rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase;
  color: color-mix(in oklab, var(--p-neutral-0) 74%, transparent);
  white-space: nowrap;
}
.ms-marquee__dot {
  width: 0.25rem; height: 0.25rem; border-radius: 999px; flex-shrink: 0;
  margin-inline: 1.5rem; background: var(--brand);
}
@keyframes ms-marquee-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ms-marquee__track { animation: none; } }
@media (hover: hover) { .ms-marquee:hover .ms-marquee__track { animation-play-state: paused; } }

/* ---------------------------------------------------------------------------
   CATEGORY SLICES — photographic accordion
--------------------------------------------------------------------------- */
.ms-slices { display: flex; gap: 0.625rem; height: clamp(24rem, 40vw, 30rem); }

/* MOTION: every moving part of the accordion shares ONE duration and ONE curve
   so the expansion reads as a single gesture. It previously ran on four
   different timings (grow 560ms, image 700ms, meta 340ms+120ms delay, label
   300ms), which is what made the transition feel like it stuttered.
   The curve is a strong ease-out: the slice commits immediately on hover and
   settles slowly, which is what makes a size change feel smooth rather than
   mechanical. */
.ms-slices { --slice-dur: 780ms; --slice-ease: cubic-bezier(0.22, 1, 0.36, 1); }
.ms-slice {
  position: relative; display: block; overflow: hidden;
  flex: 1 1 0%; min-width: 0;
  border-radius: var(--radius-2xl);
  text-decoration: none; outline: none;
  transition: flex-grow var(--slice-dur) var(--slice-ease);
}
/* Growth is gated on a real pointer: on touch, :hover latches and leaves one
   slice stuck open after a tap. */
@media (hover: hover) and (pointer: fine) {
  .ms-slice:hover { flex-grow: 2.6; }
  .ms-slice:hover .ms-slice__img { transform: scale(1.04); }
}
.ms-slice:focus-visible { flex-grow: 2.6; }
.ms-slice__img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--slice-dur) var(--slice-ease);
}
@media (prefers-reduced-motion: reduce) {
  .ms-slice, .ms-slice__img, .ms-slice__meta, .ms-slice__side { transition: none; }
}
.ms-slice__scrim {
  position: absolute; inset: 0;
  background: linear-gradient(to top,
    color-mix(in oklab, var(--p-neutral-1000) 62%, transparent) 0%,
    color-mix(in oklab, var(--p-neutral-1000) 18%, transparent) 38%, transparent 62%);
}
/* collapsed state: a vertical mono label riding the bottom-left corner */
.ms-slice__side {
  position: absolute; left: 0.875rem; bottom: 1rem;
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase;
  color: color-mix(in oklab, var(--p-neutral-0) 88%, transparent);
  opacity: 1; transition: opacity calc(var(--slice-dur) * 0.4) var(--slice-ease);
}
.ms-slice__meta {
  position: absolute; left: 1.25rem; right: 1.25rem; bottom: 1.125rem;
  display: flex; flex-direction: column; gap: 0.25rem;
  opacity: 0; transform: translateY(8px);
  transition: opacity calc(var(--slice-dur) * 0.55) var(--slice-ease) calc(var(--slice-dur) * 0.22),
              transform calc(var(--slice-dur) * 0.55) var(--slice-ease) calc(var(--slice-dur) * 0.22);
}
.ms-slice:hover .ms-slice__side, .ms-slice:focus-visible .ms-slice__side { opacity: 0; }
.ms-slice:hover .ms-slice__meta, .ms-slice:focus-visible .ms-slice__meta { opacity: 1; transform: none; }
.ms-slice__chip {
  position: absolute; top: 0.875rem; left: 0.875rem; z-index: 2;
  padding: 0.1875rem 0.4375rem; border-radius: var(--radius-3);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.625rem; font-weight: 600; letter-spacing: 0.1em;
  /* Category colour lives ONLY here — never a fill, background or type colour
     elsewhere. That restraint is what stops a multi-line catalog reading as a
     paint chart, and it is the one place the design system sanctions colour. */
  background: var(--cat-fill, color-mix(in oklab, var(--p-neutral-0) 88%, transparent));
  color: var(--cat-ink, var(--p-neutral-1000));
}
.ms-slice__chip[data-cat="foundation"] { --cat-fill: #E6EDF3; --cat-ink: #1E4560; }
.ms-slice__chip[data-cat="recovery"]   { --cat-fill: #EAE8F4; --cat-ink: #332B66; }
.ms-slice__chip[data-cat="cognitive"]  { --cat-fill: #E2F0F0; --cat-ink: #0A4B4B; }
.ms-slice__chip[data-cat="metabolic"]  { --cat-fill: #EEF1E2; --cat-ink: #4A551E; }
.ms-slice__chip[data-cat="longevity"]  { --cat-fill: #F3E8EE; --cat-ink: #552940; }
.ms-slice__chip[data-cat="performance"]{ --cat-fill: #F7E9E3; --cat-ink: #7E2F14; }
.ms-slice__chip:empty { display: none; }
.ms-slice__name { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.014em; color: var(--p-neutral-0); white-space: nowrap; }
.ms-slice__row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.ms-slice__count {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: color-mix(in oklab, var(--p-neutral-0) 72%, transparent); white-space: nowrap;
}
.ms-slice__arrow { color: var(--p-neutral-0); }

@media (max-width: 899px) {
  .ms-slices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.625rem; height: auto; }
  .ms-slice { aspect-ratio: 4 / 5; }
  .ms-slice:last-child:nth-child(odd) { grid-column: span 2; aspect-ratio: 2 / 1; }
  /* touch: no hover state — show the meta, hide the vertical label */
  .ms-slice__side { display: none; }
  .ms-slice__meta { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------------------
   STANDARD — human-led editorial. The photograph does the arguing; two mono
   chips annotate the jar in her hands.
--------------------------------------------------------------------------- */
.ms-ticks { list-style: none; margin: 1.5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.ms-ticks li { display: flex; align-items: flex-start; gap: 0.625rem; font-size: 0.9375rem; line-height: 1.5; color: var(--ink-2); }
.ms-ticks__i { flex-shrink: 0; margin-top: 0.1875rem; color: var(--brand); }
.ms-standard__btn { margin-top: 2rem; }

.ms-standard__figure {
  position: relative; margin: 0;
  border-radius: var(--radius-3xl-plus); overflow: visible;
}
.ms-standard__photo {
  display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover;
  border-radius: var(--radius-3xl-plus);
  box-shadow: var(--elevation-pop);
}
@media (min-width: 1024px) { .ms-standard__photo { aspect-ratio: 3 / 4; } }
.ms-standard__notes { position: absolute; inset: 0; pointer-events: none; }
/* pinned clear of her face and of each other */
.ms-chipcard--s0 { left: -1.25rem; top: 34%; transform: rotate(-1.5deg); }
.ms-chipcard--s1 { right: -1.25rem; bottom: 16%; transform: rotate(1.5deg); }
@media (max-width: 639px) {
  .ms-chipcard--s0 { left: -0.5rem; }
  .ms-chipcard--s1 { right: -0.5rem; }
  .ms-chipcard__v { font-size: 0.8125rem; }
}

/* ---------------------------------------------------------------------------
   RITUAL — two photographs + one ink data tile, asymmetric on purpose
--------------------------------------------------------------------------- */
.ms-ritual__grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 700px)  { .ms-ritual__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .ms-ritual__grid { grid-template-columns: 1.15fr 1.15fr 0.9fr; } }

.ms-ritualcard {
  position: relative; margin: 0; overflow: hidden;
  border-radius: var(--radius-2xl); background: var(--p-stage-light-2);
  box-shadow: var(--elevation-whisper);
}
.ms-ritualcard img {
  display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover;
  transition: transform 700ms var(--ease-out-quart);
}
@media (hover: hover) and (pointer: fine) { .ms-ritualcard:hover img { transform: scale(1.04); } }
.ms-ritualcard figcaption {
  position: absolute; inset: auto 0 0 0;
  display: flex; flex-direction: column; gap: 0.375rem;
  padding: 4.5rem 1.25rem 1.25rem;
  background: linear-gradient(to top,
    color-mix(in oklab, var(--p-neutral-1000) 74%, transparent) 0%,
    color-mix(in oklab, var(--p-neutral-1000) 30%, transparent) 45%, transparent 100%);
}
.ms-ritualcard__k {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase;
  color: color-mix(in oklab, var(--p-neutral-0) 78%, transparent);
}
.ms-ritualcard__v { font-size: 0.9375rem; line-height: 1.5; color: var(--p-neutral-0); max-width: 30ch; }

/* the ink tile — the band's contrast anchor */
.ms-ritual__facts {
  display: flex; flex-direction: column; justify-content: center;
  gap: 1.5rem; padding: 2rem 1.75rem;
  border-radius: var(--radius-2xl); background: var(--surface-ink);
  box-shadow: var(--elevation-card);
}
@media (max-width: 699px) { .ms-ritual__facts { padding: 1.75rem 1.5rem; } }
.ms-ritual__facts dl { margin: 0; display: flex; flex-direction: column; gap: 1.125rem; }
.ms-ritual__facts dl > div { display: flex; align-items: baseline; gap: 0.75rem; }
.ms-ritual__facts dt {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 1.75rem; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--p-neutral-0); min-width: 2.5rem;
}
.ms-ritual__facts dd {
  margin: 0; font-size: 0.875rem; line-height: 1.4;
  color: color-mix(in oklab, var(--p-neutral-0) 70%, transparent);
}
.ms-ritual__facts .ms-btn { align-self: flex-start; }

/* ---------------------------------------------------------------------------
   MANIFESTO — kinetic type band
--------------------------------------------------------------------------- */
.ms-manifesto {
  padding-block: clamp(5rem, 12vw, 9rem);
  background: color-mix(in oklab, var(--surface-2) 42%, var(--background));
  border-block: 1px solid var(--border);
}
.ms-manifesto__text {
  box-sizing: border-box; width: 100%; max-width: 64rem;
  margin-inline: auto; padding-inline: var(--ms-gutter); margin-block: 0;
  font-size: clamp(1.75rem, 4vw, 3rem);
  line-height: 1.18; letter-spacing: -0.025em; font-weight: 600;
  color: var(--foreground); text-wrap: balance;
}
.ms-manifesto__w { display: inline-block; }

/* ---------------------------------------------------------------------------
   CTA upgrade — radial brand glow behind the copy, floating jar
--------------------------------------------------------------------------- */
.ms-cta__glow {
  position: absolute; right: -12%; top: -30%; pointer-events: none;
  width: 60%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(closest-side,
    color-mix(in oklab, var(--brand) 22%, transparent) 0%,
    color-mix(in oklab, var(--brand) 8%, transparent) 55%, transparent 100%);
}
.ms-cta__copy { position: relative; }
.ms-cta__media { position: relative; }
.ms-cta__media img { filter: drop-shadow(0 26px 36px color-mix(in oklab, var(--p-neutral-1000) 55%, transparent)); }

/* ---------------------------------------------------------------------------
   CTA — the dark band now carries its own photograph
--------------------------------------------------------------------------- */
.ms-cta--photo { overflow: hidden; }
.ms-cta__photo { position: absolute; inset: 0; z-index: 0; }
.ms-cta__photo::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(95deg,
    var(--surface-ink) 0%,
    color-mix(in oklab, var(--surface-ink) 88%, transparent) 34%,
    color-mix(in oklab, var(--surface-ink) 42%, transparent) 56%,
    transparent 78%);
}
.ms-cta__photo img { width: 100%; height: 100%; object-fit: cover; object-position: 72% 50%; display: block; }
.ms-cta--photo .ms-cta__copy { position: relative; z-index: 2; max-width: 34rem; }
.ms-cta--photo { grid-template-columns: 1fr; }
@media (min-width: 900px) { .ms-cta--photo { grid-template-columns: 1fr; min-height: 24rem; align-content: center; } }
@media (max-width: 767px) {
  .ms-cta__photo::after {
    background: linear-gradient(to bottom,
      var(--surface-ink) 0%,
      color-mix(in oklab, var(--surface-ink) 82%, transparent) 55%,
      color-mix(in oklab, var(--surface-ink) 55%, transparent) 100%);
  }
}
