/* Panic Hour — design for someone reading this on the worst night of their year.
   Rules: huge tap targets, one decision per screen, high contrast, no decoration
   that costs milliseconds. Works on old/borrowed phones. */

:root {
  --bg: #0f1419;
  --surface: #1a2129;
  --surface-2: #232c36;
  --text: #f2f5f7;
  --text-dim: #aab6c0;
  --accent: #4fc3f7;       /* calm blue, not alarm red */
  --accent-deep: #0288d1;
  --good: #66bb6a;
  --warn: #ffb74d;
  --danger: #ef5350;
  --border: #33404d;
  --radius: 14px;
  --tap: 64px;             /* minimum tap target — shaking hands */
  /* depth — subtle, just enough to read as solid not provisional */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.28), 0 1px 1px rgba(0,0,0,.20);
  --shadow-lift: 0 4px 12px rgba(0,0,0,.34);
  --tint: rgba(79,195,247,.08);
  --beer: #f0a83a;         /* warm amber for the donation callout */
  --beer-deep: #e09a28;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #eef1f5;
    --surface: #ffffff;
    --surface-2: #eef2f5;
    --text: #16212b;
    --text-dim: #51626f;
    --accent: #0277bd;
    --accent-deep: #01579b;
    --border: #cbd6df;
    --shadow-sm: 0 1px 2px rgba(16,33,45,.06), 0 2px 5px rgba(16,33,45,.05);
    --shadow-lift: 0 6px 18px rgba(16,33,45,.12);
    --tint: rgba(2,119,189,.06);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  line-height: 1.55;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.skip-link {
  position: absolute;
  left: -9999px;
  background: var(--accent);
  color: #002;
  padding: 12px 18px;
  z-index: 10;
}
.skip-link:focus { left: 12px; top: 12px; }

.site-header {
  position: relative;
  padding: 20px 20px 8px;
  text-align: center;
}

/* Quiet corner affordance — info on the wizard, back on the about page.
   44px tap target, understated until hovered/focused. */
.header-action {
  position: absolute;
  top: 10px;
  right: 8px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  text-decoration: none;
  border-radius: 50%;
}
.header-action:hover,
.header-action:focus-visible { color: var(--accent); }
.header-action:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.brand-home { text-decoration: none; color: inherit; display: inline-block; }
.brand-home:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.brand {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.6px;
  line-height: 1.1;
}
.brand-name { color: var(--text); }
.brand-name--accent { color: var(--accent); }
.brand-sub {
  font-size: 14.5px;
  color: var(--text-dim);
  margin-top: 3px;
}

/* Trust strip — the verification signal, above the fold, where the
   frightened "is this real?" decision actually happens. */
.trust-strip {
  max-width: 640px;
  margin: 0 auto;
  padding: 10px 16px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 10px;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.trust-item { white-space: nowrap; }
.trust-check { color: var(--good); font-weight: 800; margin-right: 2px; }
.trust-dot { opacity: .45; }
@media (max-width: 430px) {
  .trust-item { white-space: normal; }
  .trust-dot { display: none; }
}

main {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 12px 16px 40px;
}

.site-footer {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 20px 28px;
  font-size: 13px;
  color: var(--text-dim);
}
.site-footer a { color: var(--accent); }

/* Donation — gentle but visible: a warm "beer" callout, never a paywall */
.donate-box {
  margin: 18px 0 2px;
  padding: 15px 17px;
  background: rgba(240,168,58,.10);
  border: 1px solid rgba(240,168,58,.32);
  border-radius: 12px;
}
.donate-intro { margin: 0 0 11px; color: var(--text); font-weight: 600; }
a.donate-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--beer);
  color: #2b1d00;
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 700;
}
a.donate-link:visited { color: #2b1d00; }
a.donate-link:hover,
a.donate-link:focus-visible { background: var(--beer-deep); color: #2b1d00; }
a.donate-link:focus-visible { outline: 3px solid var(--beer); outline-offset: 2px; }
.donate-note { margin: 11px 0 0; }
main a { color: var(--accent); }
main a:visited { color: var(--accent); }

h1 { font-size: 27px; line-height: 1.22; letter-spacing: -0.4px; margin: 10px 0 12px; }
h1:focus { outline: none; } /* programmatic focus target for screen readers, not interactive */
h2 { font-size: 20px; letter-spacing: -0.2px; margin: 22px 0 10px; }
p  { margin: 8px 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  margin: 12px 0;
}

.lede { font-size: 19px; }
.dim  { color: var(--text-dim); }
.small { font-size: 14px; }

/* About page */
.about p { margin: 14px 0; }
.about .lede { font-weight: 600; margin-top: 4px; }
.about .card { margin: 22px 0; }
.about .rights-list li { font-size: 16.5px; line-height: 1.5; }
.signoff { color: var(--text-dim); font-style: italic; margin: 22px 0 24px; }
.about .btn-primary { margin-top: 8px; }

/* ---------- Buttons / choices ---------- */

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(79,195,247,.25);
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--tap);
  padding: 14px 18px;
  margin: 10px 0;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-size: 19px;
  font-weight: 600;
  text-align: center;
  transition: border-color .12s, box-shadow .12s, transform .06s;
}
.btn:active { transform: scale(0.985); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) {
  .btn-choice:hover { border-color: var(--accent); box-shadow: var(--shadow-lift); }
}

.btn-primary {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #fff;
  box-shadow: var(--shadow-lift);
}
.btn-choice { justify-content: flex-start; text-align: left; }
.btn-choice .choice-hint {
  display: block;
  font-weight: 400;
  font-size: 14.5px;
  color: var(--text-dim);
  margin-top: 2px;
}
.btn-choice > div { width: 100%; }
.btn-choice.selected {
  border-color: var(--accent);
  background: var(--surface-2);
}
.btn-choice.selected::after { content: "✓"; color: var(--accent); font-size: 22px; margin-left: 8px; }

.btn-ghost {
  background: none;
  border-color: transparent;
  box-shadow: none;
  color: var(--text-dim);
  font-size: 16px;
  min-height: 48px;
}

.btn-call {
  background: var(--good);
  border-color: var(--good);
  color: #03210a;
  font-size: 20px;
  text-decoration: none;
  box-shadow: var(--shadow-lift);
}
a.btn { text-decoration: none; color: var(--accent); }
a.btn:visited { color: var(--accent); }
a.btn-call, a.btn-call:visited { color: #03210a; }
a.btn-primary, a.btn-primary:visited { color: #fff; }
main nav a { color: var(--accent); }

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.choice-grid .btn { margin: 0; font-size: 17px; min-height: 56px; }
.choice-grid .btn.selected {
  border-color: var(--accent);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.choice-grid .btn.selected::after {
  content: "✓";
  color: var(--accent);
  font-size: 20px;
  font-weight: 800;
  margin-left: 8px;
}
@media (max-width: 360px) { .choice-grid { grid-template-columns: 1fr; } }

/* ---------- Progress ---------- */

.steps-indicator {
  font-size: 14px;
  color: var(--text-dim);
  margin: 6px 0 2px;
}

/* ---------- Battle plan ---------- */

.plan-banner {
  border-left: 5px solid var(--warn);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
  margin: 12px 0;
  font-weight: 600;
}
.plan-banner.urgent { border-left-color: var(--danger); }

.plan-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin: 12px 0;
  overflow: hidden;
}
.plan-step.done { opacity: 0.62; }
.plan-step.done .step-title { text-decoration: line-through; }

.step-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px;
  background: none;
  border: none;
  text-align: left;
  min-height: var(--tap);
}
.step-num {
  flex: 0 0 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--accent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 17px;
}
.plan-step.done .step-num { border-color: var(--good); color: var(--good); }
.step-title { font-size: 18px; font-weight: 700; flex: 1; }
.step-sub { font-size: 14px; color: var(--text-dim); font-weight: 400; display: block; }
.step-chevron { color: var(--text-dim); transition: transform .15s; }
.plan-step.open .step-chevron { transform: rotate(90deg); }

.step-body { padding: 0 16px 16px; display: none; }
.plan-step.open .step-body { display: block; }

.why {
  font-size: 15px;
  color: var(--text-dim);
  border-left: 3px solid var(--accent);
  padding-left: 10px;
  margin: 10px 0;
}

.script-box {
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 10px 0;
  font-size: 16.5px;
}
.script-box .script-label {
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  display: block;
  margin-bottom: 6px;
}

.verify-line {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 8px;
}
.verify-line.unverified { color: var(--warn); }

details.acc {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 10px 0;
  background: var(--surface-2);
}
details.acc summary {
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 17px;
  cursor: pointer;
  list-style-position: inside;
}
details.acc[open] summary { border-bottom: 1px solid var(--border); }
details.acc > *:not(summary) { margin-left: 14px; margin-right: 14px; }
details.acc > a.btn:last-child, details.acc > p:last-child { margin-bottom: 12px; }

.rights-list {
  padding-left: 20px;
  margin: 10px 0;
}
.rights-list li { margin: 8px 0; font-size: 15.5px; }

.done-row { display: flex; gap: 10px; margin-top: 12px; }
.done-row .btn { margin: 0; }
.btn-done {
  background: none;
  border-color: var(--good);
  color: var(--good);
  font-size: 16px;
}
.plan-step.done .btn-done { background: var(--good); color: #03210a; }

/* ---------- Notification log ---------- */

.log-list { list-style: none; padding: 0; margin: 8px 0; }
.log-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15.5px;
  font-variant-numeric: tabular-nums;
}
.log-time { color: var(--accent); font-weight: 700; margin-right: 10px; }
.log-ref {
  display: block;
  color: var(--good);
  font-weight: 600;
  font-size: 14.5px;
  margin-top: 2px;
}

/* ---------- reference capture ---------- */

.ref-row { margin-top: 14px; }
.ref-label {
  display: block;
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.ref-input {
  width: 100%;
  min-height: 52px;
  font: inherit;
  font-size: 18px;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}
.ref-input:focus { outline: none; border-color: var(--accent); }
.ref-warn { color: var(--warn); font-size: 14px; margin: 6px 0 0; }

/* ---------- notes + case file export ---------- */

.note-row { margin-top: 14px; }
.note-input {
  width: 100%;
  min-height: 60px;
  font: inherit;
  font-size: 16px;
  line-height: 1.45;
  padding: 10px 14px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  resize: vertical;
}
.note-input:focus { outline: none; border-color: var(--accent); }

.case-section-label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-weight: 700;
  margin: 18px 0 2px;
}
.log-note {
  display: block;
  color: var(--text-dim);
  font-size: 14.5px;
  margin-top: 3px;
  white-space: pre-wrap;
}
.export-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.export-row .btn { margin: 0; flex: 1 1 30%; min-height: 52px; }

/* ---------- print: the case file as a clean, labelled PDF ---------- */

#case-print { display: none; }

@media print {
  body.printing > *:not(#case-print) { display: none !important; }
  body.printing #case-print {
    display: block !important;
    color: #000;
    background: #fff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 12pt;
    line-height: 1.4;
    padding: 0;
    max-width: 100%;
  }
  #case-print h1 { font-size: 19pt; margin: 0 0 2px; }
  #case-print .cp-subtitle { font-style: italic; color: #333; margin: 0 0 14px; }
  #case-print .cp-head { margin: 0 0 6px; }
  #case-print h2 {
    font-size: 12pt;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border-bottom: 1.5px solid #000;
    padding-bottom: 4px;
    margin: 22px 0 10px;
  }
  #case-print h3 {
    font-size: 10.5pt;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #222;
    margin: 14px 0 6px;
  }
  #case-print h4 { font-size: 12pt; margin: 12px 0 3px; }
  #case-print .cp-meta { margin: 2px 0; }
  #case-print .cp-note { white-space: pre-wrap; }
  #case-print .cp-item { page-break-inside: avoid; break-inside: avoid; margin-bottom: 8px; }
  #case-print .cp-sign { margin: 6px 0; }
  #case-print .cp-foot {
    margin-top: 24px;
    padding-top: 8px;
    border-top: 1px solid #999;
    font-size: 9.5pt;
    color: #555;
  }
}

/* ---------- Misc ---------- */

.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-deep);
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  z-index: 20;
}
.toast.show { opacity: 1; }

.section-label {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin: 26px 0 4px;
  font-weight: 700;
}

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