:root {
  color-scheme: light;
  --ink: #17232d;
  --muted: #63727b;
  --line: #d6e0e2;
  --paper: #f5f7f4;
  --surface: #ffffff;
  --surface-alt: #e9f1ee;
  --teal: #197a78;
  --teal-dark: #105b5a;
  --rust: #ad5942;
  --gold: #b77b22;
  --danger: #a73742;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
}

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

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.site-nav,
.site-main,
.site-footer {
  width: min(1120px, calc(100% - 32px));
  min-width: 0;
  margin: 0 auto;
}

.site-nav {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: 0;
  text-decoration: none;
}

.site-links {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.site-links form { margin: 0; }

.site-links button,
.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--teal-dark);
  font: inherit;
  cursor: pointer;
}

.site-main { padding: 42px 0 72px; }

.page-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1, h2, h3, h4 { line-height: 1.15; }
h1 { margin: 0; font-size: 3.75rem; overflow-wrap: anywhere; }
h2 { margin: 0 0 14px; font-size: 1.55rem; }
h3 { margin: 0 0 10px; font-size: 1.08rem; }

.lede {
  max-width: 700px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.stack { display: grid; gap: 20px; }
.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.three-column { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.two-column > *, .three-column > * { min-width: 0; }

.card,
.notice,
.reading-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.card { padding: 22px; }
.card-alt { background: var(--surface-alt); }

.reading-item {
  display: grid;
  gap: 8px;
  padding: 18px 20px;
}

.reading-item strong { font-size: 1.05rem; }
.reading-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: 0.9rem; }

.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.button,
button.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  padding: 10px 15px;
  background: var(--teal);
  color: #ffffff;
  font: inherit;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.button:hover,
button.button:hover { background: var(--teal-dark); color: #ffffff; }
.button-secondary { background: var(--rust); }
.button-quiet { background: #e4ecea; color: var(--teal-dark); }

form p { margin: 0 0 15px; }
label { display: block; margin-bottom: 5px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #bfcdd0;
  border-radius: 6px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(25, 122, 120, 0.24);
  outline-offset: 2px;
}

.helptext { display: block; margin-top: 5px; color: var(--muted); font-size: 0.9rem; }
.errorlist { margin: 5px 0; padding: 0; color: var(--danger); list-style: none; }
.messages { display: grid; gap: 10px; margin: 0 0 24px; padding: 0; list-style: none; }
.messages li { padding: 12px 14px; border-left: 4px solid var(--gold); background: #fff8e8; }

dl { display: grid; grid-template-columns: minmax(130px, 0.4fr) minmax(0, 1fr); gap: 10px 20px; margin: 0; }
dt { color: var(--muted); font-weight: 700; }
dd { margin: 0; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 0; border-top: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
tr:first-child th, tr:first-child td { border-top: 0; }
td { color: var(--muted); }

.reading-section { margin-top: 20px; }
.technical-appendix { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 16px; }
.technical-appendix summary { color: var(--teal-dark); cursor: pointer; font-weight: 750; }
.technical-appendix pre {
  max-height: 480px;
  overflow: auto;
  margin: 14px 0 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  background: #f1f5f3;
  color: var(--ink);
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 20px 0 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer nav { display: flex; flex-wrap: wrap; gap: 14px; }

.preview-hero {
  margin: -42px 0 32px;
  padding: 42px 0 34px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-alt);
}

.preview-hero h1 {
  max-width: 780px;
  font-size: 3.75rem;
}

.preview-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.preview-workspace > * { min-width: 0; }

.preview-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.preview-form {
  position: sticky;
  top: 18px;
  padding: 22px;
}

.preview-field { margin: 0 0 16px; }
.preview-help { margin: 6px 0 0; color: var(--muted); font-size: 0.9rem; }

.preview-form details {
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
}

.preview-form summary { color: var(--ink); cursor: pointer; font-weight: 750; }

.preview-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.preview-output { overflow: hidden; }

.preview-heading {
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--line);
}

.preview-heading h2 { margin: 0; }
.preview-heading p { margin: 10px 0 0; color: var(--muted); }

.preview-section {
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.preview-section:last-child { border-bottom: 0; }
.preview-section h3 { margin-top: 0; color: var(--teal-dark); text-transform: uppercase; }

.preview-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.preview-metric {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f1f5f3;
}

.preview-metric b { display: block; color: var(--teal); font-size: 1.6rem; line-height: 1; }
.preview-metric span { display: block; margin-top: 6px; color: var(--muted); font-size: 0.9rem; }
.preview-empty { padding: 22px; color: var(--muted); }

@media (max-width: 720px) {
  .site-nav { align-items: flex-start; flex-direction: column; justify-content: center; padding: 12px 0; }
  .site-links { width: 100%; justify-content: flex-start; }
  .site-main { padding: 30px 0 48px; }
  .card { padding: 18px; }
  h1 { font-size: 2rem; }
  .two-column, .three-column { grid-template-columns: 1fr; }
  dl { grid-template-columns: 1fr; gap: 3px; }
  dd { margin-bottom: 10px; }
}

@media (max-width: 820px) {
  .preview-hero { margin-top: -30px; padding: 30px 0 28px; }
  .preview-hero h1 { font-size: 2.5rem; }
  .preview-workspace { grid-template-columns: 1fr; }
  .preview-form { position: static; }
  .preview-metric-grid { grid-template-columns: 1fr; }
}
