/*
 * BLC public site. One stylesheet. Nothing is imported or fetched from another origin.
 * Tokens follow the D3 shell: blue --accent, red --bad, --dim, dark --bg.
 * Dark is the default. Light follows the OS (prefers-color-scheme) unless the visitor chose a theme with the switch.
 * Every foreground/background pair used below meets WCAG AA (ratios are recorded in coding-rubric.md).
 */

:root {
  color-scheme: dark;
  --bg: #1b1f24;
  --surface: #22272e;
  --line: #444c56;
  --text: #cdd9e5;
  --dim: #909dab;
  --accent: #4aa3df;
  --accent-strong: #1f6feb;
  --on-strong: #ffffff;
  --bad: #ff7b72;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 6px;
  --max: 72rem;
  --gutter: 1.25rem;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #ffffff;
    --surface: #f6f8fa;
    --line: #d0d7de;
    --text: #1f2328;
    --dim: #59636e;
    --accent: #0969da;
    --accent-strong: #0550ae;
    --bad: #cf222e;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #f6f8fa;
  --line: #d0d7de;
  --text: #1f2328;
  --dim: #59636e;
  --accent: #0969da;
  --accent-strong: #0550ae;
  --bad: #cf222e;
}

/* ---------- base ---------- */

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

[hidden] { display: none !important; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.75rem; color: var(--text); }
h1 { font-size: clamp(2rem, 6vw, 3.25rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); letter-spacing: -0.01em; }
h3 { font-size: 1.2rem; }
p, ul, ol { margin: 0 0 1rem; }
ul, ol { padding-left: 1.25rem; }
li { margin-bottom: 0.4rem; }
strong { font-weight: 650; }
code { font-family: var(--mono); font-size: 0.95em; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 10;
  padding: 0.5rem 0.9rem;
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
}
.skip-link:focus { top: 0.5rem; }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- header ---------- */

.site-header {
  background: var(--surface);
  border-top: 3px solid var(--bad);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
}
.brand svg { width: 1.9rem; height: 1.9rem; flex: none; }
.mark-ring { fill: none; stroke: var(--bad); stroke-width: 3; stroke-linecap: round; }
.mark-core { fill: var(--accent); }

.site-nav { flex: 1 1 auto; }
.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1.1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav li { margin: 0; }
.site-nav a { display: inline-block; padding: 0.35rem 0; }
.site-nav a[aria-current="page"] {
  color: var(--text);
  font-weight: 650;
  text-decoration-color: var(--bad);
  text-decoration-thickness: 3px;
}

.theme-toggle {
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--dim);
  border-radius: var(--radius);
  padding: 0.35rem 0.8rem;
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle[aria-pressed="true"] { background: var(--bg); border-color: var(--accent); }

/* ---------- sections ---------- */

main { display: block; }
section { padding: 2.5rem 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-intro { max-width: 46rem; color: var(--dim); font-size: 1.1rem; }

.eyebrow {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero { padding: 3rem 0 2.5rem; }
.hero .lead { max-width: 46rem; font-size: 1.2rem; }
.hero-note {
  display: inline-block;
  margin: 0 0 1.5rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--dim);
  border-left: 4px solid var(--bad);
  border-radius: var(--radius);
  font-weight: 600;
}

.page-head { padding: 2.5rem 0 1.5rem; border-bottom: 1px solid var(--line); }
.page-head .lead { max-width: 46rem; font-size: 1.15rem; margin-bottom: 0; }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.25rem; }
.btn {
  display: inline-block;
  padding: 0.65rem 1.2rem;
  border-radius: var(--radius);
  font-weight: 650;
  border: 2px solid var(--accent-strong);
}
.btn-primary { background: var(--accent-strong); color: var(--on-strong); }
.btn-primary:hover { border-color: var(--text); }
.btn-secondary { color: var(--accent); background: transparent; border-color: var(--dim); }
.btn-secondary:hover { border-color: var(--accent); }

/* ---------- cards ---------- */

.grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
}
.section-alt .card { background: var(--bg); }
.card h3 { margin-bottom: 0.5rem; }
.card p { color: var(--text); }
.card .more { margin: auto 0 0; padding-top: 0.5rem; }

/* ---------- steps (ported from the scaffold's step strip) ---------- */

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: 1fr; counter-reset: step; }
.steps li {
  position: relative;
  margin: 0;
  padding: 1rem 1.1rem 1rem 3.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  counter-increment: step;
}
.section-alt .steps li { background: var(--bg); }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0.9rem;
  top: 0.9rem;
  width: 1.8rem;
  height: 1.8rem;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--on-strong);
  background: var(--accent-strong);
  border-radius: 50%;
}
.steps strong { display: block; }

/* ---------- content blocks ---------- */

.prose { max-width: 46rem; }
.prose h2 { margin-top: 0; }
.prose h3 { margin-top: 1.75rem; }

.callout {
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--bad);
  border-radius: var(--radius);
}
.section-alt .callout { background: var(--bg); }
.callout p:last-child { margin-bottom: 0; }

.planned {
  display: inline-block;
  margin-right: 0.4rem;
  padding: 0.05rem 0.5rem;
  border: 1px solid var(--bad);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bad);
  vertical-align: 0.1em;
}

/* One record, two outputs */
.flow { display: grid; gap: 0.75rem; grid-template-columns: 1fr; margin: 1.5rem 0; padding: 0; list-style: none; }
.flow li {
  margin: 0;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.flow .flow-source { border-top: 3px solid var(--accent); }
.flow .flow-out { border-top: 3px solid var(--bad); }
.flow strong { display: block; margin-bottom: 0.25rem; }
.flow .flow-tag { display: block; font-size: 0.85rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); }

.roles { display: grid; gap: 0.75rem; grid-template-columns: 1fr; margin: 0; padding: 0; list-style: none; }
.roles li { margin: 0; padding: 0.9rem 1rem; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); background: var(--surface); }
.section-alt .roles li { background: var(--bg); }
.roles strong { display: block; }

.cta {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 6px solid var(--bad);
  border-radius: var(--radius);
}
.cta h2 { margin-bottom: 0.5rem; }
.cta p { max-width: 40rem; }

/* ---------- contact form, privacy dialog ---------- */

.form-wrap { max-width: 40rem; }
.form-field { margin: 0 0 1.25rem; }
.form-field label { display: block; margin-bottom: 0.3rem; font-weight: 650; }
.form-field input[type="text"], .form-field textarea {
  display: block;
  width: 100%;
  padding: 0.6rem 0.75rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--dim);
  border-radius: var(--radius);
}
.form-field textarea { resize: vertical; min-height: 8rem; }
.form-field input[aria-invalid="true"], .form-field textarea[aria-invalid="true"] { border: 2px solid var(--bad); }
.req { font-weight: 400; color: var(--dim); }
.hint { margin: 0.3rem 0 0; font-size: 0.95rem; color: var(--dim); }
.field-error { margin: 0.3rem 0 0; font-weight: 650; color: var(--bad); }
.field-error:empty { display: none; }
.form-consent { display: grid; grid-template-columns: auto 1fr; column-gap: 0.6rem; align-items: start; }
.form-consent input { margin: 0.4rem 0 0; width: 1.15rem; height: 1.15rem; }
.form-consent label { margin: 0; font-weight: 400; }
.form-consent .field-error { grid-column: 2; }
.form-status { margin: 0 0 1rem; font-weight: 650; }
.form-status:empty { display: none; }
.form-status.is-error { padding: 0.75rem 1rem; color: var(--bad); border: 1px solid var(--bad); border-left-width: 5px; border-radius: var(--radius); }
.form-status.is-ok { padding: 0.75rem 1rem; border: 1px solid var(--accent); border-left-width: 5px; border-radius: var(--radius); }
button.btn { font: inherit; font-weight: 650; cursor: pointer; }
button.btn:disabled { cursor: progress; opacity: 0.7; }

/* Honeypot: out of sight and out of the tab order, but still in the page for bots. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.privacy-dialog {
  width: min(44rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  padding: 1.25rem 1.5rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--dim);
  border-radius: var(--radius);
  overflow: auto;
}
.privacy-dialog::backdrop { background: rgba(0, 0, 0, 0.65); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.dialog-head h2 { margin: 0; }

/* ---------- footer ---------- */

.site-footer {
  margin-top: 2.5rem;
  padding: 2rem 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}
.site-footer .wrap { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
.site-footer p { margin: 0 0 0.4rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 0.3rem; }
.footer-name { font-weight: 700; color: var(--text); }
.footer-legal { color: var(--dim); }

/* ---------- wider screens ---------- */

@media (min-width: 48rem) {
  :root { --gutter: 2rem; }
  section { padding: 3.5rem 0; }
  .hero { padding: 4.5rem 0 3.5rem; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .flow { grid-template-columns: 1fr 1fr; }
  .flow .flow-wide { grid-column: 1 / -1; }
  .roles { grid-template-columns: repeat(2, 1fr); }
  .site-footer .wrap { grid-template-columns: 2fr 1fr 1fr; }
}

@media (min-width: 64rem) {
  .steps { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- motion and print ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media print {
  .site-header .theme-toggle, .skip-link, .actions { display: none; }
  body { background: #ffffff; color: #000000; }
  a { color: #000000; }
}
