/* Codaptable marketing site.
   The custom properties and font stack below are copied from the chat app's stylesheet
   (CODAPT/web/public/styles.css) so the site and the app match; keep the two in step.
   Palette source: CODAPT/design/tokens.json (crimson #A71930, rose red #E45A68, warm ivory
   #F7F1E8, stone gray #858585, charcoal #302E2D, soft gold #D6B77A).
   Look: no cards. Content sits on the ivory ground, organized by whitespace, type size and
   weight, with at most one thin hairline (var(--rule)) where a separation is needed. */

/* ---------- fonts and tokens: copied verbatim from the app (web/public/styles.css) ---------- */
/* Self-hosted, SIL OFL: /fonts/figtree/OFL.txt and /fonts/source-serif-4/OFL.txt */
@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('/fonts/figtree-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Figtree';
  font-style: italic;
  font-weight: 300 900;
  font-display: swap;
  src: url('/fonts/figtree-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url('/fonts/source-serif-4-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url('/fonts/source-serif-4-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ground: #F7F1E8;
  --ground-deep: #EFE6D8;
  --surface: #FFFDF9;
  --text: #302E2D;
  --muted: #625E5A;
  --stone: #858585;
  --rule: #E2D6C4;
  --rule-strong: #CDBFAA;
  --accent: #A71930;        /* crimson, text and rules */
  --accent-fill: #A71930;   /* crimson, button fills */
  --on-accent: #F7F1E8;
  --accent-wash: #F6E4E1;
  --rose: #E45A68;
  --gold: #D6B77A;
  --coperson-rule: #302E2D;
  --mediator-bubble: #F1E9DD;
  --coperson-bubble: #F3ECE1;
  --user-bubble: #FBF7F0;
  --shadow: 0 1px 2px rgba(48, 46, 45, .06), 0 4px 14px rgba(48, 46, 45, .06);
  --focus: #A71930;
  --radius: 18px;
  --sb-w: 272px;
  --sb-rail: 72px;
  --gutter: 16px;
  --font-body: 'Figtree', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-heading: 'Source Serif 4', Georgia, "Times New Roman", serif;
  --font: var(--font-body);
  --turn-gap: 36px;          /* between one speaker's turn and the next */
  --note-gap: 24px;          /* between a Coperson line and the Mediator's note under it */
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #1E1C1B; --ground-deep: #262322; --surface: #2A2725; --text: #F2ECE3;
    --muted: #B5AEA6; --stone: #8F8984; --rule: #3A3533; --rule-strong: #4B4542;
    --accent: #F08A94; --accent-fill: #A71930; --on-accent: #F7F1E8; --accent-wash: #3A2427;
    --rose: #E45A68; --coperson-rule: #B5AEA6; --mediator-bubble: #282523;
    --coperson-bubble: #2A2624; --user-bubble: #242120;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25); --focus: #F08A94;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #1E1C1B; --ground-deep: #262322; --surface: #2A2725; --text: #F2ECE3;
  --muted: #B5AEA6; --stone: #8F8984; --rule: #3A3533; --rule-strong: #4B4542;
  --accent: #F08A94; --accent-fill: #A71930; --on-accent: #F7F1E8; --accent-wash: #3A2427;
  --rose: #E45A68; --coperson-rule: #B5AEA6; --mediator-bubble: #282523;
  --coperson-bubble: #2A2624; --user-bubble: #242120;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25); --focus: #F08A94;
  color-scheme: dark;
}

/* site-only layout */
:root { --measure: 40rem; --wide: 72rem; }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 17px/1.7 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
button, input, textarea, select { font: inherit; color: inherit; }
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--font-heading); font-weight: 600; line-height: 1.22; margin: 0 0 .6em; letter-spacing: -.005em; }
h1 { font-size: clamp(2rem, 6vw, 3.1rem); letter-spacing: -.015em; }
h2 { font-size: clamp(1.35rem, 3.2vw, 1.75rem); }
h3 { font-size: 1.14rem; }
p { margin: 0 0 1.1em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.sr-only, .visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--surface);
  padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow);
}
.skip-link:focus { top: 8px; }
main { display: block; }
main:focus { outline: none; }

.wrap { width: 100%; max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter); }

/* Inner pages share one left edge with the header logo. Text keeps a reading measure;
   tables and lists that need room may use the full content width from the same edge. */
.page :is(h1, h2, h3, p, ul, ol, dl, .thread-note, .form, .lede) { max-width: var(--measure); }
.page .full { max-width: none; }

/* Labels: wide-tracked uppercase, as in the app */
.label {
  font-size: .76rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 .9rem;
}

/* A note marked by the rose thread on its left, like the app's Mediator analysis. No box. */
.thread-note { border-left: 2px solid var(--rose); padding: 2px 0 2px 16px; margin: 1.6rem 0; }
.thread-note p:last-child { margin-bottom: 0; }

/* ---------- buttons (from the app; softer padding) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px; border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 600; cursor: pointer; text-decoration: none; font-size: .95rem; line-height: 1.2;
}
.btn.primary { background: var(--accent-fill); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: var(--rule-strong); color: var(--text); }
.btn.ghost:hover { border-color: var(--accent); }
.btn.small { min-height: 44px; padding: 8px 16px; font-size: .9rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.large { min-height: 52px; padding: 13px 28px; font-size: 1.04rem; }

/* Quiet text actions with full-size tap targets (resources) */
.links { display: flex; flex-wrap: wrap; gap: 0 22px; margin: 0; padding: 0; list-style: none; }
.links a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; }

/* ---------- header ---------- */
.site-header { border-bottom: 1px solid var(--rule); background: var(--ground); }
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 20px; padding-top: 12px; padding-bottom: 12px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
  color: var(--text); min-height: 44px; padding: 0 6px 0 0; border-radius: 10px;
}
.brand img { width: 36px; height: 36px; }
.brand-name { font-size: .82rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; white-space: nowrap; }
.site-nav { display: flex; align-items: center; gap: 4px 6px; flex-wrap: wrap; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; }
.site-nav a:not(.btn) {
  position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px;
  color: var(--text); text-decoration: none; font-family: var(--font-heading); font-weight: 600; font-size: 1.02rem; border-radius: 12px;
}
.site-nav a:not(.btn):hover { color: var(--accent); }
.site-nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 3px; height: 2px;
  border-radius: 2px; background: var(--rose);
}
.header-start { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

@media (max-width: 760px) {
  .site-header .wrap { padding-top: 8px; padding-bottom: 4px; gap: 4px 12px; }
  .header-start { width: 100%; justify-content: space-between; gap: 10px; }
  .header-start .open-app { padding: 8px 16px; font-size: .9rem; }
  .site-nav { width: 100%; }
  .site-nav ul { margin-left: -12px; }
}
@media (max-width: 380px) {
  .site-nav a:not(.btn) { padding: 0 10px; }
  .site-nav ul { margin-left: -10px; }
  .brand { gap: 8px; }
  .brand-name { letter-spacing: .16em; }
}

/* ---------- home ---------- */
.hero { padding: 64px 0 36px; text-align: center; }
.hero .mark { width: 112px; height: 112px; margin: 0 auto 6px; }
.hero .wordmark-lg {
  font-size: .92rem; font-weight: 600; letter-spacing: .28em; text-transform: uppercase;
  margin: 0 0 2rem; padding-left: .28em;
}
.hero h1 { margin: 0; }
.hero .subhead { font-size: clamp(1.2rem, 3.2vw, 1.45rem); font-style: italic; font-weight: 400; color: var(--text); margin: .4rem 0 1.6rem; }
.hero .what { max-width: 33rem; margin: 0 auto 2rem; color: var(--muted); font-size: 1.1rem; }
.hero-art { margin: 8px auto 0; max-width: var(--wide); padding: 0 var(--gutter); }
.hero-art img {
  width: 100%; border-radius: 28px; aspect-ratio: 1670 / 942; object-fit: cover;
  background: var(--ground-deep);
}

/* The thread: one continuous cord in its own band, so it never crosses text */
.thread { display: block; width: 100%; height: 56px; margin: 8px 0; color: var(--rose); overflow: hidden; }
.thread svg { width: 100%; height: 56px; }
.thread path { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

.parts { padding: 56px 0 8px; }
.parts h2 { text-align: center; margin-bottom: 2.2rem; }
.parts ol {
  list-style: none; margin: 0; padding: 0; display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 48px;
}
.parts h3 { margin-bottom: .35rem; font-size: 1.15rem; }
/* A small loose loop of red thread above each heading */
.parts h3::before {
  content: ""; display: block; width: 44px; height: 14px; margin-bottom: 12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 14'%3E%3Cpath d='M1 9c6-5 11 3 17-1 3-2 4-6 1-7-3-1-4 4 0 6 5 2 9-3 14-3 4 0 7 2 10 3' fill='none' stroke='%23E45A68' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat left center / contain;
}
.parts p { color: var(--muted); margin: 0; }
@media (max-width: 760px) { .parts ol { grid-template-columns: 1fr; gap: 32px; } }

.parts .note-line, .note-line { text-align: center; color: var(--muted); font-size: .95rem; max-width: 40rem; margin: 48px auto 0; }
.about-intro { padding: 64px 0 8px; }
.about-intro h2 { text-align: center; margin-bottom: 1.6rem; }
.about-intro-body { max-width: var(--measure); margin: 0 auto; }
.about-intro-body p { margin: 0 0 1.1rem; }
.about-intro-more { max-width: var(--measure); margin: 1.4rem auto 0; }
.closing { text-align: center; padding: 40px 0 88px; }
.closing .line { font-family: var(--font-heading); font-size: clamp(1.5rem, 4.2vw, 2.1rem); font-weight: 600; letter-spacing: -.01em; margin: 0 0 1.4rem; line-height: 1.25; }

/* ---------- inner pages ---------- */
.page-head { padding: 56px 0 12px; }
.page-head .lede { font-size: 1.12rem; color: var(--muted); }
.prose, .page-body { padding-bottom: 72px; }
.prose h2 { margin-top: 2.6rem; }
.prose h3 { margin-top: 1.8rem; }
.prose ul, .prose ol { padding-left: 1.25rem; margin: 0 0 1.1em; }
.prose li { margin-bottom: .5em; }
.meta { color: var(--muted); font-size: .92rem; }
.prose dl { margin: 0 0 1.1em; }
.prose dt { font-weight: 600; margin-top: 1.1em; }
.prose dd { margin: .15em 0 0; }
.modes { list-style: none; padding: 0 !important; margin: 1.2rem 0 1.4rem; }
.prose .modes li { margin: 0 0 1rem; }
.modes strong { display: block; font-weight: 600; }

/* ---------- resources: an invisible table ---------- */
.emergency { margin: 4px 0 48px; }
.emergency h2 { font-size: 1.25rem; font-weight: 600; margin: 0 0 .3rem; }
.emergency p { margin: 0 0 .9rem; }
.res-section { margin: 0 0 44px; }
.res-section h2 {
  font-family: var(--font-body); font-size: .76rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 4px; padding-bottom: 10px; border-bottom: 1px solid var(--rule);
}
.res-section .about { color: var(--muted); font-size: .94rem; margin: 10px 0 0; }
.res-list { list-style: none; margin: 0; padding: 0; }
.page .res-section :is(h2, p, ul.res-list) { max-width: 56rem; }
.res-item {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2px 40px;
  padding: 18px 0 8px; align-items: start;
}
.res-item h3 { font-size: 1.08rem; margin: 0; }
.res-item .hours { font-weight: 400; font-size: .84rem; color: var(--muted); margin-left: 6px; }
.res-item .for { color: var(--muted); font-size: .95rem; margin: 2px 0 0; }
.res-item .note { color: var(--muted); font-size: .88rem; margin: 4px 0 0; }
.res-item .links { grid-column: 2; grid-row: 1 / span 3; align-self: start; }
@media (max-width: 760px) {
  .res-item { grid-template-columns: 1fr; padding-top: 16px; }
  .res-item .links { grid-column: 1; grid-row: auto; margin-top: 2px; }
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions.center { justify-content: center; }

/* ---------- support form ---------- */
.form { display: grid; gap: 22px; margin: 8px 0 28px; }
.field { display: grid; gap: 4px; }
.field label { display: block; font-weight: 600; }
.hint { margin: 0; font-size: .86rem; color: var(--muted); font-weight: 400; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: var(--radius);
  border: 1px solid var(--rule-strong); background: var(--surface); font-size: 16px;
}
.field textarea { min-height: 180px; resize: vertical; }
.field [aria-invalid="true"] { border-color: var(--accent); }
.field-error { margin: 2px 0 0; color: var(--accent); font-size: .9rem; font-weight: 600; }
.field-error[hidden] { display: none; }
.count { font-size: .84rem; color: var(--muted); margin: 0; justify-self: end; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-status { border-left: 2px solid var(--rose); padding: 2px 0 2px 16px; margin: 0; font-weight: 600; }
.form-status:empty { display: none; }
.form-status.err { border-left-color: var(--accent); color: var(--accent); }

/* ---------- invisible tables ---------- */
.table-scroll { overflow-x: auto; max-width: 100%; margin: 0 0 1.2rem; -webkit-overflow-scrolling: touch; }
.table-scroll.tall { max-height: 75vh; overflow-y: auto; }
.plain-table { width: 100%; border-collapse: collapse; font-size: .93rem; line-height: 1.55; }
.plain-table th, .plain-table td { text-align: left; vertical-align: top; padding: 9px 20px 9px 0; border: 0; }
.plain-table th:last-child, .plain-table td:last-child { padding-right: 0; }
.plain-table thead th {
  font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  font-weight: 600; white-space: nowrap; padding-top: 4px; padding-bottom: 10px;
  border-bottom: 1px solid var(--rule); background: var(--ground);
}
.plain-table tbody th { font-weight: 500; }
.plain-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.plain-table tbody tr:first-child > * { padding-top: 14px; }

.sources-summary { max-width: var(--measure); }
.sources-summary td.details { color: var(--muted); }
.sources-table { min-width: 880px; }
.sources-table thead th { position: sticky; top: 0; z-index: 1; }
.sources-table td.title { min-width: 15rem; width: 30%; }
.sources-table td.year { white-space: nowrap; font-variant-numeric: tabular-nums; }
.src-note { display: block; color: var(--muted); font-size: .84rem; margin-top: 2px; }
.sources-groups details { margin: 0; border-top: 1px solid var(--rule); }
.sources-groups details:last-child { border-bottom: 1px solid var(--rule); }
.sources-groups summary { cursor: pointer; padding: 12px 0; font-weight: 600; min-height: 44px; }
.sources-groups summary .count { display: inline; color: var(--muted); font-weight: 400; font-size: inherit; }
.sources-groups details .table-scroll { margin: 4px 0 18px; }
@media (max-width: 600px) {
  /* The summary stacks on phones so its details text gets the whole width. */
  .sources-summary thead { display: none; }
  .sources-summary tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .sources-summary th, .sources-summary td { padding-right: 0; }
  .sources-summary td.details { grid-column: 1 / -1; padding-top: 0; }
  .sources-summary td.details:empty { display: none; }
  .sources-summary tbody tr:first-child > * { padding-top: 9px; }
  .sources-summary tbody tr:first-child td.details { padding-top: 0; }
}

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: 72px 0 96px; }
.notfound img { width: 120px; height: 120px; margin: 0 auto 12px; }
.notfound p { max-width: 32rem; margin-left: auto; margin-right: auto; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--rule); color: var(--muted); font-size: .94rem; padding: 40px 0 48px; }
.site-footer .crisis { color: var(--text); margin: 0 0 16px; max-width: 46rem; }
.site-footer ul { list-style: none; margin: 0 0 16px -10px; padding: 0; display: flex; flex-wrap: wrap; gap: 0 4px; }
.site-footer ul a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; color: var(--text); }
.site-footer .small { font-size: .88rem; margin: 0 0 6px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
