:root {
  --bg: #eef2f1;
  --surface: #ffffff;
  --ink: #16252e;
  --muted: #4e5d66;
  --line: #c9d3d2;
  --accent: #1f6b5a;
  --accent-hover: #185646;
  --on-accent: #ffffff;
  --tape: #d9a21b;
  --danger: #b3261e;
  --focus: #1f6b5a;

  --font: "Avenir Next", Avenir, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;

  --measure: 38rem;
  --radius-sm: 4px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10181d;
    --surface: #172229;
    --ink: #e6edef;
    --muted: #a3b1b8;
    --line: #2e3c44;
    --accent: #5fc4a8;
    --accent-hover: #7fd4bc;
    --on-accent: #0b1a16;
    --tape: #e8b64a;
    --danger: #f2b8b5;
    --focus: #7fd4bc;
  }
}

.theme-dark {
  --bg: #0d1418;
  --surface: #152026;
  --ink: #e6edef;
  --muted: #9aa9b0;
  --line: #2a3840;
  --accent: #5fc4a8;
  --accent-hover: #7fd4bc;
  --on-accent: #0b1a16;
  --tape: #e8b64a;
  --danger: #f2b8b5;
  --focus: #7fd4bc;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

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

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--accent-hover); }

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

h1, h2, h3 { line-height: 1.15; margin: 0; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.3rem); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 1.0625rem; font-weight: 600; }
p { margin: 0; }

.env-banner {
  background: var(--tape);
  color: #1b1403;
  text-align: center;
  font-weight: 600;
  font-size: 0.9375rem;
  padding: 0.5rem 1rem;
  margin: 0;
}

/* ---------- Header and footer ---------- */

.site-header,
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}

.brand {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  font-size: 1.125rem;
}

.header-nav {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
}

.header-link { font-size: 0.9375rem; }

.link-button {
  font: inherit;
  font-size: 0.9375rem;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.link-button:hover { color: var(--accent-hover); }

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 4rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* ---------- Landing hero ---------- */

main { max-width: 72rem; margin: 0 auto; padding: 0 1.5rem; }

.hero {
  display: grid;
  gap: 3rem;
  align-items: start;
  padding: 3rem 0 4rem;
}

.hero-copy { max-width: var(--measure); display: grid; gap: 1.25rem; }
.lede { font-size: 1.25rem; color: var(--ink); }
.hero-copy p:not(.lede) { color: var(--muted); }

@media (min-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    align-items: center;
    padding-top: 4.5rem;
  }
  .label-card { justify-self: end; }
}

/* The access box is styled like a moving-box shipping label. */
.label-card {
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  border-top: 14px solid var(--tape);
  max-width: 28rem;
  width: 100%;
}

.label-route {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 2px solid var(--ink);
}

.route-stop { padding: 0.875rem 1.125rem; display: grid; gap: 0.125rem; }
.route-stop + .route-stop { border-left: 2px solid var(--ink); }
.route-key { font-size: 0.8125rem; color: var(--muted); }
.route-value { font-weight: 700; line-height: 1.25; }

.label-body { padding: 1.25rem 1.125rem 1.375rem; display: grid; gap: 0.75rem; }
.label-title { font-size: 1.125rem; }
.label-body p { color: var(--muted); }

.code-label { font-weight: 600; }

.gate-card .code-input {
  font-family: var(--mono);
  font-size: 1.5rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  width: 100%;
}

.gate-card .code-input::placeholder { color: var(--muted); opacity: 0.6; }
.gate-card .code-input[aria-invalid="true"] { border-color: var(--danger); }

.button {
  font: inherit;
  font-weight: 600;
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  justify-self: start;
  transition: background-color 120ms ease;
}

.button:hover { background: var(--accent-hover); color: var(--on-accent); }
a.button { text-decoration: none; display: inline-block; }
.button-block { justify-self: stretch; width: 100%; }
.button:disabled { opacity: 0.6; cursor: progress; }

.hint { font-size: 0.875rem; color: var(--muted); }

.error {
  font-size: 0.9375rem;
  color: var(--danger);
  font-weight: 600;
}
.error:empty { display: none; }

/* Hidden trap field for bots. */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- Private key page ---------- */

.gate-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.gate {
  flex: 1;
  display: grid;
  place-items: center;
  width: 100%;
  padding: 3rem 1.25rem;
}

.gate-card {
  width: 100%;
  max-width: 26rem;
  display: grid;
  gap: 0.75rem;
  padding: 2rem 1.75rem 1.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--tape);
  border-radius: 8px;
}

.gate-lock { color: var(--tape); }

.gate-card h1 {
  font-size: 1.75rem;
  letter-spacing: -0.015em;
}

.gate-lede {
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.gate-footnote {
  font-size: 0.875rem;
  color: var(--muted);
  text-align: center;
  margin-top: 0.25rem;
}

.gate-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

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

.band {
  border-top: 1px solid var(--line);
  padding: 3rem 0;
  display: grid;
  gap: 2rem;
}

@media (min-width: 900px) {
  .band { grid-template-columns: 16rem 1fr; gap: 3rem; }
}

.scope {
  margin: 0;
  display: grid;
  gap: 1.75rem 3rem;
}

@media (min-width: 700px) {
  .scope { grid-template-columns: 1fr 1fr; }
}

.scope dt { font-weight: 600; margin-bottom: 0.25rem; }
.scope dd { margin: 0; color: var(--muted); max-width: 30rem; }

.steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  column-gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.steps li:first-child { padding-top: 0; }

.steps li::before {
  content: counter(step);
  grid-row: span 2;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--accent);
}

.steps p { color: var(--muted); }

/* ---------- Intake form ---------- */

.intake { max-width: 52rem; }

.intake-intro {
  display: grid;
  gap: 1rem;
  padding: 3rem 0 2rem;
  max-width: var(--measure);
}

.prepared { font-weight: 600; color: var(--accent); }

.notice {
  border-left: 4px solid var(--tape);
  padding: 0.5rem 0 0.5rem 1rem;
  font-size: 0.9375rem;
}

#intake-form { display: grid; gap: 1.5rem; }

fieldset {
  margin: 0;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

legend {
  font-weight: 700;
  font-size: 1.125rem;
  padding: 0 0.5rem;
  margin-left: -0.5rem;
}

.grid { display: grid; gap: 1.25rem 1.5rem; }

@media (min-width: 700px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .field.wide { grid-column: 1 / -1; }
}

.field { display: grid; gap: 0.375rem; align-content: start; }

.field > label,
.group-label { font-weight: 600; font-size: 0.9375rem; }

.req {
  font-weight: 400;
  font-size: 0.8125rem;
  color: var(--muted);
  margin-left: 0.25rem;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
select,
textarea {
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.625rem;
  width: 100%;
}

input:hover, select:hover, textarea:hover { border-color: var(--muted); }
textarea { resize: vertical; }

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.choices label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9375rem;
}

.choices input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }

.submit-row {
  display: grid;
  gap: 0.75rem;
  justify-items: start;
  padding-bottom: 1rem;
}

.thanks {
  background: var(--surface);
  border: 2px solid var(--ink);
  border-top: 14px solid var(--tape);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  display: grid;
  gap: 0.75rem;
  max-width: var(--measure);
}

.not-found { padding: 5rem 1.5rem; display: grid; gap: 1rem; max-width: var(--measure); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
