/* ============================================================
   Family Crisis Toolkit — design system v2
   Reference: Claude (Anthropic) — warm parchment editorial
   Serif headlines (Newsreader) + Inter UI, warm neutrals only,
   ring-based depth, terracotta used sparingly.
   ============================================================ */

@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/newsreader-normal-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../assets/fonts/newsreader-normal-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Newsreader';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/newsreader-italic-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/inter-normal-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../assets/fonts/inter-normal-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../assets/fonts/inter-normal-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../assets/fonts/inter-normal-700.woff2') format('woff2');
}

/* ---------- Tokens (names kept stable so all pages inherit) ---------- */
:root {
  /* Surfaces — warm paper, no cool grays */
  --bg: #f5f4ed;            /* parchment */
  --surface: #faf9f5;       /* ivory */
  --surface-2: #f1efe6;     /* warm sand */
  --dark: #141413;          /* warm near-black */

  /* Text — warm neutrals */
  --ink: #141413;
  --ink-soft: #4d4c48;      /* charcoal warm */
  --muted: #87867f;         /* stone gray */

  /* Brand — terracotta */
  --brand: #c96442;
  --brand-deep: #a8502f;
  --brand-tint: #f7ede6;
  --accent: #d97757;        /* coral — links on light */
  --accent-tint: #f9f1ec;

  /* Lines & borders — cream/warm */
  --line: #e8e6dc;
  --line-soft: #f0eee6;

  /* Semantic */
  --danger: #b53333;
  --focus: #3898ec;
  --author-bg: #fbf3e0;
  --author-line: #e2c876;

  /* Type */
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* Depth */
  --ring: 0 0 0 1px;
  --whisper: rgba(20, 20, 19, 0.05) 0 4px 24px;

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* ── Compatibility layer ──────────────────────────────────────────────
     Pre-v2 local tool styles referenced these token names. Kept mapped to
     v2 values so tool pages inherit the warm system without per-page edits. */
  --s-1: 8px;
  --s-2: 16px;
  --s-3: 24px;
  --s-4: 32px;
  --s-5: 40px;
  --s-6: 48px;
  --s-7: 56px;
  --s-8: 64px;
  --t-xs: 13px;
  --t-sm: 15px;
  --t-base: 17px;
  --t-body: 18px;
  --t-lg: 21px;
  --t-xl: 26px;
  --t-2xl: 34px;
  --t-3xl: 48px;
  --t-4xl: 60px;
  --shadow-sm: 0 1px 2px rgba(20, 20, 19, 0.05);
  --shadow-soft: 0 1px 2px rgba(20, 20, 19, 0.04), 0 8px 24px rgba(20, 20, 19, 0.08);
  --wrap: 1120px;
  --wrap-narrow: 760px;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; }
a { color: var(--brand-deep); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(200, 100, 66, 0.35); }
a:hover { color: var(--brand); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(2.4rem, 5.5vw, 3.9rem); line-height: 1.06; }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); line-height: 1.12; }
h3 { font-size: clamp(1.25rem, 2vw, 1.55rem); }
p { margin: 0 0 1em; }

/* ---------- Layout ---------- */
.s-wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.s-section { padding: 88px 0; }
.s-section--alt { background: var(--surface); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.s-section--dark {
  background: var(--dark);
  color: #b0aea5;
}
.s-section--dark h2, .s-section--dark h3 { color: #faf9f5; }
.s-eyebrow {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  margin: 0 0 16px;
}
.s-lede { font-size: 20px; line-height: 1.6; color: var(--ink-soft); max-width: 44em; }

/* ---------- Header ---------- */
.s-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245, 244, 237, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.s-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 68px; }
.s-wordmark {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.s-wordmark:hover { color: var(--ink); }
.s-nav { display: flex; align-items: center; gap: 4px; }
.s-nav-link {
  font-size: 15.5px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--r-sm);
}
.s-nav-link:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.s-nav-link[aria-current="page"], .s-nav-link.is-active { color: var(--ink); background: var(--surface-2); }
.s-nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px; font-size: 15px; cursor: pointer; color: var(--ink); }

/* ---------- Buttons ---------- */
.s-btn {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  padding: 13px 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}
.s-btn:active { transform: scale(0.98); }
.s-btn-primary { background: var(--brand); color: #faf9f5; }
.s-btn-primary:hover { background: var(--brand-deep); color: #fff; text-decoration: none; }
.s-btn-secondary { background: var(--surface-2); color: #4d4c48; box-shadow: var(--ring) var(--line); }
.s-btn-secondary:hover { background: #e5e1d3; color: var(--ink); text-decoration: none; }
.s-btn-dark { background: var(--dark); color: #faf9f5; }
.s-btn-dark:hover { background: #262624; color: #fff; text-decoration: none; }
.s-btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.s-btn-ghost:hover { background: var(--surface-2); text-decoration: none; }
.s-btn-lg { font-size: 17px; padding: 15px 24px; border-radius: 12px; }
.s-header-cta { font-size: 14.5px; padding: 10px 16px; border-radius: 8px; }

/* ---------- Cards ---------- */
.s-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: var(--whisper);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.s-card:hover { transform: translateY(-2px); box-shadow: var(--whisper), var(--ring) var(--line-soft); }
.s-card h3 { margin-bottom: 10px; }
.s-card p { color: var(--ink-soft); margin-bottom: 0; }
.s-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-top: 32px; }
.s-card-link { text-decoration: none; color: inherit; display: block; }
.s-card-link:hover { text-decoration: none; color: inherit; }
.s-card-arrow { color: var(--brand); font-weight: 600; display: inline-block; margin-top: 14px; }
.s-card:hover .s-card-arrow { text-decoration: underline; text-underline-offset: 3px; }
.s-card-num {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

/* ---------- Editorial index (three ways in) ---------- */
.s-index { list-style: none; margin: 40px 0 0; padding: 0; }
.s-index li {
  border-top: 1px solid var(--line);
  padding: 28px 4px;
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 24px;
  align-items: start;
}
.s-index li:last-child { border-bottom: 1px solid var(--line); }
.s-index-num { font-family: var(--font-serif); font-size: 28px; color: var(--brand); line-height: 1; }
.s-index h3 { margin-bottom: 6px; }
.s-index p { color: var(--ink-soft); max-width: 46em; margin-bottom: 0; }
.s-index-link { font-weight: 600; color: var(--brand-deep); white-space: nowrap; padding-top: 6px; }

/* ---------- Boundary / author / crisis ---------- */
.s-boundary {
  background: var(--brand-tint);
  border: 1px solid rgba(201, 100, 66, 0.25);
  border-left: 4px solid var(--brand);
  border-radius: var(--r-md);
  padding: 24px 28px;
}
.s-boundary h2, .s-boundary h3 { margin-bottom: 8px; }
.s-boundary p { color: var(--ink-soft); margin-bottom: 0; }
.s-boundary p + p { margin-top: 8px; }
.s-author-note {
  background: var(--author-bg);
  border: 1px solid var(--author-line);
  border-radius: var(--r-md);
  padding: 14px 18px;
  font-size: 15px;
  color: #6b5a1e;
  margin: 18px 0;
}
.s-author-note::before { content: "AUTHOR ACTION NEEDED — "; font-weight: 700; }
.s-crisis { background: var(--dark); color: #b0aea5; border-radius: var(--r-xl); padding: 32px 36px; }
.s-crisis h2, .s-crisis h3 { color: #faf9f5; }
.s-crisis .s-crisis-nums { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.s-crisis .s-crisis-nums span {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 15px;
  color: #faf9f5;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 8px 14px;
  border-radius: 999px;
}

/* ---------- Forms ---------- */
.s-form label { display: block; font-size: 15px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.s-form input[type="email"], .s-form input[type="text"], .s-form textarea, .s-form select {
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
  width: 100%;
}
.s-form input:focus, .s-form textarea:focus, .s-form select:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: transparent; }
.s-form .s-field { margin-bottom: 18px; }
.s-form-hint { font-size: 14px; color: var(--muted); margin-top: 6px; }

/* ---------- Tables ---------- */
.s-table { width: 100%; border-collapse: collapse; font-size: 16px; }
.s-table th, .s-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.s-table th { font-weight: 600; color: var(--ink-soft); font-size: 14.5px; letter-spacing: 0.02em; }

/* ---------- Misc ---------- */
.s-badge {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--brand-deep);
  background: var(--brand-tint);
  border-radius: 999px;
  padding: 4px 12px;
}
.s-breadcrumb { font-size: 14.5px; color: var(--muted); padding: 18px 0 0; }
.s-breadcrumb a { color: var(--ink-soft); text-decoration: none; }
.s-breadcrumb a:hover { color: var(--brand-deep); text-decoration: underline; }
.s-progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.s-progress > div { height: 100%; background: var(--brand); border-radius: 999px; transition: width 0.3s ease; }

/* ---------- Footer ---------- */
.s-footer { background: var(--dark); color: #a3a29b; padding: 56px 0 32px; margin-top: 0; }
.s-footer h3 { color: #faf9f5; font-size: 16px; font-family: var(--font-sans); font-weight: 600; letter-spacing: 0.02em; margin-bottom: 14px; }
.s-footer a { color: #b0aea5; text-decoration: none; }
.s-footer a:hover { color: #fff; text-decoration: underline; }
.s-footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; }
.s-footer-boundary { font-size: 14.5px; color: #87867f; max-width: 30em; }
.s-footer-crisis { font-size: 14.5px; color: #b0aea5; }
.s-footer-crisis strong { color: #faf9f5; }
.s-footer ul { list-style: none; margin: 0; padding: 0; }
.s-footer li { margin-bottom: 8px; font-size: 15px; }
.s-footer-bottom { border-top: 1px solid #262624; margin-top: 40px; padding-top: 20px; font-size: 13.5px; color: #6f6e68; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ---------- Print ---------- */
@media print {
  .s-header, .s-footer, .s-breadcrumb, .no-print, .s-nav-toggle { display: none !important; }
  body { background: #fff; font-size: 14px; }
  a { color: inherit; text-decoration: none; }
  @page { size: A4; margin: 15mm; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .s-nav { display: none; position: absolute; top: 68px; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; padding: 12px 24px 20px; }
  .s-nav.open { display: flex; }
  .s-nav-link { padding: 12px 8px; }
  .s-nav-toggle { display: inline-block; }
  .s-header-cta { display: none; }
  .s-footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .s-index li { grid-template-columns: 48px 1fr; }
  .s-index-link { grid-column: 2; white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
