/* Gov2 Civic Editorial Design System - Zero inline styles (strict CSP compliant) */
:root {
  --bg: #0b191e;
  --bg-alt: #0f2128;
  --surface: #142b34;
  --surface-raised: #193540;
  --ink: #edf4f5;
  --muted: #9ec0c7;
  --border: #274d5a;
  --accent: #2dd4bf;
  --accent-ink: #06201d;
  --accent-soft: rgba(45, 212, 191, 0.14);
  --accent2: #fbbf24;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.30);
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  overflow-x: hidden;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.75rem 1.25rem;
  z-index: 100;
  font-weight: 600;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
}

.wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 68px;
  flex-wrap: wrap;
  padding: 0.5rem 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  flex-shrink: 0;
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-left: 1px solid var(--border);
  padding-left: 0.65rem;
}
.nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}
.nav a:hover, .nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--accent-soft);
}

/* Hero */
.hero {
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.95fr);
  gap: 2.25rem;
  align-items: center;
}
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  margin: 0 0 1rem;
}
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--ink);
  line-height: 1.2;
  margin-top: 0;
}
h1 {
  font-size: clamp(2rem, 4vw, 3.1rem);
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}
.hero-lead {
  font-size: 1.12rem;
  color: var(--muted);
  max-width: 62ch;
  margin: 0 0 1.5rem;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.7rem 1.15rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}
.btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.btn-primary:hover {
  filter: brightness(1.06);
}
.btn-sm {
  padding: 0.45rem 0.8rem;
  font-size: 0.85rem;
  border-radius: 8px;
}
.btn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.hero-diagram-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.hero-diagram-card svg {
  width: 100%;
  height: auto;
  display: block;
}
.diagram-caption {
  margin: 0.75rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
  text-align: center;
}

/* Sections */
.section {
  padding: 2.75rem 0;
  border-bottom: 1px solid var(--border);
}
.section-alt {
  background: var(--bg-alt);
}
.section-head {
  margin-bottom: 1.75rem;
  max-width: 72ch;
}
.section-head h2 {
  font-size: clamp(1.5rem, 2.5vw, 2.1rem);
  margin-bottom: 0.5rem;
}
.section-head p {
  margin: 0;
  color: var(--muted);
}

/* Workbench & Cards */
.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 1.5rem;
  align-items: start;
}
.workbench-single {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.4rem;
  box-shadow: var(--shadow);
  min-width: 0;
}
.workbench > *, .grid-2 > *, .grid-3 > *, .grid-4 > *, .footer-grid > * {
  min-width: 0;
}
.card-raised {
  background: var(--surface-raised);
}
.card h3 {
  font-size: 1.22rem;
  margin-bottom: 0.65rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

/* Controls & Forms */
.field {
  margin-bottom: 1rem;
}
.field label, .field-label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.35rem;
}
.field-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.25rem 0 0;
}
input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.94rem;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
textarea {
  min-height: 110px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.5;
}
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.check-list {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1rem;
}
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.9rem;
  cursor: pointer;
}
.check-item input[type="checkbox"] {
  margin-top: 0.25rem;
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Metrics / KPI strip (deterministic math outputs only) */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.15rem;
}
.stat-box {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  display: block;
}
.stat-value {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--ink);
  display: block;
  margin-top: 0.2rem;
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  border: 1px solid var(--border);
}
.badge-ok {
  color: var(--ok);
  border-color: var(--ok);
  background: var(--accent-soft);
}
.badge-warn {
  color: var(--warn);
  border-color: var(--warn);
}
.badge-bad {
  color: var(--bad);
  border-color: var(--bad);
}

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  text-align: left;
}
th, td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--bg-alt);
}
tr:last-child td {
  border-bottom: 0;
}

/* Output document & bars */
.doc-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.83rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 440px;
  overflow-y: auto;
  margin-bottom: 1rem;
}
.bar-track {
  width: 100%;
  height: 10px;
  background: var(--bg-alt);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.2s ease;
}
.bar-fill-alt {
  background: var(--accent2);
}

.status-note {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent);
  min-height: 1.25rem;
}

/* Timer & Debate specific helpers */
.clock-display {
  font-family: var(--font-mono);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  margin: 0.35rem 0;
}
.phase-list {
  display: grid;
  gap: 0.45rem;
  margin-top: 1rem;
}
.phase-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: var(--ink);
}
.phase-item[aria-current="step"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

/* FAQ */
.faq-list {
  display: grid;
  gap: 0.85rem;
}
details.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.2rem;
}
details.faq-item summary {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
}
details.faq-item p {
  margin: 0.75rem 0 0;
  color: var(--muted);
}

/* Footer */
.site-footer {
  padding: 2.5rem 0 3rem;
  background: var(--bg-alt);
}
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.5fr);
  gap: 2rem;
  align-items: start;
}
.footer-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}
.footer-link-card {
  display: block;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  text-decoration: none;
  color: var(--ink);
}
.footer-link-card:hover {
  border-color: var(--accent);
}
.footer-link-card strong {
  display: block;
  font-size: 0.88rem;
}
.footer-link-card span {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
}
.footer-meta {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.84rem;
  color: var(--muted);
}
.footer-meta a {
  color: var(--accent);
  text-decoration: none;
}
.footer-meta a:hover {
  text-decoration: underline;
}

.row-inline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
}
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }

@media (max-width: 900px) {
  .hero-grid,
  .workbench,
  .grid-3,
  .grid-4,
  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
  .footer-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .footer-links {
    grid-template-columns: minmax(0, 1fr);
  }
  .brand-sub {
    display: none;
  }
}
