:root {
  --bg: #f3f0e9;
  --paper: #fffcf7;
  --ink: #142033;
  --muted: #3a4656;
  --line: #ddd4c8;
  --accent: #6e3b22;
  --navy: #142033;
  --navy-2: #24384f;
  --soft: #e7e1d6;
  --flag: #f8efe8;
  --max: 68rem;
  color-scheme: light;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-x: clip;
}

img { max-width: 100%; height: auto; }

h1, h2, h3, h4 {
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  line-height: 1.15;
  font-weight: 700;
}

h1 { font-size: clamp(2.05rem, 1.25rem + 2.8vw, 3.35rem); margin: 0 0 0.75rem; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.55rem, 1.2rem + 1vw, 2.1rem); margin: 0 0 0.75rem; }
h3 { font-size: 1.25rem; margin: 0 0 0.45rem; }
h4 { font-size: 1rem; margin: 0.8rem 0 0.3rem; font-family: "Segoe UI", system-ui, sans-serif; }

p { margin: 0 0 0.85rem; }

a { color: var(--accent); }
a:hover { color: var(--ink); }

.wrap { width: min(var(--max), calc(100% - 2rem)); margin-inline: auto; }

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  background: var(--paper);
  color: var(--ink);
  padding: 0.5rem 0.75rem;
  z-index: 40;
}
.skip-link:focus { top: 0.5rem; }

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 252, 247, 0.96);
  border-bottom: 1px solid var(--line);
  border-top: 3px solid var(--accent);
}

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "brand cta" "menu menu";
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0;
}

.brand {
  grid-area: brand;
  display: flex;
  gap: 0.65rem;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
  line-height: 1.15;
}
.header-cta { grid-area: cta; }
.nav-details { grid-area: menu; }
.desktop-nav { display: none; }

.nav-details summary {
  list-style: none;
  cursor: pointer;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  padding: 0 0.9rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
}
.nav-details summary::-webkit-details-marker { display: none; }

.site-nav { display: flex; flex-direction: column; gap: 0.15rem; padding-top: 0.35rem; }
.site-nav a {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  padding: 0 0.2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.7rem 1.05rem;
  background: var(--navy);
  color: #f4f1eb;
  text-decoration: none;
  font-weight: 650;
  border-radius: 4px;
  border: 2px solid var(--navy);
  cursor: pointer;
  font: inherit;
}
.button:hover { background: var(--navy-2); color: #f4f1eb; }
.button-small { min-height: 44px; padding: 0.45rem 0.8rem; font-size: 0.95rem; }
.button-inverse { background: #f4f1eb; color: var(--navy); border-color: #f4f1eb; }
.button-inverse:hover { background: #fff; color: var(--navy); }

.hero { padding: 2.25rem 0 1rem; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 1.75rem;
  align-items: start;
}
.kicker {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 0.55rem;
}
.lede { font-size: 1.12rem; max-width: 40rem; }
.fine { color: var(--muted); font-size: 0.95rem; }

.chat-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 1px 0 rgba(20, 32, 51, 0.04);
}
.chat-card h2 { font-size: 1.55rem; }
.disclosure { color: var(--muted); font-size: 0.95rem; }
.chat-log {
  list-style: none;
  margin: 0 0 0.8rem;
  padding: 0.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 16rem;
  overflow: auto;
}
.msg {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  max-width: 92%;
  white-space: pre-wrap;
}
.msg-assistant { background: #f7f4ee; border: 1px solid var(--line); align-self: flex-start; }
.msg-user { background: var(--navy); color: #f4f1eb; align-self: flex-end; }
.chat-card label, .prose label, .admin-block label { display: block; font-weight: 650; margin-bottom: 0.35rem; }
textarea, input[type="text"], input[type="password"], input[type="email"] {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid #c9bfb2;
  border-radius: 4px;
  padding: 0.7rem 0.75rem;
  margin-bottom: 0.75rem;
}
textarea { min-height: 6.5rem; resize: vertical; }
::placeholder { color: var(--muted); opacity: 1; }
.form-error { color: #6e3b22; font-weight: 650; }
.check { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 450; }
.check input { margin-top: 0.35rem; }
.email-fallback { margin: 0.8rem 0 0; font-size: 0.95rem; }
.scope-card, .card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem 1.05rem 1.1rem;
}
.scope-card { margin-top: 0.8rem; }
.closing { background: #f3e6dc; padding: 0.75rem 0.8rem; border-radius: 6px; }

.section { padding: 3.2rem 0; }
.section-alt { background: var(--soft); }
.section-head { max-width: 40rem; margin-bottom: 1.25rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 0.9rem; }
.card ul, .prose ul, .scope-card ul { margin: 0.2rem 0 0; padding-left: 1.1rem; }
.card li, .prose li { margin: 0.2rem 0; }
.card p:last-child { margin-bottom: 0; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9rem; }
.steps li {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.95rem 1rem 1rem 4.2rem;
  position: relative;
}
.steps li::before {
  content: counter(step, decimal-leading-zero);
  counter-increment: step;
  position: absolute;
  left: 0.9rem;
  top: 0.95rem;
  color: var(--accent);
  font-family: Georgia, serif;
  font-weight: 700;
}
.steps { counter-reset: step; }

.prompt, .cta-band { text-align: left; }
.cta-band {
  background: var(--navy);
  color: #f4f1eb;
  padding: 3rem 0;
}
.cta-band a { color: #f4f1eb; }
.cta-band .button-inverse { color: var(--navy); }

.crumbs { color: var(--muted); font-size: 0.92rem; margin-bottom: 0.8rem; }
.crumbs a { color: var(--muted); }
.prose { max-width: 42rem; }
.prose h2 { margin-top: 1.6rem; }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem 0 2rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.site-footer a { color: var(--ink); }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; margin-bottom: 0.6rem; }

.flag-block {
  border: 3px solid var(--accent);
  background: var(--flag);
  padding: 0.9rem 1rem;
  margin: 1rem 0;
}
.sow-block {
  white-space: pre-wrap;
  background: #fff;
  border: 1px solid var(--line);
  padding: 0.8rem;
  overflow: auto;
}
.not-found-figure { margin: 1rem 0 0; }
.after-steps { margin-top: 1.25rem; }
.not-found-grid { margin-top: 1.5rem; }
.card + .card, details.card { margin-top: 0.75rem; }
.grid .card { margin-top: 0; }
.not-found-figure img { border-radius: 8px; border: 1px solid var(--line); }

@media (max-width: 420px) {
  .header-inner {
    grid-template-columns: 1fr;
    grid-template-areas: "brand" "cta" "menu";
  }
  .header-cta, .header-cta.button { width: 100%; }
}

@media (min-width: 800px) {
  .section { padding: 4.5rem 0; }
  .steps { grid-template-columns: 1fr 1fr; }
}

section[id], .cta-band { scroll-margin-top: 6.5rem; }

@media (max-width: 420px) {
  section[id], .cta-band { scroll-margin-top: 12rem; }
}

@media (min-width: 960px) {
  .header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.75rem; }
  .desktop-nav { display: flex; margin-left: auto; align-items: center; gap: 0.1rem; }
  .desktop-nav a {
    min-height: 44px;
    display: flex;
    align-items: center;
    color: var(--ink);
    text-decoration: none;
    padding: 0 0.4rem;
    font-size: 0.92rem;
  }
  .nav-details { display: none; }
}

@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
