/* ───────────────────────────────────────────────────────────────────────────
   Trace · tracejournal.life — shared visual system (Direction A "Tide").
   Used by index.html, beta.html, joined.html and privacy.html; each page adds
   its own styles inline. Tokens: constants/theme.ts (Tidepool) + Astra's board.
   Light only, like the app. System fonts + self-hosted Instrument Serif only.
   ─────────────────────────────────────────────────────────────────────────── */
@font-face {
  font-family: "Instrument Serif";
  src: url("/fonts/InstrumentSerif_400Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/fonts/InstrumentSerif_400Regular_Italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}

:root {
  /* Tidepool ink + brand */
  --ink: #10302C;          /* all text on the field */
  --ink-2: #3C5A55;        /* secondary text, on paper/material only */
  --ink-3: #7C9490;        /* non-text only */
  --brand: #3D9B8F;
  --brand-strong: #1D6259; /* text-bearing fills (white on it 7.1:1) */
  --brand-ink: #1E6C62;    /* teal text on light */
  /* Astra's board */
  --sage: #3E6B5F; --mist: #9CB5A7; --fog: #DCE7DF; --peach: #FDBA9B; --sand: #FFF7F1;
  /* Tester colour: the sun's peach, with a terracotta edge (≥ 3.59:1 on every light ground) */
  --peach-edge: #B4532E;
  /* Surfaces */
  --paper: #FAFAF7;
  --pale: #EEF3F0;
  --hair: rgba(16, 48, 44, 0.10);
  --hair-dash: rgba(16, 48, 44, 0.30);
  /* Live (recording) field */
  --live: #0E3F3B;
  --on-live: rgba(255, 255, 255, 0.92);
  /* Category glyphs (never text) — constants/theme.ts GlyphColors */
  --g-pain: #E5665F; --g-energy: #E39B2D; --g-mood: #3F9FE0; --g-sleep: #8A78DE;

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif;
  --rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;

  --wrap: 1120px;
  --gutter: clamp(20px, 5vw, 40px);
  --r-module: 24px;
  --r-stage: 36px;
  --spring: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --land: cubic-bezier(.3, 1.45, .55, 1); /* ≈ the app's scoreReveal spring {420, 42} */
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 17px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Type ------------------------------------------------------------------- */
.acc {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: 1.1em; letter-spacing: -0.005em; line-height: 0.9;
}
.eyebrow {
  font-size: 13px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--brand-ink); margin-bottom: 18px;
}
.h1 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(44px, 6.4vw, 88px); line-height: 1.0; letter-spacing: -0.035em;
}
.h2 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(34px, 4.6vw, 60px); line-height: 1.04; letter-spacing: -0.03em;
  text-wrap: balance;
}
.h3 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(26px, 2.6vw, 34px); line-height: 1.12; letter-spacing: -0.022em;
}
.lede { font-size: clamp(18px, 1.6vw, 21px); line-height: 1.5; letter-spacing: -0.005em; text-wrap: pretty; }
.body-l { font-size: clamp(17px, 1.35vw, 19px); line-height: 1.6; text-wrap: pretty; }
.small { font-size: 15px; line-height: 1.5; }
.muted { color: var(--ink-2); }

/* Layout ----------------------------------------------------------------- */
.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.section { position: relative; padding: clamp(88px, 11vw, 160px) 0; isolation: isolate; }
.section-head { max-width: 860px; margin: 0 auto clamp(48px, 6vw, 88px); text-align: center; }
.section-head .lede { margin-top: 22px; color: var(--ink-2); max-width: 640px; margin-left: auto; margin-right: auto; }

/* Skip link + focus ------------------------------------------------------- */
.skip {
  position: absolute; left: 16px; top: -100px; z-index: 100;
  background: var(--brand-strong); color: #fff; padding: 12px 18px; border-radius: 12px;
  font-weight: 600; text-decoration: none;
}
.skip:focus { top: 16px; }
:focus-visible { outline: 3px solid var(--brand-strong); outline-offset: 3px; border-radius: 10px; }
.on-live :focus-visible { outline-color: var(--peach); }

/* Glass nav --------------------------------------------------------------- */
.nav {
  position: fixed; z-index: 50; top: 14px; left: 50%; transform: translateX(-50%);
  width: min(1120px, calc(100% - 24px));
  display: flex; align-items: center; gap: 8px;
  padding: 7px 7px 7px 16px; border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.55), rgba(255,255,255,.30)),
    rgba(244, 249, 247, 0.42);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.95),        /* specular top edge */
    inset 0 -1px 0 rgba(16,48,44,.05),
    0 0 0 0.5px rgba(16,48,44,.10),
    0 10px 30px -8px rgba(16,48,44,.16);
}
.brand {
  display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink);
  padding: 4px 6px 4px 2px; border-radius: 999px; margin-right: auto;
}
.brand img { width: 40px; height: auto; }
.wordmark {
  font-family: var(--display); font-weight: 300; font-size: 23px; letter-spacing: 0.06em;
  margin-right: -0.06em; line-height: 1;
}
.nav-links { display: flex; gap: 2px; margin-right: 6px; }
.nav-links a {
  font-size: 14.5px; font-weight: 500; text-decoration: none; color: var(--ink);
  padding: 9px 14px; border-radius: 999px; transition: background .2s;
}
.nav-links a:hover { background: rgba(255,255,255,.6); }
.nav-links .menu-only { display: none; }
.nav .btn { --h: 40px; padding: 0 18px; font-size: 14.5px; }
.menu-btn { display: none; }

/* Buttons: two filled colours on the page, never a third.
   Teal = new here (Join the beta). Peach = testing (Tester guide). ---------- */
.btn {
  --h: 52px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 26px; border-radius: 999px; border: 0;
  font: 600 17px/1 var(--sans); letter-spacing: -0.01em; text-decoration: none; cursor: pointer;
  transition: transform .35s var(--spring), box-shadow .35s var(--spring), background .2s;
  -webkit-tap-highlight-color: transparent; white-space: nowrap;
}
.btn:active { transform: scale(.965); transition-duration: .12s; }
.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #25756B 0%, var(--brand-strong) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), inset 0 -1px 0 rgba(0,0,0,.12),
              0 8px 22px -8px rgba(29,98,89,.55);
}
.btn-primary:hover { box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 12px 28px -8px rgba(29,98,89,.6); }
.btn-peach {
  color: var(--ink); /* ink on peach 8.56:1 */
  background: linear-gradient(180deg, #FEC6AB 0%, var(--peach) 100%);
  box-shadow: inset 0 0 0 1px var(--peach-edge), inset 0 2px 0 rgba(255,255,255,.55),
              0 8px 22px -10px rgba(180,83,46,.45);
}
.btn-peach:hover { box-shadow: inset 0 0 0 1px var(--peach-edge), inset 0 2px 0 rgba(255,255,255,.55), 0 12px 26px -10px rgba(180,83,46,.5); }
.link-arrow {
  font-weight: 600; text-decoration: none; color: var(--ink);
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1.5px; background-position: 0 100%; background-repeat: no-repeat;
  transition: background-size .35s var(--ease-out); padding-bottom: 2px;
}
.link-arrow:hover { background-size: 100% 1.5px; }

/* The tide field (the app's colour field). Round 5: no loops. The hero field
   settles once on load; every other field is still. ------------------------- */
.field { position: absolute; inset: 0; overflow: hidden; z-index: -1; background: var(--fb, #DDEDE8); pointer-events: none; }
.field i {
  position: absolute; display: block; border-radius: 50%;
  background: radial-gradient(closest-side, var(--c) 0%, var(--c) 38%, transparent 100%);
  opacity: var(--o, .9);
}
.js .field.settle i { animation: settle 3.4s var(--ease-out) both; }
.js .field.settle i:nth-child(2) { --dx: -6%; --dy: -3%; animation-duration: 3.8s; }
.js .field.settle i:nth-child(3) { --dx: 5%; --dy: -4%; animation-duration: 4.2s; }
.js .field.settle i:nth-child(4) { --dx: -4%; --dy: 5%; }
@keyframes settle { from { transform: translate(var(--dx, 6%), var(--dy, 5%)) scale(1.07); } }
.field.soft { -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 200px, #000 calc(100% - 200px), transparent 100%);
              mask-image: linear-gradient(180deg, transparent 0, #000 200px, #000 calc(100% - 200px), transparent 100%); }
.field-fade::after {
  content: ""; position: absolute; z-index: -1; left: 0; right: 0; bottom: 0; height: 180px;
  background: linear-gradient(180deg, rgba(250,250,247,0), var(--paper));
}

/* Glass material ----------------------------------------------------------- */
.glass {
  background: linear-gradient(180deg, rgba(255,255,255,.74), rgba(255,255,255,.56));
  -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%);
  border-radius: var(--r-module);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.95), 0 0 0 .5px rgba(16,48,44,.10),
              0 18px 40px -20px rgba(16,48,44,.22);
}

/* Frameless screen (round 5: no bezel, no notch, no status bar) -------------
   The real screen, status bar cropped, on its own background with a soft
   shadow. True aspect ratio; --ar crops the bottom only (object-position top). */
.screen {
  --w: 300px; --ar: 600 / 1230;
  position: relative; width: var(--w); flex: none; margin: 0;
  border-radius: calc(var(--w) * .1); overflow: hidden; background: #DDEDE8;
  box-shadow: 0 0 0 .5px rgba(16,48,44,.12), 0 2px 3px rgba(16,48,44,.06),
              0 28px 56px -20px rgba(16,48,44,.32), 0 60px 110px -50px rgba(16,48,44,.30);
}
.screen img { width: 100%; height: auto; aspect-ratio: var(--ar); object-fit: cover; object-position: top center; }
.screen::after { /* specular edge */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), inset 0 0 0 .5px rgba(255,255,255,.35);
}

/* Botanicals: the app's own paths (components/trends/category-glyph.tsx), one
   per measure, always beside its name or score. Stroke in viewBox units, set
   per size so the drawn line is ~1.5–1.75 px (design system: 1.6 px at 24 px). */
.bt { fill: none; stroke-linecap: round; stroke-linejoin: round; flex: none; overflow: visible; }
.bt.pain { stroke: var(--g-pain); } .bt.energy { stroke: var(--g-energy); }
.bt.mood { stroke: var(--g-mood); } .bt.sleep { stroke: var(--g-sleep); }
.bt-15 { width: 15px; height: 15px; stroke-width: 10; }   /* 1.5 px */
.bt-20 { width: 20px; height: 20px; stroke-width: 8; }    /* 1.6 px */
.bt-48 { width: 48px; height: 48px; stroke-width: 3.65; } /* 1.75 px */

/* Reveal ------------------------------------------------------------------- */
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity 1s var(--ease-out), transform 1.1s var(--ease-out); }
.js .reveal.in { opacity: 1; transform: none; }
.js .reveal[data-d="1"] { transition-delay: .08s; }
.js .reveal[data-d="2"] { transition-delay: .16s; }
.js .reveal[data-d="3"] { transition-delay: .24s; }
.js .reveal[data-d="4"] { transition-delay: .32s; }
.js .intro { animation: intro 1s var(--ease-out) both; }
.js .intro[data-d="1"] { animation-delay: .08s; }
.js .intro[data-d="2"] { animation-delay: .16s; }
.js .intro[data-d="3"] { animation-delay: .24s; }
@keyframes intro { from { opacity: 0; transform: translateY(18px); } }

/* Score pills (as in the app: botanical + value on the goodness ramp) -------- */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 5px 5px 10px;
  border-radius: 999px; background: rgba(255,255,255,.88);
  box-shadow: 0 0 0 .5px rgba(16,48,44,.12); font-size: 14.5px; font-weight: 600;
}
.pill b {
  display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px;
  border-radius: 8px; background: var(--sw); color: var(--ink);
  font-family: var(--rounded); font-weight: 650; font-variant-numeric: tabular-nums;
}

/* Lists -------------------------------------------------------------------- */
.ticks li { position: relative; padding-left: 34px; margin-top: 14px; }
.ticks li::before {
  content: ""; position: absolute; left: 0; top: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand-strong) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center/13px no-repeat;
}
.dots li { position: relative; padding-left: 34px; margin-top: 14px; }
.dots li::before {
  content: ""; position: absolute; left: 0; top: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231D6259' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M12 11v6M12 7.2v.1'/%3E%3C/svg%3E") center/16px no-repeat;
  box-shadow: inset 0 0 0 1.5px var(--brand-strong);
}
.steps-num { counter-reset: n; }
.steps-num > li { counter-increment: n; position: relative; padding-left: 52px; }
.steps-num > li::before {
  content: counter(n); position: absolute; left: 0; top: -2px;
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font: 600 15px/1 var(--sans); font-variant-numeric: tabular-nums;
  color: var(--brand-strong); background: rgba(255,255,255,.9);
  box-shadow: inset 0 0 0 1.5px rgba(29,98,89,.35);
}

/* Live (dark) field section ---------------------------------------------- */
.on-live { color: var(--on-live); }
.on-live {
  --feather: clamp(56px, 9vw, 136px);
  background: linear-gradient(180deg, var(--paper) 0, #A9D3C9 calc(var(--feather) * .45), #2E7D72 calc(var(--feather) * .8), var(--live) var(--feather),
    var(--live) calc(100% - var(--feather)), #2E7D72 calc(100% - var(--feather) * .8), #A9D3C9 calc(100% - var(--feather) * .45), var(--paper) 100%);
}
.on-live > .field {
  --feather: clamp(56px, 9vw, 136px);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 var(--feather), #000 calc(100% - var(--feather)), transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 var(--feather), #000 calc(100% - var(--feather)), transparent 100%);
}
.on-live .eyebrow { color: var(--peach); }
.glass-dark {
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.02)), rgba(6, 34, 31, .38);
  -webkit-backdrop-filter: blur(24px) saturate(140%); backdrop-filter: blur(24px) saturate(140%);
  border-radius: var(--r-module);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 0 0 .5px rgba(255,255,255,.14), 0 24px 60px -24px rgba(0,0,0,.5);
}

/* FAQ ---------------------------------------------------------------------- */
.faq details { border-top: 1px solid var(--hair); }
.faq details:last-child { border-bottom: 1px solid var(--hair); }
.faq summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 22px 4px; font-size: 19px; font-weight: 600; letter-spacing: -0.01em; border-radius: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .chev {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(16,48,44,.06); transition: transform .45s var(--spring), background .2s;
}
.faq summary:hover .chev { background: rgba(16,48,44,.1); }
.faq details[open] .chev { transform: rotate(45deg); }
.faq details p { padding: 0 52px 24px 4px; color: var(--ink-2); font-size: 17px; line-height: 1.6; }
.faq details p strong { color: var(--ink); }

/* Safety -------------------------------------------------------------------- */
.safety {
  display: flex; gap: 18px; align-items: flex-start; padding: 26px 28px;
  border-radius: var(--r-module); background: #fff; box-shadow: 0 0 0 1px var(--hair);
  max-width: 860px; margin: 0 auto; font-size: 17px; line-height: 1.6;
}
.safety .ico { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--sand); box-shadow: inset 0 0 0 1px rgba(217,118,74,.25); }
.safety .ico svg { width: 24px; height: 24px; }

/* Footer ------------------------------------------------------------------ */
.footer { padding: 56px 0 64px; border-top: 1px solid var(--hair); background: var(--paper); }
.footer .wrap { display: grid; grid-template-columns: auto 1fr auto; gap: 24px 40px; align-items: center; }
.footer nav ul { display: flex; flex-wrap: wrap; gap: 6px 28px; justify-content: center; }
.footer nav a { display: inline-block; padding: 12px 0; text-decoration: none; font-weight: 500; font-size: 15px; }
.footer nav a:hover { text-decoration: underline; text-underline-offset: 3px; }
.footer .fine { color: var(--ink-2); font-size: 14px; text-align: right; }
.footer .brand img { width: 34px; }
.footer .wordmark { font-size: 20px; }

/* Responsive (shared) ------------------------------------------------------ */
@media (max-width: 980px) {
  .nav-links { display: none; }
  .menu-btn {
    display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 0;
    background: rgba(255,255,255,.6); color: var(--ink); cursor: pointer;
    box-shadow: inset 0 1px 0 #fff, 0 0 0 .5px rgba(16,48,44,.12);
  }
  .nav.open { border-radius: 26px; flex-wrap: wrap; }
  .nav.open .nav-links { display: flex; flex-direction: column; order: 5; width: 100%; padding: 6px 0 4px; margin: 0; }
  .nav.open .nav-links a { font-size: 17px; padding: 13px 12px; }
}
@media (max-width: 640px) {
  body { font-size: 16.5px; }
  .nav { top: 10px; padding: 6px 6px 6px 12px; }
  .brand img { width: 34px; }
  .wordmark { font-size: 20px; }
  .nav .btn { --h: 38px; padding: 0 15px; font-size: 14px; }
  .nav .btn-peach { display: none; }            /* phone: Tester guide lives in the menu + hero strip */
  .nav.open .nav-links .menu-only { display: block; }
  .footer .wrap { grid-template-columns: 1fr; text-align: left; }
  .footer nav ul { justify-content: flex-start; flex-direction: column; gap: 0; }
  .footer .fine { text-align: left; }
  .safety { flex-direction: column; padding: 22px; }
  .faq summary { font-size: 17.5px; }
  .faq details p { padding-right: 8px; }
}


/* Blocks held back until David supplies a real value (beta.html): an element
   with data-needs="…" never shows. Fill it in, then delete the attribute. */
[data-needs] { display: none !important; }

/* Without JS the menu button can't open: show the links in the nav instead. */
@media (max-width: 980px) {
  html:not(.js) .menu-btn { display: none; }
  html:not(.js) .nav { position: absolute; flex-wrap: wrap; border-radius: 26px; }
  html:not(.js) main { padding-top: 96px; } /* room for the taller, unfixed nav */
  html:not(.js) .nav-links { display: flex; flex-wrap: wrap; order: 5; width: 100%; margin: 0; }
  html:not(.js) .nav-links .menu-only { display: inline-block; }
}

/* Reduced motion / transparency (shared parts; pages add their own) -------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .field.settle i, .js .intro { animation: none !important; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .faq summary .chev, .link-arrow { transition: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .nav, .glass { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .glass-dark { background: #174a45; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
