/* ---------------------------------------------------------------------------
   Mood Minute — marketing site
   Every colour, radius and proportion here is lifted from the app's own tokens
   (Sources/App/Capture/DesignTokens.swift, Sources/App/Domain/MoodLevel.swift),
   not invented. Light is a real second tuning, not an inversion. The one
   deliberate inversion in the whole system is the cool-step arc stroke.
   No webfonts, no external requests, no analytics.
--------------------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  /* Chrome — light appearance */
  --ground: #F2F2F7;
  --card: #FFFFFF;
  --separator: #E0E0E6;
  --fill: #E4E4EA;
  --ink: #000000;
  --ink-2: #5A5C60;
  --ink-3: #6C6E73;
  --tint: #0E6E86;
  --tint-soft: #E2F0F4;
  --danger: #B3261E;
  --health-red: #FF375F;

  /* The five mood steps — light appearance */
  --mood-1: #4A3E8F;
  --mood-2: #4C7FC4;
  --mood-3: #4FA9A0;
  --mood-4: #F0A93B;
  --mood-5: #F5D34E;
  /* Arc stroke. Steps 1–3 invert between appearances; 4 and 5 do not. */
  --arc-cool: #FFFFFF;
  --arc-4: #3A2A08;
  --arc-5: #4A3D06;

  --radius-card: 14px;
  --radius-button: 13px;
  --radius-pill: 999px;

  --measure: 68ch;
  --page: 1120px;
  --reading: 700px;

  --step-1: 0.8125rem;
  --step0: 1.0625rem;   /* 17px — the app's own body size, deliberately */
  --step1: 1.3125rem;
  --step2: 1.75rem;
  --step3: clamp(1.9rem, 4vw, 2.6rem);
  --step4: clamp(2.4rem, 7vw, 4.25rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #101922;
    --card: #1A242F;
    --separator: #26333F;
    --fill: #22303C;
    --ink: #EAF0F5;
    --ink-2: #A9B9C6;
    --ink-3: #8DA0AF;
    --tint: #63C5DC;
    --tint-soft: #15303C;
    --danger: #FF6B60;

    --mood-1: #8279D8;
    --mood-2: #6FA6E8;
    --mood-3: #5FC7BC;
    --mood-4: #FAC163;
    --mood-5: #F7DC66;
    --arc-cool: #0F1620;
    --arc-4: #33240A;
    --arc-5: #3B300A;
  }
}

/* The viewer's theme toggle stamps data-theme on the root and must win
   in both directions, over the media query above. */
:root[data-theme="light"] {
  --ground: #F2F2F7; --card: #FFFFFF; --separator: #E0E0E6; --fill: #E4E4EA;
  --ink: #000000; --ink-2: #5A5C60; --ink-3: #6C6E73;
  --tint: #0E6E86; --tint-soft: #E2F0F4; --danger: #B3261E;
  --mood-1: #4A3E8F; --mood-2: #4C7FC4; --mood-3: #4FA9A0; --mood-4: #F0A93B; --mood-5: #F5D34E;
  --arc-cool: #FFFFFF; --arc-4: #3A2A08; --arc-5: #4A3D06;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ground: #101922; --card: #1A242F; --separator: #26333F; --fill: #22303C;
  --ink: #EAF0F5; --ink-2: #A9B9C6; --ink-3: #8DA0AF;
  --tint: #63C5DC; --tint-soft: #15303C; --danger: #FF6B60;
  --mood-1: #8279D8; --mood-2: #6FA6E8; --mood-3: #5FC7BC; --mood-4: #FAC163; --mood-5: #F7DC66;
  --arc-cool: #0F1620; --arc-4: #33240A; --arc-5: #3B300A;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: var(--step0);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { line-height: 1.1; letter-spacing: -0.022em; font-weight: 700; margin: 0; text-wrap: balance; }
h1 { font-size: var(--step4); line-height: 1.04; letter-spacing: -0.03em; }
h2 { font-size: var(--step3); }
h3 { font-size: var(--step1); letter-spacing: -0.015em; }
p { margin: 0; text-wrap: pretty; }

a { color: var(--tint); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

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

.skip {
  position: absolute; left: 0; top: 0; padding: 0.75rem 1.25rem;
  background: var(--card); color: var(--ink); z-index: 100;
  transform: translateY(-120%);
}
.skip:focus { transform: none; }

/* ---------------------------------------------------------------- layout */

.wrap { width: min(100% - 2.5rem, var(--page)); margin-inline: auto; }
.reading { width: min(100% - 2.5rem, var(--reading)); margin-inline: auto; }

section { padding-block: clamp(3.5rem, 9vw, 7rem); }
.band { background: var(--card); border-block: 1px solid var(--separator); }

.lede { font-size: var(--step1); line-height: 1.45; color: var(--ink-2); max-width: 46ch; }
.eyebrow {
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 0.9rem;
}
.small { font-size: var(--step-1); color: var(--ink-3); line-height: 1.45; }

/* ------------------------------------------------------------------- nav */

.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--ground) 82%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.nav[data-scrolled="true"] { border-bottom-color: var(--separator); }
.nav .wrap { display: flex; align-items: center; gap: 1.25rem; height: 60px; }
.brand {
  font-weight: 700; letter-spacing: -0.02em; color: var(--ink);
  text-decoration: none; margin-right: auto; display: flex; align-items: center; gap: 0.6rem;
}
.nav a:not(.brand) { color: var(--ink-2); text-decoration: none; font-size: 0.95rem; }
.nav a:not(.brand):hover { color: var(--ink); }

.theme-toggle {
  appearance: none; border: 1px solid var(--separator); background: var(--fill);
  color: var(--ink-2); border-radius: var(--radius-pill);
  width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer;
  padding: 0; flex: none;
}
.theme-toggle:hover { color: var(--ink); }

/* ----------------------------------------------------------------- hero */

.hero { padding-block: clamp(3rem, 8vw, 6.5rem) clamp(2.5rem, 6vw, 4.5rem); }
.hero h1 { max-width: 15ch; }
.hero .lede { margin-top: 1.4rem; }
.hero-note { margin-top: 2.5rem; max-width: 62ch; }

/* The hero text is left-aligned, so the control and its labels are too —
   a centred scale under a left-aligned headline reads as two designs. */
.hero .scale { justify-content: flex-start; }
.hero .scale-readout,
.hero .scale-caption { text-align: left; }

/* ------------------------------------------------------- the mood scale */

.scale {
  display: flex; align-items: center; justify-content: center;
  gap: clamp(0.5rem, 2.2vw, 1.4rem);
  margin: clamp(2.5rem, 6vw, 4rem) 0 0;
  flex-wrap: nowrap;
}
.mark {
  --w: 64; --h: 64; --hue: var(--mood-3); --arc: var(--arc-cool);
  appearance: none; border: 0; padding: 0; cursor: pointer;
  background: var(--hue);
  border-radius: var(--radius-pill);
  width: calc(var(--w) * var(--mk, 1px));
  height: calc(var(--h) * var(--mk, 1px));
  display: grid; place-items: center;
  position: relative;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.28s ease;
  flex: none;
}
.scale { --mk: clamp(0.62px, 0.95vw, 1.15px); }
.mark svg { width: 62%; height: auto; overflow: visible; display: block; }
.mark svg path { fill: none; stroke: var(--arc); stroke-width: 2.6; stroke-linecap: round; }
.mark::after {
  /* every step carries a >=44px hit region regardless of drawn size */
  content: ""; position: absolute; inset: 50% auto auto 50%;
  width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%, -50%);
}
.mark[aria-pressed="true"] {
  transform: scale(1.06);
  box-shadow: 0 0 0 3px var(--ground), 0 0 0 5px var(--hue);
}
.mark:hover { transform: scale(1.04); }
.mark[aria-pressed="true"]:hover { transform: scale(1.06); }

@media (prefers-reduced-motion: reduce) {
  .mark, .mark:hover, .mark[aria-pressed="true"] { transition: none; transform: none; }
  .mark[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ground), 0 0 0 5px var(--hue); }
}

.mark-1 { --w: 70; --h: 42; --hue: var(--mood-1); --arc: var(--arc-cool); }
.mark-2 { --w: 62; --h: 50; --hue: var(--mood-2); --arc: var(--arc-cool); }
.mark-3 { --w: 56; --h: 56; --hue: var(--mood-3); --arc: var(--arc-cool); }
.mark-4 { --w: 50; --h: 64; --hue: var(--mood-4); --arc: var(--arc-4); }
.mark-5 { --w: 44; --h: 74; --hue: var(--mood-5); --arc: var(--arc-5); }

.scale-readout {
  text-align: center; margin-top: 1.6rem; min-height: 1.6em;
  font-size: var(--step1); font-weight: 600; letter-spacing: -0.015em;
}
.scale-caption { text-align: center; margin-top: 0.4rem; }

/* --------------------------------------------------------------- pattern */

.pattern-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1.75rem; }
.swatch {
  width: 54px; height: 54px; border-radius: var(--radius-pill);
  position: relative; overflow: hidden; flex: none;
  border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
}
.swatch::after { content: ""; position: absolute; inset: 0; }
.sw-1 { background: var(--mood-1); }
.sw-1::after { background: repeating-linear-gradient(45deg, rgba(255,255,255,.85) 0 2px, transparent 2px 7px); }
.sw-2 { background: var(--mood-2); }
.sw-2::after { background: repeating-linear-gradient(90deg, rgba(255,255,255,.85) 0 2px, transparent 2px 7px); }
.sw-3 { background: var(--mood-3); }
.sw-4 { background: var(--mood-4); }
.sw-4::after { background: radial-gradient(rgba(20,14,2,.8) 1.4px, transparent 1.5px) 0 0 / 7px 7px; }
.sw-5 { background: var(--mood-5); }
.sw-5::after { background: repeating-linear-gradient(-45deg, rgba(20,14,2,.8) 0 2px, transparent 2px 7px); }

/* ---------------------------------------------------------------- cards */

.grid { display: grid; gap: 1.25rem; margin-top: 2.5rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.card {
  background: var(--card); border: 1px solid var(--separator);
  border-radius: var(--radius-card); padding: 1.6rem;
}
.band .card { background: var(--ground); }
.card h3 { margin-bottom: 0.55rem; }
.card p { color: var(--ink-2); }

/* ------------------------------------------------------------ data flow */

.flow { display: grid; gap: 0.9rem; margin-top: 2.25rem; }
.flow-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.35fr);
  align-items: center; gap: clamp(0.6rem, 2vw, 1.25rem);
  background: var(--card); border: 1px solid var(--separator);
  border-radius: var(--radius-card); padding: 1.1rem 1.35rem;
}
.band .flow-row { background: var(--ground); }
.flow-from { font-weight: 600; }
.flow-arrow { color: var(--ink-3); font-size: 1.1rem; }
.flow-to { color: var(--ink-2); }
.flow-to b { color: var(--ink); font-weight: 600; }
@media (max-width: 620px) {
  .flow-row { grid-template-columns: 1fr; gap: 0.35rem; }
  .flow-arrow { display: none; }
}

.tag {
  display: inline-block; font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.2rem 0.55rem; border-radius: var(--radius-pill);
  background: var(--tint-soft); color: var(--tint); margin-left: 0.5rem;
  vertical-align: 0.12em;
}

/* ----------------------------------------------------------------- list */

.ticks { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: 0.7rem; }
.ticks li { display: grid; grid-template-columns: 1.4rem 1fr; gap: 0.5rem; color: var(--ink-2); }
.ticks li::before { content: "—"; color: var(--ink-3); }
.ticks li b { color: var(--ink); font-weight: 600; }

/* ---------------------------------------------------------------- price */

.price-card {
  background: var(--card); border: 1px solid var(--separator);
  border-radius: var(--radius-card); padding: clamp(1.6rem, 4vw, 2.5rem);
  margin-top: 2.5rem;
}
.band .price-card { background: var(--ground); }
.price-split { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

/* --------------------------------------------------------------- footer */

.foot { border-top: 1px solid var(--separator); padding-block: 2.5rem 3.5rem; color: var(--ink-3); }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: baseline; }
.foot a { color: var(--ink-2); text-decoration: none; }
.foot a:hover { color: var(--ink); text-decoration: underline; }
.foot .spacer { margin-left: auto; }

/* ------------------------------------------------------- document pages */

.doc { padding-block: clamp(2.5rem, 6vw, 4rem) clamp(3rem, 8vw, 5rem); }
.doc h1 { font-size: var(--step3); }
.doc-date { color: var(--ink-3); font-size: var(--step-1); margin-top: 0.75rem; }
.doc-body { margin-top: 2.5rem; line-height: 1.68; }
.doc-body h2 {
  font-size: var(--step2); margin-top: 3rem; padding-top: 2rem;
  border-top: 1px solid var(--separator);
}
.doc-body h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.doc-body h3 { margin-top: 2rem; font-size: var(--step0); }
.doc-body p { margin-top: 1.1rem; color: var(--ink-2); max-width: var(--measure); }
.doc-body .summary {
  font-size: var(--step1); line-height: 1.45; color: var(--ink);
  font-weight: 500; margin-top: 1.1rem; max-width: 44ch;
}
.doc-body ul { color: var(--ink-2); padding-left: 1.2rem; margin-top: 1.1rem; max-width: var(--measure); }
.doc-body li { margin-top: 0.5rem; }
.doc-body table {
  width: 100%; border-collapse: collapse; margin-top: 1.4rem;
  font-size: 0.95rem; color: var(--ink-2);
}
.doc-body th, .doc-body td {
  text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--separator);
  vertical-align: top;
}
.doc-body th { color: var(--ink); font-weight: 600; }
.table-scroll { overflow-x: auto; }
.doc-body code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.9em; background: var(--fill); padding: 0.12em 0.4em; border-radius: 5px;
  color: var(--ink);
}

.toc {
  background: var(--card); border: 1px solid var(--separator);
  border-radius: var(--radius-card); padding: 1.25rem 1.5rem; margin-top: 2rem;
}
.toc ol { margin: 0.75rem 0 0; padding-left: 1.2rem; columns: 2; column-gap: 2rem; }
.toc li { margin-bottom: 0.4rem; break-inside: avoid; }
.toc a { color: var(--ink-2); text-decoration: none; font-size: 0.95rem; }
.toc a:hover { color: var(--tint); text-decoration: underline; }
@media (max-width: 560px) { .toc ol { columns: 1; } }
