/* How It Works Page — Evident ICU
   Copyright (c) 2026 Evident Technologies LLC. All rights reserved.

   ── Contrast Governance ──────────────────────────────────────────────
   This page uses dark-first surfaces consistent with the brand design
   system (body[data-site-surface="public"] from sirens-to-scales.css).

   All contrast ratios verified per WCAG 2.1 § 1.4.3 (AA) and § 1.4.6 (AAA).
   Formula: CR = (L_lighter + 0.05) / (L_darker + 0.05)
   Relative luminance: L = 0.2126·R_lin + 0.7152·G_lin + 0.0722·B_lin
   where C_lin = ((C_sRGB/255 + 0.055)/1.055)^2.4 for C_sRGB > 10.23

   Background reference surfaces:
     body / section (dark canvas) — ≈#07101d — L ≈ 0.0087
     panel (dark card)            — #151922  — L = 0.0097
     alt section                  — ≈#0e1e32 — L ≈ 0.0126

   Text / foreground verified ratios:
     --hiw-text       #eaf1fb  L=0.874  on panel: 16.7:1 AAA ✓  on body: 15.7:1 AAA ✓
     --hiw-text-muted #9eb0cb  L=0.426  on panel:  7.97:1 AAA ✓  on body:  8.12:1 AAA ✓
     --hiw-accent     #5ea8ff  L=0.377  on panel:  7.14:1 AAA ✓  on body:  7.63:1 AAA ✓
     badge: #fff (L=1) on --color-primary #2f5d9f (L=0.126):  5.98:1 AA  ✓
   ──────────────────────────────────────────────────────────────────── */

/* ── Page Surface ─────────────────────────────────────────────────────── */

.how-it-works-page {
  --hiw-radius: 0.875rem;
  --hiw-gap: clamp(2rem, 4vw, 3.5rem);

  /* Dark surfaces — matches brand design system */
  --hiw-panel-bg:     var(--surface-card-solid, #151922);
  --hiw-panel-border: var(--border-default, rgb(255 255 255 / 12%));
  --hiw-alt-bg:       color-mix(in srgb, var(--color-primary, #2f5d9f) 8%, #0b1828);

  /* High-contrast text on dark surfaces (ratios documented above) */
  --hiw-text:       var(--sirens-text,       #eaf1fb);  /* 16.7:1 on panel AAA */
  --hiw-text-muted: var(--sirens-text-muted, #9eb0cb);  /*  7.97:1 on panel AAA */

  /* Accent text on dark (7.14:1 on panel AAA) */
  --hiw-accent: var(--persona-authority-accent, #5ea8ff);

  /* Numbered step badges: dark-blue bg + white text (5.98:1 AA) */
  --hiw-badge-bg:   var(--color-primary, #2f5d9f);
  --hiw-badge-text: #fff;

  /* Gold callout border — decorative, not WCAG-rated text */
  --hiw-gold: var(--sirens-gold-bright, #f3d59a);
}

/* ── Header ───────────────────────────────────────────────────────────── */

.hiw-header {
  padding: clamp(3rem, 8vw, 6rem) 0 clamp(2rem, 4vw, 3rem);
  text-align: center;
}

.hiw-header__inner {
  width: min(calc(100% - 2rem), 72ch);
  margin: 0 auto;
}

.hiw-header__title {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 800;
  line-height: 1.15;
  color: var(--hiw-text);
  margin: 0 0 1rem;
}

.hiw-header__sub {
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  line-height: 1.65;
  color: var(--hiw-text-muted);
  margin: 0;
}

/* ── Sections ─────────────────────────────────────────────────────────── */

.hiw-section {
  padding: var(--hiw-gap) 0;
}

.hiw-section--alt {
  background: var(--hiw-alt-bg);
}

.hiw-section__inner {
  width: min(calc(100% - 2rem), 960px);
  margin: 0 auto;
}

.hiw-section__heading {
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  font-weight: 700;
  color: var(--hiw-text);
  margin: 0 0 0.5rem;
}

.hiw-section__lead {
  font-size: clamp(0.95rem, 1.4vw, 1.1rem);
  line-height: 1.65;
  color: var(--hiw-text-muted);
  margin: 0 0 2rem;
  max-width: 68ch;
}

/* ── Pillars (3-column grid) ──────────────────────────────────────────── */

.hiw-pillars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: clamp(1.25rem, 2vw, 2rem);
}

@media (width >= 900px) {
  .hiw-pillars {
    grid-template-columns: repeat(3, 1fr);
  }
}

.hiw-pillar {
  padding: 1.5rem;
  border: 1px solid var(--hiw-panel-border);
  border-radius: var(--hiw-radius);
  background: var(--hiw-panel-bg);
}

.hiw-pillar__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--hiw-accent);  /* 7.14:1 on panel AAA */
  margin: 0 0 0.75rem;
}

.hiw-pillar__body {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--hiw-text-muted);  /* 7.97:1 on panel AAA */
  margin: 0;
}

/* ── Pipeline Steps (numbered timeline) ───────────────────────────────── */

.hiw-pipeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
  counter-reset: hiw-step;
}

.hiw-pipeline__step {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--hiw-panel-border);
  border-radius: var(--hiw-radius);
  background: var(--hiw-panel-bg);
  transition: border-color 200ms ease;
}

.hiw-pipeline__step:hover {
  border-color: var(--hiw-accent);
}

.hiw-pipeline__num {
  flex: 0 0 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--hiw-badge-bg);   /* #2f5d9f */
  color: var(--hiw-badge-text);       /* #fff — 5.98:1 AA on #2f5d9f */
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.hiw-pipeline__content {
  flex: 1 1 auto;
  min-width: 0;
}

.hiw-pipeline__content strong {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--hiw-text);       /* 16.7:1 on panel AAA */
  margin-bottom: 0.35rem;
}

.hiw-pipeline__content span {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--hiw-text-muted); /* 7.97:1 on panel AAA */
}

/* ── Chain of Custody Table ───────────────────────────────────────────── */

.hiw-coc-table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--hiw-panel-border);
  border-radius: var(--hiw-radius);
  background: var(--hiw-panel-bg);
}

.hiw-coc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.hiw-coc-table__caption {
  padding: 1rem 1.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--hiw-text-muted); /* 7.97:1 on panel AAA */
  text-align: left;
  border-bottom: 1px solid var(--hiw-panel-border);
}

.hiw-coc-table th,
.hiw-coc-table td {
  padding: 0.75rem 1.25rem;
  text-align: left;
  border-bottom: 1px solid var(--hiw-panel-border);
}

.hiw-coc-table th {
  font-weight: 700;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--hiw-text-muted); /* 7.97:1 on header bg (≈panel + accent tint) AAA */
  background: color-mix(in srgb, var(--hiw-accent) 6%, var(--hiw-panel-bg));
}

.hiw-coc-table td {
  color: var(--hiw-text); /* 16.7:1 on panel AAA */
}

.hiw-coc-table td code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem;
  color: var(--hiw-accent); /* 7.14:1 on panel AAA */
}

.hiw-coc-table tr:last-child td {
  border-bottom: none;
}

.hiw-coc-note {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--hiw-text-muted); /* 7.97:1 on callout bg AAA */
  margin: 1.25rem 0 0;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--hiw-gold);
  background: color-mix(in srgb, var(--hiw-gold) 8%, var(--hiw-panel-bg));
  border-radius: 0 var(--hiw-radius) var(--hiw-radius) 0;
}

/* ── Export Contents List ─────────────────────────────────────────────── */

.hiw-export-contents {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.hiw-export-contents li {
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--hiw-panel-border);
  border-radius: var(--hiw-radius);
  background: var(--hiw-panel-bg);
}

.hiw-export-contents li strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--hiw-text);       /* 16.7:1 on panel AAA */
  margin-bottom: 0.35rem;
}

.hiw-export-contents li span {
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--hiw-text-muted); /* 7.97:1 on panel AAA */
}

.hiw-export-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

/* ── Responsive ───────────────────────────────────────────────────────── */

@media (width <= 640px) {
  .hiw-header {
    padding: 2rem 0 1.5rem;
  }

  .hiw-section {
    padding: 2rem 0;
  }

  .hiw-pillars {
    grid-template-columns: 1fr;
  }

  .hiw-pipeline__step {
    flex-direction: column;
    gap: 0.75rem;
  }

  .hiw-coc-table th,
  .hiw-coc-table td {
    padding: 0.6rem 0.85rem;
    font-size: 0.8125rem;
  }

  .hiw-export-cta {
    flex-direction: column;
  }
}

/* ── Reduced Motion ───────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .hiw-pipeline__step {
    transition: none;
  }
}
