/* Sage web — token mirror of packages/ui/src/theme.ts.
 * Every hex here MUST exist in theme.ts verbatim; the invariant lint
 * (no-raw-hex, WEB_TOKEN_MIRROR rule) fails the build on any drift.
 * rgba() values are the same tokens expressed decimally (58,56,53 = textBody;
 * 168,196,172 = the mist tint from bgSageBubble) — theme.ts first, then here.
 *
 * Fonts are SELF-HOSTED (apps/web/public/fonts, from @fontsource, OFL) —
 * no visitor data leaks to a font CDN. Same faces as the app:
 * Source Serif 4 display, Inter everything else. */

@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  --bg-primary: #FAF8F5;
  --bg-card: #FFFFFF;
  --bg-surface: #F0EBE3;
  --border-subtle: #E0D9D0;
  --text-body: #3A3835;
  --text-secondary: #9A9590;
  --brand: #5C7A62;
  --accent-cta: #C4893A;
  --accent-danger: #C45A3A;
  --mist: rgba(168, 196, 172, 0.18);
  --ink-soft: rgba(58, 56, 53, 0.72); /* textBody at 72% — AA-safe muted */
  --shadow-card: 0 2px 8px rgba(58, 56, 53, 0.05); /* whisper shadow */
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg-primary);
  color: var(--text-body);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
}

a {
  color: var(--brand);
}

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

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* ── Header ─────────────────────────────────────────────────────────── */
header.site {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 24px;
}

.wordmark {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
}

nav.site {
  display: flex;
  align-items: center;
  gap: 16px;
}

nav.site a {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-body);
  text-decoration: none;
  padding: 8px 4px;
}

nav.site a:hover {
  color: var(--brand);
}

/* Phone width: the wordmark and the one action that matters. The text links
 * are section anchors the scroll passes anyway. */
@media (max-width: 719px) {
  nav.site a:not(.btn) {
    display: none;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 14px 26px;
  border-radius: 12px;
  background: var(--accent-cta);
  color: var(--bg-card);
  font-family: var(--sans);
  font-size: 19px; /* ≥19px semibold keeps white-on-amber AA (large text) */
  font-weight: 600;
  text-decoration: none;
  border: 0;
}

.btn:hover {
  filter: brightness(0.92);
}

nav.site .btn {
  min-height: 48px;
  padding: 10px 20px;
}

/* ── Hero ───────────────────────────────────────────────────────────── */
.hero {
  display: grid;
  gap: 48px;
  align-items: center;
  padding-top: clamp(32px, 7vw, 88px);
  padding-bottom: clamp(48px, 7vw, 96px);
}

.kicker {
  font-family: var(--serif);
  font-size: 19px;
  color: var(--brand);
  letter-spacing: 0.01em;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: clamp(38px, 6vw, 60px);
}

.hero .lede {
  font-size: clamp(19px, 2.2vw, 22px);
  line-height: 1.55;
  margin-top: 20px;
  max-width: 34em;
}

.store-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

/* Store badges. Pre-launch state: not links yet. When the store URLs exist,
 * swap each <span class="store"> for an <a class="store" href="…"> — the
 * styling is identical. */
.store {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 22px 10px 16px;
  border-radius: 12px;
  background: var(--text-body);
  color: var(--bg-primary);
  text-decoration: none;
}

.store svg {
  width: 28px;
  height: 28px;
  flex: none;
}

.store small {
  display: block;
  font-size: 13px;
  font-weight: 500;
  opacity: 0.85;
}

.store strong {
  display: block;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.2;
}

.beta-note {
  margin-top: 16px;
  font-size: 16px;
  color: var(--ink-soft);
}

/* ── Phone mock (a faithful miniature of the real dashboard) ────────── */
.phone {
  width: min(320px, 86vw);
  margin: 0 auto;
  border: 1px solid var(--border-subtle);
  border-radius: 40px;
  background: var(--bg-primary);
  box-shadow: 0 24px 60px rgba(58, 56, 53, 0.14);
  padding: 22px 16px 26px;
}

.phone .greet {
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.2;
  padding: 6px 6px 14px;
}

.phone .greet b {
  font-weight: 600;
  color: var(--brand);
}

.ptile {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  padding: 12px;
}

.ptile.ask {
  background: var(--mist);
  box-shadow: none;
  padding: 14px 12px;
  margin-bottom: 12px;
}

.ptile.ask .t {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
}

.ptile.ask .faux {
  margin-top: 10px;
  background: var(--bg-card);
  border-radius: 24px;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--ink-soft);
}

.pgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ptile svg {
  width: 22px;
  height: 22px;
  color: var(--brand);
  display: block;
}

.ptile .l {
  margin-top: 16px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.25;
}

.pfam {
  margin-top: 12px;
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  padding: 12px 14px;
  font-size: 13.5px;
  font-weight: 600;
}

.pfam small {
  display: block;
  font-weight: 400;
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
}

/* ── Sections ───────────────────────────────────────────────────────── */
section {
  padding-top: clamp(48px, 7vw, 88px);
  padding-bottom: clamp(48px, 7vw, 88px);
}

section.alt {
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.section-head {
  max-width: 620px;
  margin-bottom: clamp(28px, 4vw, 48px);
}

.section-head h2 {
  font-size: clamp(30px, 4vw, 42px);
}

.section-head p {
  margin-top: 14px;
  font-size: 19px;
  color: var(--ink-soft);
}

/* Module cards */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.tile {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  padding: 24px;
}

section.alt .tile {
  box-shadow: none;
  border: 1px solid var(--border-subtle);
}

.tile svg {
  width: 32px;
  height: 32px;
  color: var(--brand);
  display: block;
}

.tile h3 {
  font-size: 21px;
  margin-top: 18px;
}

.tile p {
  margin-top: 8px;
  font-size: 16.5px;
  color: var(--ink-soft);
}

.tile.wide {
  grid-column: 1 / -1;
  background: var(--mist);
  box-shadow: none;
}

/* Verdict explainer */
.verdicts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.verdict {
  border-radius: 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  padding: 24px;
}

.verdict .mark {
  font-size: 28px;
  line-height: 1;
}

.verdict h3 {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 600;
  margin-top: 12px;
}

.verdict p {
  margin-top: 8px;
  font-size: 16.5px;
  color: var(--ink-soft);
}

.verdict.danger {
  border-color: var(--accent-danger);
}

/* Two-audience columns */
.split {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.pane {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  padding: clamp(24px, 3.5vw, 40px);
}

.pane .who {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand);
}

.pane h2 {
  font-size: clamp(26px, 3vw, 32px);
  margin-top: 10px;
}

.pane ul {
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.pane li {
  padding-left: 30px;
  position: relative;
  margin-top: 14px;
  font-size: 17.5px;
}

.pane li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--mist);
  border: 2px solid var(--brand);
}

/* Quiet principles strip */
.principles {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.principle h3 {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 600;
}

.principle p {
  margin-top: 8px;
  font-size: 16.5px;
  color: var(--ink-soft);
}

/* Final CTA */
.cta-final {
  text-align: center;
}

.cta-final h2 {
  font-size: clamp(30px, 4.5vw, 46px);
}

.cta-final .kicker {
  margin-bottom: 12px;
}

.cta-final .store-row {
  justify-content: center;
}

/* ── Footer & legal pages ───────────────────────────────────────────── */
footer.site {
  border-top: 1px solid var(--border-subtle);
  padding: 40px 0 56px;
  font-size: 15px;
  color: var(--ink-soft);
}

footer.site .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  align-items: baseline;
  justify-content: space-between;
}

footer.site a {
  color: var(--ink-soft);
}

main.legal {
  max-width: 680px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}

main.legal h1 {
  font-size: 34px;
  margin: 0 0 8px;
}

main.legal h2 {
  font-size: 24px;
  margin: 40px 0 8px;
}

main.legal p,
main.legal li {
  margin: 0 0 16px;
}

.muted {
  color: var(--ink-soft);
  font-size: 15px;
}

/* ── Motion & layout at width ───────────────────────────────────────── */
@media (min-width: 900px) {
  .hero {
    grid-template-columns: 1.15fr 0.85fr;
  }
}

.rise {
  animation: rise 0.6s ease-out both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .rise {
    animation: none;
  }
}
