/* ============================================================
   ClinCog — shared design tokens (v3)
   Rebrand: modern indigo identity, replacing the original
   logo-sampled blue/gray. Chosen for a more premium, distinct
   feel while keeping the same Poppins/Inter/DM Mono type system,
   elevation scale, and motion already in place.
   ============================================================ */

:root {
  --bg: #fffcf2;
  --surface: #ffffff;
  --surface-sunken: #f4efe1;
  --ink: #252422;
  --ink-muted: #403d39;
  --ink-faint: #8a8579;
  --line: #ccc5b9;

  /* Brand colors: warm cream + vivid orange identity */
  --brand: #eb5e28;
  --brand-hover: #d14f1e;
  --brand-deep: #252422;
  --brand-pale: #fbe7db;
  --slate: #ccc5b9;
  --slate-pale: #f4efe1;

  /* Per-case domain accents, used sparingly (card tags, journey dots) */
  --domain-mood: #b5563c;
  --domain-anxiety: #6b8f7f;
  --domain-substance: #c9922f;

  --warn: #8b3a00;
  --warn-bg: #fff6ef;

  /* Typography: bold geometric sans for headings (matches the
     reference), Inter for body copy, DM Mono for small data
     labels only (kept from the original clinical-file styling). */
  --head: 'Poppins', 'Inter', system-ui, sans-serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'DM Mono', ui-monospace, monospace;

  --max: 1240px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(37,36,34,.06), 0 1px 1px rgba(37,36,34,.04);
  --shadow-md: 0 6px 16px rgba(37,36,34,.09), 0 2px 5px rgba(37,36,34,.05);
  --shadow-lg: 0 16px 36px rgba(37,36,34,.16), 0 4px 10px rgba(37,36,34,.06);
  --shadow-brand: 0 10px 24px rgba(235,94,40,.3);
}

html[data-theme="dark"] {
  --bg: #181715;
  --surface: #252422;
  --surface-sunken: #1f1e1b;
  --ink: #fffcf2;
  --ink-muted: #ccc5b9;
  --ink-faint: #8a8579;
  --line: #403d39;

  --brand: #eb5e28;
  --brand-hover: #ff7a47;
  --brand-pale: #3a281f;
  --slate: #ccc5b9;
  --slate-pale: #2e2c29;

  --domain-mood: #d17b5f;
  --domain-anxiety: #8fb5a4;
  --domain-substance: #dba94f;

  --warn-bg: #2a1c10;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow-md: 0 6px 18px rgba(0,0,0,.4);
  --shadow-lg: 0 18px 40px rgba(0,0,0,.5);
  --shadow-brand: 0 10px 26px rgba(235,94,40,.35);
}

html, body { transition: background-color .25s ease, color .25s ease; }
body, .module-card, .about-card, .splash-card, .name-gate, .chat-window, .vignette-box {
  transition: background-color .25s ease, border-color .25s ease, color .25s ease, box-shadow .25s ease;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Safety net: wherever a student types, text color follows the theme.
   Browsers don't inherit `color` into form fields by default, so this
   has to be explicit - otherwise dark mode can silently leave black
   text on a dark background. */
input, textarea, select {
  color: var(--ink);
  caret-color: var(--brand);
}
input::placeholder, textarea::placeholder {
  color: var(--ink-faint);
}

/* Soft, low-opacity gradient mesh — applied to body on every page via
   class="bg-mesh". Fixed positioning so it never looks cropped on short
   or long pages, and never interferes with clicks. */
body.bg-mesh::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(640px 420px at 6% -8%, rgba(235,94,40,.10), transparent 60%),
    radial-gradient(520px 400px at 104% 6%, rgba(64,61,57,.10), transparent 55%),
    radial-gradient(760px 520px at 50% 112%, rgba(235,94,40,.07), transparent 62%);
  pointer-events: none;
}
html[data-theme="dark"] body.bg-mesh::before {
  background:
    radial-gradient(640px 420px at 6% -8%, rgba(235,94,40,.13), transparent 60%),
    radial-gradient(520px 400px at 104% 6%, rgba(204,197,185,.08), transparent 55%),
    radial-gradient(760px 520px at 50% 112%, rgba(235,94,40,.09), transparent 62%);
}

h1, h2, h3 { font-family: var(--head); font-weight: 700; margin: 0; letter-spacing: -0.01em; }

a { color: inherit; }

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--brand);
}

/* ---------- top nav: dark solid bar, like the reference header ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 28px;
  background: var(--brand-deep);
  color: #fff;
}
.site-nav .brand {
  font-family: var(--head);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .01em;
  text-decoration: none;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}
.site-nav .brand img, .site-nav .brand svg { height: 26px; width: auto; }
.site-nav .brand span.dim { color: #b7c0d4; font-weight: 400; }
.site-nav .links { display: flex; align-items: center; gap: 22px; }
.site-nav a.nav-link {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: #cfd6e6;
}
.site-nav a.nav-link:hover { color: #fff; }
.site-nav a.back {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: #cfd6e6;
}
.site-nav a.back:hover { color: #fff; }

/* ---------- buttons: rounded pills, gradient primary ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  border: 0;
  cursor: pointer;
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease, border-color .18s ease, color .18s ease;
}
.btn-primary {
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: #fff;
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-2px); box-shadow: 0 14px 30px rgba(70,87,122,.34); }
.btn-primary:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.btn-secondary { background: var(--surface); border: 1px solid var(--line); color: var(--ink); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-secondary:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ---------- hero ---------- */
.hero-section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 64px 28px 48px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 40px;
  align-items: center;
}
.hero-copy h1 {
  font-size: clamp(34px, 4.4vw, 56px);
  line-height: 1.05;
  margin: 14px 0 20px;
  max-width: 14ch;
}
.hero-copy p.lede {
  font-size: 17px;
  color: var(--ink-muted);
  max-width: 52ch;
  line-height: 1.65;
  margin-bottom: 28px;
}
.hero-graphic {
  position: relative;
  border-radius: 28px;
  aspect-ratio: 1 / 1;
  background: radial-gradient(120% 120% at 25% 20%, var(--brand) 0%, var(--brand-deep) 100%);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.hero-graphic::before {
  content: "";
  position: absolute;
  inset: -20%;
  background: radial-gradient(circle at 70% 80%, rgba(255,255,255,.14), transparent 55%);
}
.hero-graphic svg { width: 56%; height: auto; position: relative; filter: drop-shadow(0 10px 24px rgba(0,0,0,.18)); }

@keyframes ccg-pulse {
  0%, 100% { opacity: 1; r: var(--r, 8.5); }
  50% { opacity: .55; }
}
.hero-graphic svg circle {
  animation: ccg-pulse 3.4s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.hero-graphic svg circle:nth-child(3n) { animation-delay: .4s; }
.hero-graphic svg circle:nth-child(3n+1) { animation-delay: 1.1s; }
.hero-graphic svg circle:nth-child(3n+2) { animation-delay: 1.9s; }
@media (prefers-reduced-motion: reduce) {
  .hero-graphic svg circle { animation: none; }
}

/* ---------- personalization: greeting + name gate ---------- */
.greeting-bar {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 28px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
}
.greeting-bar button.link {
  background: none;
  border: none;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--slate);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  margin-left: 8px;
}
.greeting-bar button.link:hover { color: var(--brand); }

.name-gate {
  max-width: 460px;
  margin: 8px auto 80px;
  padding: 34px 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  text-align: left;
  box-shadow: 0 1px 3px rgba(20,25,40,.05);
}
.name-gate h2 { font-size: 20px; margin-bottom: 8px; }
.name-gate p { font-size: 14px; color: var(--ink-muted); margin-bottom: 18px; line-height: 1.5; }
.name-gate form { display: flex; gap: 10px; }
.name-gate input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-family: var(--sans);
  background: var(--surface);
  color: var(--ink);
}
.name-gate input:focus { outline: none; border-color: var(--brand); }
.name-gate .privacy-note {
  margin-top: 14px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-faint);
}

.hidden { display: none !important; }

/* ---------- feature row: icon + bold heading + description ---------- */
.feature-row {
  max-width: var(--max);
  margin: 8px auto 56px;
  padding: 0 28px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 32px;
}
.feature {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  border-radius: 16px;
  transition: background .2s ease, transform .2s ease;
}
.feature:hover { background: var(--surface); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.feature .icon-chip {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(150deg, var(--brand-pale) 0%, var(--surface) 100%);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px rgba(235,94,40,.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  transition: transform .25s ease;
}
.feature:hover .icon-chip { transform: rotate(-6deg) scale(1.06); }
.feature .icon-chip svg { width: 22px; height: 22px; color: var(--brand); }
.feature .step-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--brand);
}
.feature h3 { font-size: 17px; }
.feature p { margin: 0; font-size: 14px; color: var(--ink-muted); line-height: 1.55; }

/* ---------- module grid ---------- */
.modules {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 28px 100px;
}
.modules h2 {
  font-size: 24px;
  margin-bottom: 6px;
}
.modules > p {
  color: var(--ink-muted);
  font-size: 14px;
  margin-bottom: 32px;
}
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}
.module-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.module-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--slate));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s ease;
}
.module-card:hover {
  border-color: transparent;
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}
.module-card:hover::before { transform: scaleX(1); }
.module-card .week {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.module-card h3 {
  font-size: 21px;
  margin: 2px 0 0;
}
.module-card .patient-meta {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
}
.module-card .teaser {
  font-size: 14px;
  color: var(--ink-muted);
  line-height: 1.55;
  flex-grow: 1;
}
.module-card .actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.module-card .actions .btn { flex: 1; justify-content: center; padding: 10px 14px; font-size: 13px; }

/* ---------- footer ---------- */
.site-footer-band {
  background: var(--brand-deep);
  color: #cfd6e6;
  margin-top: 60px;
}
.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 52px 28px 28px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 40px;
}
.site-footer .f-brand { display: flex; align-items: center; gap: 9px; font-family: var(--head); font-weight: 700; font-size: 16px; color: #fff; margin-bottom: 10px; text-decoration: none; }
.site-footer .f-brand img { height: 24px; }
.site-footer .f-note { font-size: 13px; line-height: 1.6; color: #9fabc4; max-width: 34ch; }
.site-footer h4 { font-family: var(--sans); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: #fff; margin-bottom: 14px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.site-footer a { color: #b7c0d4; text-decoration: none; font-size: 14px; }
.site-footer a:hover { color: #fff; }
.site-footer-bottom {
  max-width: var(--max);
  margin: 0 auto;
  padding: 20px 28px 28px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-family: var(--mono);
  font-size: 11px;
  color: #8592ad;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
/* ---------- scroll-reveal (respects reduced-motion) ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in-view { opacity: 1; transform: translateY(0); }
.module-grid .reveal:nth-child(2) { transition-delay: .08s; }
.module-grid .reveal:nth-child(3) { transition-delay: .16s; }
.feature-row .reveal:nth-child(2) { transition-delay: .08s; }
.feature-row .reveal:nth-child(3) { transition-delay: .16s; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ============================================================
   Conceptualization (chat) page components
   ============================================================ */
.chat-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.chat-page h1 { font-size: 28px; margin: 10px 0 20px; }

.vignette-box {
  background: var(--brand-pale);
  border-radius: 14px;
  padding: 22px 24px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
}
.vignette-box b { color: var(--brand-hover); }

.chat-window {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  min-height: 280px;
  padding: 20px;
  margin-bottom: 14px;
  overflow-y: auto;
  max-height: 480px;
  box-shadow: var(--shadow-md);
}
.msg { margin-bottom: 16px; line-height: 1.5; font-size: 15px; }
.msg.student { font-weight: 600; color: var(--ink); }
.msg.patient { color: var(--brand-hover); }
.msg .who {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-faint);
  margin-bottom: 3px;
  font-weight: 400;
}

.chat-form { display: flex; gap: 10px; }
.chat-form input {
  flex: 1;
  padding: 13px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-family: var(--sans);
  background: var(--surface);
  color: var(--ink);
}
.chat-form input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-pale); }

.chat-status {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 10px;
}
.chat-restart {
  background: none;
  border: none;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-faint);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  margin-top: 8px;
  display: inline-block;
}
.chat-restart:hover { color: var(--brand); }

.eval-link {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.eval-link p { margin: 0; font-size: 14px; color: var(--ink-muted); }

/* ============================================================
   Help / "How to use" page
   ============================================================ */
.help-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px 90px;
}
.help-page h1 { font-size: 30px; margin: 10px 0 8px; }
.help-page > p.lede { font-size: 16px; color: var(--ink-muted); margin-bottom: 40px; max-width: 60ch; }
.help-section { margin-bottom: 36px; }
.help-section h2 {
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.help-section h2 .num {
  font-family: var(--head);
  font-weight: 700;
  font-size: 13px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--brand-pale);
  color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.help-section p, .help-section li { font-size: 15px; color: var(--ink-muted); line-height: 1.65; }
.help-section ul { padding-left: 20px; margin: 8px 0; }
.help-note {
  background: var(--surface-sunken);
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 14px;
  color: var(--ink-muted);
  margin-top: 8px;
}

@media (max-width: 720px) {
  .hero-graphic { max-width: 260px; margin: 0 auto; }
}

@media (max-width: 640px) {
  .site-nav { padding: 0 16px; }
  .site-nav .links { gap: 14px; }
}

/* ============================================================
   Splash gate — the very first page. Deliberately minimal.
   ============================================================ */
.splash-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}
.splash-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 52px 44px;
  box-shadow: var(--shadow-lg);
  animation: ccg-rise .6s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes ccg-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) { .splash-card { animation: none; } }
.splash-mark { width: 64px; height: 64px; margin-bottom: 22px; }
.splash-mark circle { animation: ccg-pulse 3.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.splash-mark circle:nth-child(3n) { animation-delay: .4s; }
.splash-mark circle:nth-child(3n+1) { animation-delay: 1.1s; }
.splash-mark circle:nth-child(3n+2) { animation-delay: 1.9s; }
@media (prefers-reduced-motion: reduce) { .splash-mark circle { animation: none; } }
.splash-page h1 {
  font-size: clamp(26px, 4vw, 34px);
  margin-bottom: 8px;
}
.splash-page p.tagline {
  font-size: 14px;
  color: var(--ink-muted);
  font-family: var(--mono);
  letter-spacing: .02em;
  margin-bottom: 40px;
}
.splash-form {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 380px;
}
.splash-form input {
  flex: 1;
  padding: 13px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 15px;
  font-family: var(--sans);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.splash-form input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-pale); }
.splash-help {
  margin-top: 28px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-faint);
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 8px 18px;
  border-radius: 999px;
  display: inline-block;
  transition: border-color .15s ease, color .15s ease, transform .15s ease;
}
.splash-help:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); }

/* ============================================================
   Expanded masthead (dashboard + inner pages): brand, menu,
   about, resources dropdown, mobile hamburger.
   ============================================================ */
.site-nav .links { display: flex; align-items: center; gap: 26px; }
.site-nav .links a.nav-link { position: relative; }
.site-nav .dropdown { position: relative; }
.site-nav .dropdown > button {
  background: none; border: none; cursor: pointer;
  font-family: var(--sans); font-size: 14px; font-weight: 500;
  color: #cfd6e6; display: flex; align-items: center; gap: 4px;
  padding: 0;
}
.site-nav .dropdown > button:hover { color: #fff; }
.site-nav .dropdown-panel {
  display: none;
  position: absolute; top: 28px; right: 0;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  min-width: 220px; padding: 8px; box-shadow: 0 12px 28px rgba(20,25,40,.14);
  z-index: 60;
}
.site-nav .dropdown.open .dropdown-panel { display: block; }
.site-nav .dropdown-panel a {
  display: block; padding: 9px 12px; border-radius: 6px;
  font-size: 13px; color: var(--ink-muted); text-decoration: none;
}
.site-nav .dropdown-panel a:hover { background: var(--surface-sunken); color: var(--ink); }
.site-nav .dropdown-panel .soon { color: var(--ink-faint); font-size: 11px; }
.site-nav .hamburger {
  display: none; background: none; border: none; cursor: pointer;
  color: #fff; padding: 4px;
}
.site-nav .hamburger svg { width: 22px; height: 22px; }

/* ---------- greeting ---------- */
.greeting-hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 40px 28px 0;
}
.greeting-hero h1 {
  font-size: clamp(28px, 3.6vw, 40px);
  margin-bottom: 4px;
}
.greeting-hero .sub {
  font-size: 15px;
  color: var(--ink-muted);
}
.greeting-hero .sub button.link {
  background: none; border: none; font-family: var(--sans);
  font-size: 13px; color: var(--slate); text-decoration: underline;
  cursor: pointer; padding: 0; margin-left: 6px;
}
.greeting-hero .sub button.link:hover { color: var(--brand); }

/* ---------- about page ---------- */
.about-page { max-width: 720px; margin: 0 auto; padding: 56px 24px 90px; }
.about-page > .eyebrow { display: block; margin-bottom: 4px; }
.about-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 44px 40px;
  box-shadow: var(--shadow-md);
  margin-top: 18px;
}
.about-page h1 { font-size: 30px; margin: 0 0 20px; }
.about-page p { font-size: 15px; color: var(--ink-muted); line-height: 1.75; margin-bottom: 16px; }
.about-page p em { color: var(--ink); font-style: normal; font-weight: 600; }
.about-meta {
  margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 12px; color: var(--ink-faint); line-height: 2;
}

/* ============================================================
   Forced layout preview, driven by the floating accessibility
   button (a11y.js). "auto" does nothing extra - real viewport
   width decides, same as any normal responsive page. "phone"
   visually frames the content at a phone-like width so the
   auto-fit grids above collapse to a single column even on a
   wide desktop browser. "desktop" guarantees the wide layout
   even on an actually-narrow screen, with horizontal scroll.
   ============================================================ */
#ccg-viewport { transition: max-width .3s ease, min-width .3s ease, box-shadow .3s ease; }
html[data-force-layout="phone"] #ccg-viewport {
  max-width: 400px;
  margin: 18px auto;
  border-radius: 28px;
  box-shadow: 0 0 0 1px var(--line), 0 24px 60px rgba(20,25,40,.18);
  overflow: hidden;
}
html[data-force-layout="desktop"] {
  overflow-x: auto;
}
html[data-force-layout="desktop"] #ccg-viewport {
  min-width: 960px;
}

/* Real small-phone tightening - matters whether the narrow width
   is genuine (a real phone) or simulated (forced preview). */
@media (max-width: 480px) {
  .hero-copy h1 { font-size: 28px; }
  .hero-section, .feature-row, .modules, .site-footer, .chat-page, .help-page, .about-page { padding-left: 18px; padding-right: 18px; }
  .module-card, .name-gate, .splash-card, .about-card, .help-card { padding: 20px; }
  .splash-card { padding: 36px 26px; }
  .greeting-hero h1 { font-size: 26px; }
}

/* ============================================================
   Dashboard app shell — sidebar (desktop) / drawer (mobile).
   Scoped to dashboard.html only; every other page keeps the
   simple top toolbar from nav.js.
   ============================================================ */
.app-shell { display: flex; min-height: 100dvh; }

.app-sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--brand-deep); color: #fff;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100dvh;
  z-index: 600;
}
.app-sidebar-brand {
  display: flex; align-items: center; gap: 9px;
  padding: 20px 22px; font-family: var(--head); font-weight: 700; font-size: 15px;
  color: #fff; text-decoration: none; flex-shrink: 0;
}
.app-sidebar-brand img { height: 24px; width: auto; }
.app-sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; flex: 1; }
.app-sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  font-family: var(--sans); font-size: 14px; font-weight: 500;
  color: rgba(255,255,255,.68); text-decoration: none;
  position: relative; transition: background .15s ease, color .15s ease;
}
.app-sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.app-sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.app-sidebar-nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.app-sidebar-nav a.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 2px; background: #fff;
}
.app-sidebar-footer {
  padding: 14px 20px 20px; border-top: 1px solid rgba(255,255,255,.1);
  display: flex; flex-direction: column; gap: 8px;
}
.app-sidebar-footer a { font-family: var(--sans); font-size: 13px; color: rgba(255,255,255,.6); text-decoration: none; }
.app-sidebar-footer a:hover { color: #fff; }
.app-sidebar-footer .app-sidebar-version { font-family: var(--mono); font-size: 11px; color: rgba(255,255,255,.35); margin-top: 2px; }

.app-menu-btn {
  display: none; position: fixed; top: 14px; left: 14px; z-index: 700;
  width: 40px; height: 40px; border-radius: 10px; border: none; cursor: pointer;
  background: var(--brand-deep); color: #fff; align-items: center; justify-content: center;
}
.app-menu-btn svg { width: 20px; height: 20px; }
.app-sidebar-backdrop { display: none; }

.app-main { flex: 1; min-width: 0; }
.app-topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 32px; border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.app-topbar-term { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); letter-spacing: .02em; }
.app-topbar-week { font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--brand); }

.app-content { max-width: 980px; margin: 0 auto; padding: 36px 32px 90px; }

@media (max-width: 860px) {
  .app-sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s ease; }
  .app-sidebar.open { transform: translateX(0); }
  .app-menu-btn { display: flex; }
  .app-sidebar-backdrop.open {
    display: block; position: fixed; inset: 0; background: rgba(10,8,30,.45); z-index: 590;
  }
  .app-topbar { padding-left: 64px; }
  .app-content { padding: 28px 20px 80px; }
}

/* ---------- greeting, inside the app content now ---------- */
.dash-greeting { margin-bottom: 32px; }
.dash-greeting h1 { font-size: clamp(24px, 3vw, 32px); margin-bottom: 4px; }
.dash-greeting .sub { font-size: 14px; color: var(--ink-muted); }
.dash-greeting .sub button.link { background: none; border: none; font-family: var(--sans); font-size: 13px; color: var(--slate); text-decoration: underline; cursor: pointer; padding: 0; margin-left: 6px; }
.dash-greeting .sub button.link:hover { color: var(--brand); }

/* ---------- continue-your-case hero ---------- */
.continue-card {
  background: linear-gradient(155deg, var(--brand) 0%, var(--brand-deep) 100%);
  border-radius: 22px; padding: 34px 36px; color: #fff;
  box-shadow: var(--shadow-lg); margin-bottom: 36px; position: relative; overflow: hidden;
}
.continue-card .eyebrow { color: rgba(255,255,255,.75); }
.continue-card .continue-week { font-family: var(--mono); font-size: 12px; color: rgba(255,255,255,.6); margin-top: 10px; }
.continue-card h2 { font-size: clamp(24px, 3vw, 30px); margin: 4px 0 4px; }
.continue-card .continue-meta { font-family: var(--sans); font-size: 14px; color: rgba(255,255,255,.75); margin-bottom: 16px; }
.continue-card .continue-quote { font-family: var(--head); font-style: normal; font-size: 17px; line-height: 1.5; max-width: 52ch; margin-bottom: 22px; color: rgba(255,255,255,.95); }
.continue-card .continue-progress-row { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; max-width: 340px; }
.continue-card .continue-progress-track { flex: 1; height: 6px; border-radius: 4px; background: rgba(255,255,255,.22); overflow: hidden; }
.continue-card .continue-progress-fill { height: 100%; background: #fff; border-radius: 4px; transition: width .4s ease; }
.continue-card .continue-progress-label { font-family: var(--mono); font-size: 11px; color: rgba(255,255,255,.75); white-space: nowrap; }
.continue-card .btn-continue {
  display: inline-flex; align-items: center; gap: 6px; background: #fff; color: var(--brand-deep);
  font-family: var(--sans); font-weight: 700; font-size: 14px; padding: 12px 24px;
  border-radius: 999px; text-decoration: none; box-shadow: 0 10px 24px rgba(0,0,0,.18);
  transition: transform .15s ease;
}
.continue-card .btn-continue:hover { transform: translateY(-2px); }
.continue-card.all-done { background: linear-gradient(155deg, var(--brand) 0%, var(--brand-deep) 100%); text-align: center; padding: 46px 36px; }
.continue-card.all-done h2 { font-size: 26px; }

/* ---------- term progress ---------- */
.term-progress { margin-bottom: 40px; }
.term-progress h2 { font-size: 18px; margin-bottom: 4px; }
.term-progress .term-sub { font-size: 13px; color: var(--ink-muted); margin-bottom: 14px; }
.term-progress-track { height: 8px; border-radius: 4px; background: var(--surface-sunken); overflow: hidden; margin-bottom: 20px; }
.term-progress-fill { height: 100%; background: var(--brand); border-radius: 4px; transition: width .4s ease; }
.term-week-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.term-week-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.term-week-row:last-child { border-bottom: none; }
.term-week-row .week-status-icon { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 12px; font-weight: 700; }
.term-week-row .week-status-icon.complete { background: var(--brand); color: #fff; }
.term-week-row .week-status-icon.in-progress { background: var(--brand-pale); color: var(--brand); border: 2px solid var(--brand); }
.term-week-row .week-status-icon.not-started { border: 2px solid var(--line); color: var(--ink-faint); }
.term-week-row .week-info { flex: 1; }
.term-week-row .week-label { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); }
.term-week-row .week-name { font-family: var(--head); font-weight: 600; font-size: 15px; }
.term-week-row .week-state-text { font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--ink-muted); }
.term-week-row .week-state-text.complete { color: var(--brand); }

/* ---------- clinical methodology journey (reuses .feature-row/.feature) ---------- */
.journey-intro {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  margin-bottom: 8px;
}
.journey-text { flex: 1; }
.journey-intro h2 { font-size: 18px; margin-bottom: 4px; }
.journey-intro p { font-size: 13px; color: var(--ink-muted); max-width: 62ch; }
.journey-mark {
  flex-shrink: 0; width: 96px; height: 96px; border-radius: 20px;
  background: radial-gradient(120% 120% at 25% 20%, var(--brand) 0%, var(--brand-deep) 100%);
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.journey-mark svg { width: 68%; height: auto; }
@media (max-width: 640px) {
  .journey-intro { flex-direction: column; align-items: flex-start; }
  .journey-mark { width: 72px; height: 72px; }
}

/* ---------- case grid, domain accents + status badges ---------- */
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  padding: 4px 9px; border-radius: 999px; width: fit-content;
}
.status-badge.not-started { background: var(--surface-sunken); color: var(--ink-faint); }
.status-badge.in-progress { background: var(--brand-pale); color: var(--brand); }
.status-badge.complete { background: var(--brand); color: #fff; }
.module-card { border-top: 3px solid var(--domain-color, var(--brand)); }
.module-card::before { display: none; }
.module-card[data-domain="mood"] { --domain-color: var(--domain-mood); }
.module-card[data-domain="anxiety"] { --domain-color: var(--domain-anxiety); }
.module-card[data-domain="substance"] { --domain-color: var(--domain-substance); }

/* ---------- clinical thinking metrics ---------- */
.metrics-section { margin: 44px 0; }
.metrics-section h2 { font-size: 18px; margin-bottom: 4px; }
.metrics-section .metrics-sub { font-size: 13px; color: var(--ink-muted); margin-bottom: 18px; }
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.metric-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow-sm); }
.metric-card .metric-value { font-family: var(--head); font-weight: 700; font-size: 30px; color: var(--brand); }
.metric-card .metric-label { font-family: var(--sans); font-size: 12px; color: var(--ink-muted); margin-top: 2px; }
