*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f3f4f6;
  --color-text: #111827;
  --color-text-muted: #6b7280;
  --color-blue: #2563eb;
  --color-blue-dark: #1d4ed8;
  --color-blue-light: #eff6ff;
  --color-green: #16a34a;
  --color-green-light: #f0fdf4;
  --color-red: #dc2626;
  --color-red-light: #fef2f2;
  --color-border: #e5e7eb;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max-width: 820px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
  font-size: 1rem;
}

a {
  color: var(--color-blue);
  text-decoration: underline;
}

a:hover {
  color: var(--color-blue-dark);
}

/* ── HEADER / NAV ── */

header {
  background: var(--color-bg);
  border-bottom: 2px solid var(--color-blue);
  padding: 0.75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.nav-logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-blue);
  text-decoration: none;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav-links a {
  font-size: 0.875rem;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
}

.nav-links a:hover {
  color: var(--color-blue);
  text-decoration: underline;
}

.nav-crisis {
  margin-left: auto;
  background: var(--color-red) !important;
  color: white !important;
  padding: 0.3rem 0.75rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none !important;
  flex-shrink: 0;
}

.nav-crisis:hover {
  background: #b91c1c !important;
}

/* ── MAIN LAYOUT ── */

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1rem 5rem;
}

/* ── TYPOGRAPHY ── */

article h1 {
  font-size: 1.875rem;
  line-height: 1.25;
  margin-bottom: 0.4rem;
}

.updated {
  font-size: 0.825rem;
  color: var(--color-text-muted);
  margin-bottom: 1.75rem;
}

.intro {
  font-size: 1.05rem;
  line-height: 1.75;
  margin-bottom: 2rem;
  padding: 1.25rem 1.5rem;
  background: var(--color-blue-light);
  border-left: 4px solid var(--color-blue);
  border-radius: 0 6px 6px 0;
}

article h2 {
  font-size: 1.25rem;
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--color-border);
}

article h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

article p {
  margin-bottom: 1rem;
}

article ul,
article ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

article li {
  margin-bottom: 0.4rem;
}

/* ── STEP BLOCKS ── */

.steps {
  margin: 1.5rem 0;
}

.step {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1.25rem;
  background: var(--color-bg-alt);
  border-radius: 8px;
}

.step-num {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  background: var(--color-green);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
}

.step-body h3 {
  margin-top: 0;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.step-body p {
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}

.step-body p:last-child {
  margin-bottom: 0;
}

/* ── TEMPLATE BLOCKS ── */

.template-block {
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.25rem;
  margin: 1.75rem 0;
}

.template-block h3 {
  margin-top: 0;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
}

.template-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.65;
  margin-bottom: 0.85rem;
  padding: 0.75rem 1rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
}

.copy-btn {
  background: var(--color-blue);
  color: white;
  border: none;
  padding: 0.45rem 1.1rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.875rem;
  font-family: var(--font);
  font-weight: 500;
  transition: background 0.15s;
}

.copy-btn:hover {
  background: var(--color-blue-dark);
}

.copy-btn.copied {
  background: var(--color-green);
}

/* ── SUPPORT BOX ── */

.support-box {
  background: var(--color-blue-light);
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
}

.support-box h2,
.support-box h3 {
  border-bottom: none;
  color: #1e40af;
  margin-top: 0;
  font-size: 1.05rem;
  margin-bottom: 0.75rem;
}

.support-box ul {
  margin-bottom: 0;
}

.support-box li {
  margin-bottom: 0.5rem;
}

/* ── ALERT BOXES ── */

.stop-box {
  background: var(--color-red-light);
  border: 2px solid var(--color-red);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1.75rem 0;
  text-align: center;
}

.stop-box .stop-heading {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-red);
  letter-spacing: 0.02em;
  margin-bottom: 0.5rem;
}

.stop-box p {
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}

.stop-box p:last-child {
  margin-bottom: 0;
}

.warning-box {
  background: var(--color-red-light);
  border: 1px solid #fecaca;
  border-left: 4px solid var(--color-red);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

.warning-box p {
  margin-bottom: 0;
}

.info-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

.info-box p {
  margin-bottom: 0;
}

/* ── HERO (index page) ── */

.hero {
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border-radius: 12px;
  padding: 2rem 2rem 1.75rem;
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: 1.875rem;
  margin-bottom: 0.75rem;
  border: none;
}

.law-badge {
  display: inline-block;
  background: var(--color-green);
  color: white;
  padding: 0.2rem 0.7rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1rem;
  letter-spacing: 0.03em;
}

/* ── TRIAGE CARDS ── */

.triage-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.triage-card {
  display: block;
  padding: 1rem 1.25rem;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--color-text);
  transition: border-color 0.15s, background 0.15s;
}

.triage-card:hover {
  border-color: var(--color-blue);
  background: var(--color-blue-light);
  text-decoration: none;
  color: var(--color-text);
}

.triage-card strong {
  display: block;
  color: var(--color-blue);
  margin-bottom: 0.2rem;
  font-size: 1rem;
}

.triage-card span {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.triage-card.urgent {
  border-color: var(--color-red);
  background: var(--color-red-light);
}

.triage-card.urgent:hover {
  background: #fee2e2;
  border-color: #b91c1c;
}

.triage-card.urgent strong {
  color: var(--color-red);
}

/* ── LEGAL REFERRAL ── */

.legal-referral {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-blue);
  border-radius: 4px;
  padding: 1.25rem 1.5rem;
  margin: 3rem 0 1.5rem;
}

.legal-referral h3 {
  margin-top: 0;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.legal-referral p {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.affiliate-note {
  font-size: 0.775rem;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
  margin-bottom: 0;
}

/* ── ACTION BUTTON ── */

.action-btn {
  display: inline-block;
  background: var(--color-green);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

.action-btn:hover {
  background: #15803d;
  color: white;
  text-decoration: none;
}

/* ── TABLE ── */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

th {
  background: var(--color-bg-alt);
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--color-border);
  font-weight: 600;
}

td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

/* ── FOOTER ── */

footer {
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.825rem;
  color: var(--color-text-muted);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

footer p {
  margin-bottom: 0.4rem;
}

footer a {
  color: var(--color-text-muted);
}

footer a:hover {
  color: var(--color-blue);
}

/* ── RESPONSIVE ── */

@media (min-width: 600px) {
  .triage-grid {
    grid-template-columns: 1fr 1fr;
  }

  article h1,
  .hero h1 {
    font-size: 2.125rem;
  }
}

@media (max-width: 500px) {
  .nav-inner {
    gap: 0.5rem;
  }

  .nav-links {
    gap: 0.6rem;
  }

  .nav-links a {
    font-size: 0.8rem;
  }

  .step {
    flex-direction: row;
    gap: 0.75rem;
  }

  .hero {
    padding: 1.5rem;
  }
}

/* ── PRINT ── */

@media print {
  header,
  footer,
  .copy-btn,
  .legal-referral {
    display: none;
  }

  main {
    padding: 0;
  }
}

/* Spacing utilities (replace inline styles so a strict CSP can forbid inline styles) */
.mt-sm { margin-top: 0.75rem; }
.mt-md { margin-top: 1rem; }
