/* MenoCause. Light slate base, indigo-to-violet accent, frosted cards.
   The print rules at the bottom turn the brief into a one-page intake sheet. */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(/fonts/plus-jakarta-sans-latin.woff2) format("woff2");
}

:root {
  --indigo: #4F46E5;
  --violet: #7C3AED;
  --blue: #3B82F6;
  --accent: #4F46E5;
  --grad: linear-gradient(120deg, #4F46E5 0%, #7C3AED 55%, #3B82F6 115%);
  --bg: #F8FAFC;
  --bg-2: #F1F5F9;
  --line: #E2E8F0;
  --line-strong: #CBD5E1;
  --ink: #0F172A;
  --ink-2: #475569;
  --tint: #EEF2FF;
  --tint-line: #A5B4FC;
  --tint-ink: #3730A3;
  --danger: #B91C1C;
  --radius: 20px;
  --pwa-accent: #4F46E5;
  --pwa-accent-2: #7C3AED;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, p, ul, ol, dl, dd, fieldset, legend { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }
button, input { font: inherit; color: inherit; }
a { color: var(--indigo); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; border-radius: 6px; }

.skip { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 10px 14px; border-radius: 10px; background: #fff; color: var(--ink); font-weight: 700; }
.skip:focus { top: 12px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: max(14px, env(safe-area-inset-top)) 20px 104px;
  color: #fff;
  background: var(--grad);
  overflow: hidden;
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.hero::before { width: 520px; height: 520px; right: -180px; top: -260px; background: radial-gradient(closest-side, rgba(255, 255, 255, .22), transparent); }
.hero::after { width: 420px; height: 420px; left: -160px; bottom: -260px; background: radial-gradient(closest-side, rgba(59, 130, 246, .55), transparent); }
.topbar { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 880px; margin: 0 auto; min-height: 44px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: #fff; font-weight: 700; font-size: 1rem; letter-spacing: -.01em; text-decoration: none; }
.brand-mark { width: 32px; height: 32px; flex: none; }
.hero-copy { position: relative; z-index: 1; max-width: 880px; margin: 34px auto 0; }
.hero h1 { max-width: 14ch; font-size: clamp(2rem, 7vw, 3.25rem); line-height: 1.08; font-weight: 800; letter-spacing: -.03em; text-wrap: balance; }
.hero-sub { max-width: 52ch; margin-top: 14px; font-size: 1.08rem; color: rgba(255, 255, 255, .92); }
.hero-points { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.hero-points li { padding: 6px 12px; border: 1px solid rgba(255, 255, 255, .3); border-radius: 999px; background: rgba(255, 255, 255, .12); font-size: .85rem; font-weight: 600; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }

/* The hero shrinks to a slim band once the wizard is under way. */
body:not([data-step="1"]) .hero { padding-bottom: 84px; }
body:not([data-step="1"]) .hero-copy { display: none; }

/* Visitor pill (shared counter client fills it; hidden until the API answers) */
.nav-visits { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 10px; border: 1px solid rgba(255, 255, 255, .28); border-radius: 999px; background: rgba(255, 255, 255, .14); color: #fff; font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; white-space: nowrap; cursor: default; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.nav-visits::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #34D399; box-shadow: 0 0 0 0 rgba(52, 211, 153, .7); animation: pulse 2.4s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .7); } 70%, 100% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); } }

/* ---------- Shell and cards ---------- */
.shell { position: relative; z-index: 2; max-width: 928px; margin: -68px auto 0; padding: 0 16px 8px; }
.card {
  padding: 24px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .86);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 18px 40px -22px rgba(79, 70, 229, .28);
}
.card + .card { margin-top: 16px; }
.card-quiet { background: rgba(255, 255, 255, .7); box-shadow: none; }

/* Stepper */
.stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 14px; padding: 10px 12px; border: 1px solid rgba(255, 255, 255, .5); border-radius: 16px; background: rgba(255, 255, 255, .8); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 10px 30px -20px rgba(15, 23, 42, .4); }
.stepper li { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.stepper .dot { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: #fff; font-size: .78rem; font-weight: 700; }
.stepper .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stepper .is-current { color: var(--ink); }
.stepper .is-current .dot { border-color: transparent; background: var(--grad); color: #fff; }
.stepper .is-done .dot { border-color: var(--tint-line); background: var(--tint); color: var(--tint-ink); }

/* Steps */
.step-title { font-size: clamp(1.4rem, 4.6vw, 1.75rem); line-height: 1.2; font-weight: 800; letter-spacing: -.02em; outline: none; }
.step-lead { margin-top: 6px; color: var(--ink-2); }
.count { display: inline-block; margin-left: 4px; font-weight: 700; color: var(--tint-ink); }
.field { margin-top: 26px; }
.field legend, .text-label { display: block; font-size: 1.05rem; font-weight: 700; }
.help { margin-top: 2px; font-size: .92rem; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.chips-grid { display: grid; grid-template-columns: 1fr; }

.chip { position: relative; display: block; cursor: pointer; }
.chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chip-box { display: flex; flex-direction: column; justify-content: center; min-height: 48px; padding: 10px 16px; border: 1.5px solid var(--line-strong); border-radius: 14px; background: #fff; transition: border-color .15s, background-color .15s, box-shadow .15s; }
.chip-label { font-weight: 600; line-height: 1.3; }
.chip-hint { margin-top: 2px; font-size: .9rem; line-height: 1.35; color: var(--ink-2); }
.chip:hover .chip-box { border-color: var(--tint-line); }
.chip input:checked + .chip-box { border-color: var(--indigo); background: var(--tint); box-shadow: 0 0 0 1px var(--indigo) inset; }
.chip input:checked + .chip-box .chip-label { color: var(--tint-ink); }
.chip input[type="checkbox"]:checked + .chip-box .chip-label::before { content: "✓ "; font-weight: 800; }
.chip input:focus-visible + .chip-box { outline: 3px solid var(--violet); outline-offset: 2px; }

.text-input { width: 100%; min-height: 50px; margin-top: 10px; padding: 10px 14px; border: 1.5px solid var(--line-strong); border-radius: 14px; background: #fff; }
.text-input::placeholder { color: #64748B; }
.text-input:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(79, 70, 229, .18); }

.form-error { margin-top: 20px; padding: 12px 14px; border: 1px solid #FECACA; border-radius: 12px; background: #FEF2F2; color: var(--danger); font-weight: 600; }
.wizard-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }
.wizard-nav .btn-primary { margin-left: auto; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 12px 22px; border: 1.5px solid transparent; border-radius: 14px; font-weight: 700; line-height: 1.2; text-align: center; cursor: pointer; transition: transform .12s, box-shadow .15s, background-color .15s, border-color .15s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 24px -12px rgba(79, 70, 229, .8); }
.btn-primary:hover { box-shadow: 0 14px 28px -12px rgba(79, 70, 229, .95); }
.btn-outline { border-color: var(--line-strong); background: #fff; color: var(--ink); }
.btn-outline:hover { border-color: var(--indigo); color: var(--tint-ink); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--bg-2); color: var(--ink); }

/* ---------- Brief (screen) ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.actions .btn { flex: 1 1 auto; }
.tip { margin-top: 16px; font-size: .95rem; color: var(--ink-2); }
.brief { margin-top: 20px; padding: 20px 18px; border: 1px solid var(--line-strong); border-radius: 14px; background: #fff; font-size: .95rem; line-height: 1.45; }
.brief-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 24px; padding-bottom: 12px; border-bottom: 2px solid var(--ink); }
.brief-head h3 { font-size: 1.3rem; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; }
.brief-head p { color: var(--ink-2); font-size: .85rem; }
.brief-id { display: flex; align-items: flex-end; gap: 6px; }
.brief-id i { display: inline-block; width: 150px; border-bottom: 1px solid var(--ink-2); }
.brief-id i.short { width: 84px; }
.brief-priority { margin-top: 14px; padding: 10px 12px; border: 1.5px solid var(--danger); border-radius: 8px; color: var(--danger); font-weight: 600; }
.brief-priority strong { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.brief section { margin-top: 16px; }
.brief h4 { margin-bottom: 8px; font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--tint-ink); }
.brief h5 { margin-bottom: 4px; font-size: .9rem; font-weight: 700; }
.snapshot { display: grid; grid-template-columns: 1fr; gap: 6px 20px; }
.snapshot div { display: flex; gap: 8px; }
.snapshot dt { flex: none; width: 9.5em; color: var(--ink-2); }
.snapshot dd { font-weight: 600; }
.matrix { width: 100%; border-collapse: collapse; }
.matrix th, .matrix td { padding: 6px 8px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.matrix thead th { background: var(--bg-2); font-size: .78rem; font-weight: 700; }
.matrix tbody th { width: 18%; font-weight: 700; font-size: .85rem; }
.matrix .grp { display: none; }
.matrix .said { width: 32%; color: var(--ink-2); }
.checkcols { display: grid; grid-template-columns: 1fr; gap: 14px 24px; }
.checks li { position: relative; padding-left: 22px; margin-top: 4px; }
.checks li::before { content: ""; position: absolute; left: 0; top: .28em; width: 12px; height: 12px; border: 1.5px solid var(--ink-2); border-radius: 2px; }
.brief-foot { margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--line); font-size: .78rem; color: var(--ink-2); }

/* ---------- Privacy, more tools, footer ---------- */
.privacy { display: flex; flex-direction: column; gap: 14px; }
.privacy h2 { font-size: 1.05rem; font-weight: 700; }
.privacy p { margin-top: 4px; font-size: .95rem; color: var(--ink-2); }
.privacy .btn { align-self: flex-start; }
.eyebrow { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.more-links { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 12px; }
.more-links a { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); text-decoration: none; transition: border-color .15s; }
.more-links a:hover { border-color: var(--tint-line); }
.more-links strong { display: block; color: var(--tint-ink); }
.more-links span { font-size: .9rem; color: var(--ink-2); }
.foot { max-width: 920px; margin: 0 auto; padding: 20px 20px calc(40px + env(safe-area-inset-bottom)); font-size: .85rem; color: var(--ink-2); }
.foot p + p { margin-top: 8px; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 60; display: flex; align-items: center; gap: 12px; width: max-content; max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 14px; background: var(--ink); color: #fff; font-size: .95rem; font-weight: 600; transform: translateX(-50%); box-shadow: 0 16px 40px -16px rgba(15, 23, 42, .7); }
.toast button { flex: none; min-height: 36px; padding: 4px 12px; border: 1px solid rgba(255, 255, 255, .4); border-radius: 10px; background: transparent; color: #fff; font-weight: 700; cursor: pointer; }

@media (min-width: 640px) {
  .hero { padding-left: 32px; padding-right: 32px; }
  .shell { padding-left: 24px; padding-right: 24px; }
  .card { padding: 32px; }
  .chips-grid { grid-template-columns: 1fr 1fr; }
  .chips-3 { grid-template-columns: repeat(3, 1fr); }
  .snapshot, .more-links { grid-template-columns: 1fr 1fr; }
  .checkcols { grid-template-columns: 1.6fr 1fr; }
  .privacy { flex-direction: row; align-items: center; justify-content: space-between; }
  .privacy .btn { align-self: center; flex: none; }
  .actions .btn { flex: 0 0 auto; }
  .brief { padding: 28px; }
}
@media (max-width: 480px) {
  .stepper li:not(.is-current) .lbl { display: none; }
  .stepper { grid-template-columns: auto auto auto auto; justify-content: space-between; }
  /* Phones: system name becomes a band above its rows, so the two text columns get the full width. */
  .matrix .sys { display: none; }
  .matrix .grp { display: table-row; }
  .matrix .grp th { width: auto; background: var(--tint); color: var(--tint-ink); }
  .matrix .said { width: 42%; }
  .snapshot div { flex-direction: column; gap: 0; }
  .snapshot dt { width: auto; font-size: .85rem; }
  .brief-id i { width: 110px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Print: the brief alone, one page, ink-friendly ---------- */
@page { margin: 10mm; }
@media print {
  html, body { background: #fff; }
  body { font-size: 9.6pt; line-height: 1.32; color: #000; }
  .hero, .stepper, .privacy, .more, .foot, .toast, .skip, .actions, .tip, .step-title, .step-lead, .wizard-nav, .form-error { display: none !important; }
  .shell { max-width: none; margin: 0; padding: 0; }
  .card { padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .brief { margin: 0; padding: 0; border: 0; border-radius: 0; font-size: 9.6pt; line-height: 1.32; }
  .brief-head { padding-bottom: 6pt; border-bottom: 1.2pt solid #000; }
  .brief-head h3 { font-size: 15pt; }
  .brief-head p, .brief-foot, .snapshot dt, .matrix .said { color: #333; }
  .brief-head p { font-size: 8.5pt; }
  .brief-id i { width: 150pt; border-color: #000; }
  .brief-id i.short { width: 80pt; }
  .brief-priority { margin-top: 7pt; padding: 4pt 7pt; border: 1.2pt solid #000; border-radius: 0; color: #000; }
  .brief section { margin-top: 9pt; break-inside: avoid; }
  .brief h4 { margin-bottom: 4pt; padding-bottom: 1.5pt; border-bottom: .6pt solid #999; font-size: 8pt; color: #000; }
  .brief h5 { margin-bottom: 1pt; font-size: 9pt; }
  .snapshot { grid-template-columns: 1fr 1fr; gap: 2pt 18pt; }
  .matrix th, .matrix td { padding: 2.2pt 5pt; border-color: #999; }
  .matrix thead th { background: none; font-size: 8pt; }
  .matrix tbody th { width: 17%; font-size: 8.6pt; }
  .matrix tr { break-inside: avoid; }
  .matrix .sys { display: table-cell; }
  .matrix .grp { display: none; }
  .snapshot div { flex-direction: row; gap: 8px; }
  .snapshot dt { width: 9.5em; font-size: inherit; }
  .checkcols { grid-template-columns: 2.4fr 1fr; gap: 0 18pt; }
  .checkcols > div:first-child .checks { column-count: 2; column-gap: 16pt; }
  .checks li { break-inside: avoid; }
  .checks li { margin-top: 1.6pt; padding-left: 13pt; }
  .checks li::before { top: .22em; width: 7pt; height: 7pt; border: .8pt solid #000; border-radius: 0; }
  .brief-foot { margin-top: 8pt; padding-top: 4pt; border-top: .6pt solid #999; font-size: 7.6pt; }

  /* Many symptoms selected: tighten so the sheet still fits one page. */
  .brief-dense { font-size: 8.7pt; line-height: 1.24; }
  .brief-dense section { margin-top: 6.5pt; }
  .brief-dense .matrix th, .brief-dense .matrix td { padding: 1.4pt 5pt; }
  .brief-dense .checks li { margin-top: .8pt; }
  .brief-dense .brief-foot { margin-top: 5pt; }
  .brief-xdense { font-size: 7.7pt; line-height: 1.17; }
  .brief-xdense .brief-head h3 { font-size: 13pt; }
  .brief-xdense section { margin-top: 5pt; }
  .brief-xdense h4 { margin-bottom: 2.5pt; }
  .brief-xdense .matrix th, .brief-xdense .matrix td { padding: .6pt 5pt; }
  .brief-xdense .checks li { margin-top: .4pt; }
  .brief-xdense .brief-head { padding-bottom: 4pt; }
  .brief-xdense .matrix tbody th { font-size: 7.6pt; }
  .brief-xdense .brief-priority { margin-top: 5pt; padding: 3pt 6pt; }
}
