/* Layout: a sticky 3D story on black (capsule, mountain of pills, stress marks), a white package
   leaflet, the pink prescription with the question (rx.css), a light "store" planner and a black
   finale with the pharmacy receipt (flow.css). One deliberate dark-first look, no theme switching. */
:root {
  color-scheme: dark;

  --night: #000000;      /* cinematic ground */
  --ink: #f5f5f7;        /* text on night */
  --mist: #86868b;       /* secondary text on night */
  --sheet: #fbfbfd;      /* package leaflet paper */
  --paper: #f5f5f7;      /* planner and prescription ground */
  --graphite: #1d1d1f;   /* text on light */
  --stone: #6e6e73;      /* secondary text on light */
  --rose: #e8577d;       /* capsule cap, accents */
  --rose-ink: #c63a61;   /* primary buttons: white text stays above 4.5:1 */
  --rose-ink-hover: #b02f55;
  --rose-deep: #a72d55;
  --pearl: #f3eee8;      /* capsule body */
  --gold: #e7c27d;       /* focus ring */
  --white: #ffffff;
  --line-dark: rgba(255, 255, 255, 0.14);
  --line-light: rgba(0, 0, 0, 0.1);
  --tile-line: #d2d2d7;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
  --font-serif: ui-serif, "New York", "Cormorant Garamond", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  --nav-h: 52px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --glow-text: linear-gradient(100deg, var(--pearl) 8%, #f7aac0 42%, var(--rose) 70%, #f0b48c 100%);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html.is-locked,
html.is-locked body { overflow: hidden; }

body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg, canvas { max-width: 100%; }

h1, h2, h3, p, dl, dd, ol { margin: 0; }

h1, h2, h3 { text-wrap: balance; font-weight: 700; }

p { text-wrap: pretty; }

button { font: inherit; color: inherit; }

[hidden] { display: none !important; }

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.js:not(.i18n-ready) [data-i18n] { visibility: hidden; }

::selection { background: rgba(232, 87, 125, 0.35); }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 12px;
}

section[id] { scroll-margin-top: var(--nav-h); }

.wrap {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
}

/* ---------- Buttons ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 22px;
  border: 0;
  border-radius: 980px;
  font: 600 17px/1.2 var(--font-sans);
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 160ms var(--ease-out), background-color 200ms ease, color 200ms ease, opacity 200ms ease;
}

.pill:active { transform: scale(0.96); }

.pill--primary { background: var(--rose-ink); color: var(--white); }
.pill--ghost { background: rgba(255, 255, 255, 0.12); color: var(--ink); }
.pill--quiet { background: rgba(0, 0, 0, 0.06); color: var(--graphite); }
.pill--small { min-height: 32px; padding: 6px 14px; font-size: 14px; }
.pill--big { min-height: 56px; padding: 14px 34px; font-size: 19px; }
.pill:disabled { opacity: 0.4; cursor: default; }

@media (hover: hover) and (pointer: fine) {
  .pill--primary:hover { background: var(--rose-ink-hover); }
  .pill--ghost:hover { background: rgba(255, 255, 255, 0.18); }
  .pill--quiet:hover { background: rgba(0, 0, 0, 0.1); }
}

.link {
  background: none;
  border: 0;
  padding: 10px 4px;
  color: var(--rose);
  font: 500 17px/1.3 var(--font-sans);
  text-decoration: none;
  cursor: pointer;
}

.link--quiet { color: var(--mist); }

@media (hover: hover) and (pointer: fine) {
  .link:hover { text-decoration: underline; text-underline-offset: 3px; }
}

/* ---------- Gate: slide to open ---------- */

.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top, 0px)) var(--gutter-r) max(40px, env(safe-area-inset-bottom, 0px)) var(--gutter-l);
  background: var(--night);
  touch-action: none;
  transition: opacity 520ms var(--ease-out), transform 800ms var(--ease-out), visibility 0s linear 800ms;
}

.no-js .gate { display: none; }

.gate.is-open {
  opacity: 0;
  transform: scale(1.06);
  visibility: hidden;
  pointer-events: none;
}

.gate__inner {
  display: grid;
  justify-items: center;
  gap: clamp(40px, 9vh, 72px);
  width: min(100%, 340px);
}

.gate__for {
  font: italic 500 clamp(40px, 11vw, 60px)/1.05 var(--font-serif);
  letter-spacing: -0.01em;
  color: var(--ink);
}

.mini-capsule {
  position: relative;
  width: 132px;
  height: 46px;
  transform: rotate(-24deg);
  animation: float 4.5s ease-in-out infinite;
}

.mini-capsule__body,
.mini-capsule__cap,
.big-capsule__body,
.big-capsule__cap {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 999px;
  transition: transform 700ms var(--ease-out);
}

.mini-capsule__body,
.big-capsule__body {
  left: 0;
  background: radial-gradient(120% 140% at 30% 20%, #fffdfb 0%, var(--pearl) 45%, #cfc6bd 100%);
}

.mini-capsule__cap,
.big-capsule__cap {
  right: 0;
  background: radial-gradient(120% 140% at 30% 20%, #ff9db5 0%, var(--rose) 45%, var(--rose-deep) 100%);
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.3);
}

.mini-capsule__body { width: 78px; }
.mini-capsule__cap { width: 70px; }
.gate.is-open .mini-capsule__cap { transform: translateX(26px); }
.gate.is-open .mini-capsule__body { transform: translateX(-14px); }

@keyframes float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -6px; }
}

.slider {
  position: relative;
  width: 100%;
  height: 64px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line-dark);
  overflow: hidden;
}

.slider__text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding-left: 52px;
  font: 500 18px/1 var(--font-sans);
  letter-spacing: 0;
  color: transparent;
  background: linear-gradient(90deg, rgba(245, 245, 247, 0.38) 0%, rgba(245, 245, 247, 0.38) 40%, #ffffff 50%, rgba(245, 245, 247, 0.38) 60%, rgba(245, 245, 247, 0.38) 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: shimmer 2.8s linear infinite;
  pointer-events: none;
}

@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: 0% 0; }
}

.slider__knob {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--night);
  cursor: grab;
  touch-action: none;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
  transition: transform 450ms var(--ease-drawer);
}

.slider__knob.is-dragging { transition: none; cursor: grabbing; }

/* ---------- Navigation ---------- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(22, 22, 23, 0.86);
  border-bottom: 1px solid var(--line-dark);
  color: var(--ink);
  transform: translateY(-100%);
  transition: transform 600ms var(--ease-out), background-color 300ms ease, color 300ms ease, border-color 300ms ease;
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .nav {
    background: rgba(22, 22, 23, 0.72);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
  }
  .nav.is-light { background: rgba(250, 250, 252, 0.8); }
}

.nav.is-visible,
.no-js .nav { transform: none; }

.nav.is-light {
  background: rgba(250, 250, 252, 0.92);
  color: var(--graphite);
  border-bottom-color: var(--line-light);
}

.nav__inner {
  height: var(--nav-h);
  max-width: 1024px;
  margin: 0 auto;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.nav__brand .glyph { color: var(--rose); flex: none; }

/* ---------- Story ----------
   Default (no JS, reduced motion): hero, capsule, captions and counters one after another.
   .scrolly (set by the app): a tall section with a sticky full-screen stage. */

.story { position: relative; background: var(--night); }

.story__stage {
  position: relative;
  display: flex;
  flex-direction: column;
  padding-top: calc(env(safe-area-inset-top, 0px) + var(--nav-h) + clamp(28px, 6vh, 64px));
  padding-bottom: 72px;
}

.story__hero {
  order: 1;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
  text-align: center;
  z-index: 2;
}

.story__visual {
  order: 2;
  position: relative;
  height: 52vh;
  height: 52svh;
  min-height: 260px;
}

.story__lines {
  order: 3;
  display: grid;
  gap: 32px;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
  z-index: 2;
}

.story__glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(42% 32% at 50% 52%, rgba(232, 87, 125, 0.3), rgba(232, 87, 125, 0) 70%);
  pointer-events: none;
}

.story__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.story__fallback {
  position: absolute;
  left: 50%;
  top: 52%;
  width: min(62vw, 340px);
  aspect-ratio: 3 / 1.05;
  transform: translate(-50%, -50%) rotate(-18deg);
  display: none;
}

.big-capsule__body { width: 60%; }
.big-capsule__cap { width: 53%; }

.no-webgl .story__fallback { display: block; }
.no-webgl .story__canvas { display: none; }

.hero__title {
  font-size: clamp(60px, 15vw, 132px);
  line-height: 1;
  letter-spacing: -0.04em;
}

.hero__title-in {
  display: inline-block;
  padding: 0 0.04em 0.08em;
  background: var(--glow-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__sub {
  margin: 14px auto 0;
  max-width: 30ch;
  font-size: clamp(19px, 2.4vw, 26px);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.hero__sub-in { display: inline-block; }

.story__line {
  max-width: 22ch;
  margin: 0 auto;
  text-align: center;
  font-size: clamp(26px, 4.6vw, 48px);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--mist);
}

.story__line strong { display: block; color: var(--ink); font-weight: 700; }
.story__line-in { display: inline-block; }

/* Apple-style counters: big gradient numbers, small labels. */
.story__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: min(100%, 720px);
  margin: 0 auto;
  text-align: center;
}

.stat { display: grid; gap: 4px; }

.stat__n {
  font-size: clamp(44px, 10vw, 96px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.stat:last-child .stat__n { color: var(--rose); }   /* the punchline: zero minutes of break */

.stat__l { font-size: clamp(14px, 1.8vw, 19px); font-weight: 600; color: var(--mist); }

/* Comic stress marks around the mountain; GSAP scales the outer span, CSS jitters the inner one. */
.story__stress { display: none; }

.mark {
  position: absolute;
  width: clamp(36px, 8vw, 72px);
  transform-origin: 50% 50%;
  pointer-events: none;
}

.mark > * {
  display: block;
  width: 100%;
  animation: jitter 0.42s steps(2, end) infinite;
}

.mark:nth-child(2n) > * { animation-duration: 0.36s; animation-direction: reverse; }
.mark:nth-child(3n) > * { animation-duration: 0.5s; }

@keyframes jitter {
  0% { transform: translate(0, 0) rotate(-6deg); }
  50% { transform: translate(2px, -3px) rotate(7deg); }
  100% { transform: translate(-1px, 1px) rotate(-3deg); }
}

.mark svg { overflow: visible; }
.mark--sm { width: clamp(26px, 5.5vw, 48px); }
.mark--steam { width: clamp(48px, 11vw, 88px); }
.mark--bolt path { fill: #ffd60a; stroke: #1d1d1f; stroke-width: 2.5; stroke-linejoin: round; }
.mark--bang path, .mark--bang circle { fill: #ff453a; stroke: #1d1d1f; stroke-width: 2.5; stroke-linejoin: round; }
.mark--drops path { fill: #64d2ff; stroke: #1d1d1f; stroke-width: 2.5; }
.mark--vein path { fill: none; stroke: #ff375f; stroke-width: 5; stroke-linecap: round; }
.mark--spiral path { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.mark--steam path { fill: rgba(245, 245, 247, 0.92); stroke: #1d1d1f; stroke-width: 2.5; }

.mark--grawlix { width: auto; }

.mark--grawlix > span {
  position: relative;
  padding: 6px 12px;
  border-radius: 16px;
  background: var(--white);
  color: var(--graphite);
  font: 800 clamp(16px, 3.4vw, 26px)/1 var(--font-sans);
  letter-spacing: 0.04em;
  border: 2.5px solid #1d1d1f;
  white-space: nowrap;
}

.mark--grawlix > span::after {
  content: "";
  position: absolute;
  left: 18px;
  bottom: -11px;
  width: 14px;
  height: 14px;
  background: var(--white);
  border-right: 2.5px solid #1d1d1f;
  border-bottom: 2.5px solid #1d1d1f;
  transform: rotate(45deg) skew(10deg, 10deg);
}

.story__flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 45% at 50% 64%, rgba(255, 255, 255, 0.95), rgba(255, 214, 228, 0.55) 35%, rgba(255, 255, 255, 0) 72%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  transform: translateX(-50%);
  display: none;
  justify-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--mist);
  z-index: 2;
}

.scroll-cue__line {
  position: relative;
  width: 1px;
  height: 28px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.scroll-cue__line::after {
  content: "";
  position: absolute;
  left: 0;
  top: -40%;
  width: 1px;
  height: 40%;
  background: var(--ink);
  animation: cue 1.8s var(--ease-in-out) infinite;
}

@keyframes cue {
  from { transform: translateY(0); }
  to { transform: translateY(350%); }
}

.scrolly .story { height: 560vh; height: 560svh; }

.scrolly .story__stage {
  position: sticky;
  top: 0;
  display: block;
  height: 100vh;
  height: 100svh;
  min-height: 520px;
  padding: 0;
  overflow: hidden;
}

.scrolly .story__visual {
  position: absolute;
  inset: 0;
  height: auto;
  min-height: 0;
}

.scrolly .story__stress { display: block; }

.scrolly .story__hero,
.scrolly .story__lines {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(env(safe-area-inset-top, 0px) + var(--nav-h) + clamp(28px, 6vh, 64px));
}

.scrolly .story__lines { gap: 0; }
.scrolly .story__line,
.scrolly .story__stats { grid-area: 1 / 1; }
.scrolly .scroll-cue { display: grid; }

/* ---------- Letter: words light up on scroll ---------- */

.letter {
  background: var(--night);
  padding-block: clamp(110px, 20vh, 220px);
}

.letter__text {
  max-width: 21ch;
  font-size: clamp(30px, 5.6vw, 60px);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
}

/* ---------- Leaflet ---------- */

.leaflet {
  background: var(--sheet);
  color: var(--graphite);
  padding-block: clamp(80px, 14vh, 140px);
}

.leaflet__doc {
  margin-top: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-light);
  font-size: 14px;
  color: var(--stone);
}

.section-title {
  font-size: clamp(40px, 7vw, 76px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.section-sub {
  margin-top: 16px;
  max-width: 38ch;
  font-size: clamp(19px, 2.2vw, 24px);
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--stone);
}

.specs {
  margin-top: clamp(40px, 7vh, 72px);
  border-top: 1px solid var(--line-light);
}

.spec {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  padding-block: 20px;
  border-bottom: 1px solid var(--line-light);
}

.spec dt { font-weight: 600; font-size: 17px; }

.spec dd {
  font-size: 17px;
  line-height: 1.5;
  color: var(--graphite);
  min-width: 0;
}

@media (min-width: 734px) {
  .spec { grid-template-columns: 240px minmax(0, 1fr); gap: 32px; padding-block: 24px; }
  .spec dt, .spec dd { font-size: 19px; }
}
