/* MilGrid website. Plain CSS, no framework, no external fonts or requests. */

:root {
  color-scheme: light;
  --bg: #f8fafc;
  --bg-2: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f4f7fb;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #475569;
  --line: #d5dde8;
  --line-strong: #b8c4d4;
  --accent: #0369a1;
  --accent-hover: #075985;
  --accent-soft: rgba(3, 105, 161, 0.09);
  --accent-2: #047857;
  --btn-bg: #0369a1;
  --btn-ink: #ffffff;
  --btn-hover: #075985;
  --screen-bg: #0b0f19;
  --screen-ink: #e2e8f0;
  --screen-dim: #94a3b8;
  --screen-accent: #22d3ee;
  --screen-ok: #34d399;
  --screen-line: #1e293b;
  --contour: rgba(3, 105, 161, 0.2);
  --grid-line: rgba(15, 23, 42, 0.055);
  --warn-bg: #fef3c7;
  --warn-ink: #713f12;
  --warn-line: #d97706;
  --danger: #b91c1c;
  --focus: #0369a1;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 10px 30px rgba(15, 23, 42, 0.07);
  --radius: 12px;
  --radius-sm: 8px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #0b0f19;
    --bg-2: #0f1626;
    --surface: #111a2c;
    --surface-2: #0e1626;
    --ink: #f1f5f9;
    --ink-2: #cbd5e1;
    --muted: #94a3b8;
    --line: #243148;
    --line-strong: #364a69;
    --accent: #38bdf8;
    --accent-hover: #7dd3fc;
    --accent-soft: rgba(56, 189, 248, 0.12);
    --accent-2: #34d399;
    --btn-bg: #22d3ee;
    --btn-ink: #04212a;
    --btn-hover: #67e8f9;
    --screen-bg: #060912;
    --contour: rgba(56, 189, 248, 0.2);
    --grid-line: rgba(148, 163, 184, 0.07);
    --warn-bg: #3b2a08;
    --warn-ink: #fde68a;
    --warn-line: #b45309;
    --danger: #f87171;
    --focus: #38bdf8;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f19;
  --bg-2: #0f1626;
  --surface: #111a2c;
  --surface-2: #0e1626;
  --ink: #f1f5f9;
  --ink-2: #cbd5e1;
  --muted: #94a3b8;
  --line: #243148;
  --line-strong: #364a69;
  --accent: #38bdf8;
  --accent-hover: #7dd3fc;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --accent-2: #34d399;
  --btn-bg: #22d3ee;
  --btn-ink: #04212a;
  --btn-hover: #67e8f9;
  --screen-bg: #060912;
  --contour: rgba(56, 189, 248, 0.2);
  --grid-line: rgba(148, 163, 184, 0.07);
  --warn-bg: #3b2a08;
  --warn-ink: #fde68a;
  --warn-line: #b45309;
  --danger: #f87171;
  --focus: #38bdf8;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* Night keeps the whole page red on black, like the app's night mode, so it does not spoil dark adaptation. */
:root[data-theme="night"] {
  color-scheme: dark;
  --bg: #000000;
  --bg-2: #0b0202;
  --surface: #140404;
  --surface-2: #0f0303;
  --ink: #f87171;
  --ink-2: #ef8f8f;
  --muted: #c25f5f;
  --line: #4a1212;
  --line-strong: #6b1a1a;
  --accent: #fca5a5;
  --accent-hover: #fecaca;
  --accent-soft: rgba(248, 113, 113, 0.12);
  --accent-2: #f87171;
  --btn-bg: #7f1d1d;
  --btn-ink: #fecaca;
  --btn-hover: #991b1b;
  --screen-bg: #000000;
  --screen-ink: #f87171;
  --screen-dim: #c25f5f;
  --screen-accent: #fca5a5;
  --screen-ok: #f87171;
  --screen-line: #4a1212;
  --contour: rgba(248, 113, 113, 0.22);
  --grid-line: rgba(248, 113, 113, 0.07);
  --warn-bg: #2a0707;
  --warn-ink: #fca5a5;
  --warn-line: #7f1d1d;
  --danger: #fca5a5;
  --focus: #fca5a5;
  --shadow: none;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
}

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

a:hover {
  color: var(--accent-hover);
  text-decoration-thickness: 2px;
}

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

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
  text-wrap: balance;
}

p {
  margin: 0 0 1em;
  text-wrap: pretty;
}

code,
kbd,
samp {
  font-family: var(--mono);
  font-size: 0.92em;
}

.wrap {
  width: min(1120px, 100% - 2rem);
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--btn-bg);
  color: var(--btn-ink);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
}

.skip:focus {
  top: 1rem;
}

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

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.4) blur(10px);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 4rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand:hover {
  color: var(--ink);
}

.brand img {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 0.5rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.5rem;
  margin-left: auto;
}

.nav a {
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.97rem;
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.tool-btn:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.tool-btn svg {
  width: 1.2rem;
  height: 1.2rem;
}

.menu-btn {
  display: none;
}

.no-js .menu-btn {
  display: none !important;
}

@media (max-width: 880px) {
  .site-header .wrap {
    flex-wrap: wrap;
    padding-block: 0.4rem;
  }

  .tools {
    margin-left: auto;
  }

  .menu-btn {
    display: inline-flex;
  }

  .nav {
    order: 3;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding-bottom: 0.5rem;
  }

  .js .nav[data-open="false"] {
    display: none;
  }

  .nav a {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--line);
  }
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 3rem;
  padding: 0.7rem 1.4rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 650;
  font-size: 1rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.btn-primary {
  background: var(--btn-bg);
  color: var(--btn-ink);
}

.btn-primary:hover {
  background: var(--btn-hover);
  color: var(--btn-ink);
}

.btn-quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-quiet:hover {
  background: var(--accent-soft);
  color: var(--ink);
}

.btn[aria-disabled="true"] {
  opacity: 0.6;
  pointer-events: none;
}

.btn svg {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
}

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

.section {
  padding-block: clamp(3.5rem, 8vw, 6.5rem);
}

.section.alt {
  background: var(--bg-2);
  border-block: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 0.9rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.section h2 {
  font-size: clamp(1.7rem, 1.1rem + 2.2vw, 2.45rem);
  max-width: 22ch;
}

.section .lead {
  max-width: 60ch;
  margin-top: 1rem;
  font-size: 1.15rem;
  color: var(--ink-2);
}

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

.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(3rem, 7vw, 6rem) clamp(3rem, 7vw, 5.5rem);
  border-bottom: 1px solid var(--line);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: -1px -1px;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--contour);
  -webkit-mask: url("contours.71d45b7d12.svg") center / cover no-repeat;
  mask: url("contours.71d45b7d12.svg") center / cover no-repeat;
  pointer-events: none;
}

.hero .wrap {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}

.hero h1 {
  font-size: clamp(2.35rem, 1.2rem + 4.6vw, 4.1rem);
  letter-spacing: -0.035em;
  max-width: 16ch;
}

.hero .sub {
  margin-top: 1.4rem;
  max-width: 54ch;
  font-size: 1.2rem;
  color: var(--ink-2);
}

.hero .cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 2rem;
}

.hero .fine {
  margin-top: 1.1rem;
  font-size: 0.93rem;
  color: var(--muted);
}

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

  .hero::before {
    opacity: 0.55;
  }
}

/* The readout looks like the app's coordinate bar but is real output of the same engine. */
.readout {
  background: var(--screen-bg);
  color: var(--screen-ink);
  border: 1px solid var(--screen-line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  font-family: var(--mono);
}

.readout-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.1rem;
  border-bottom: 1px solid var(--screen-line);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--screen-dim);
}

.readout-place {
  color: var(--screen-ink);
  font-weight: 600;
}

.readout-rows {
  margin: 0;
  padding: 0.4rem 0;
  list-style: none;
}

.readout-rows li {
  display: grid;
  grid-template-columns: 5.2rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.62rem 1.1rem;
}

.readout-rows li + li {
  border-top: 1px solid var(--screen-line);
}

.readout-rows .k {
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  color: var(--screen-dim);
}

.readout-rows .v {
  font-size: clamp(0.88rem, 0.8rem + 0.4vw, 1.05rem);
  color: var(--screen-ink);
  overflow-wrap: anywhere;
}

.readout-rows li.main .v {
  color: var(--screen-accent);
  font-weight: 600;
}

.readout-rows .datum {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0 0.4rem;
  border: 1px solid var(--screen-line);
  border-radius: 4px;
  font-size: 0.72rem;
  color: var(--screen-dim);
  vertical-align: 0.1em;
}

.readout-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.85rem 1.1rem 1rem;
  border-top: 1px solid var(--screen-line);
}

.chip {
  padding: 0.25rem 0.65rem;
  border: 1px solid var(--screen-line);
  border-radius: 999px;
  background: transparent;
  color: var(--screen-dim);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.chip:hover {
  color: var(--screen-ink);
}

.chip[aria-pressed="true"] {
  border-color: var(--screen-accent);
  color: var(--screen-accent);
}

.no-js .readout-foot {
  display: none;
}

.readings .chip {
  border-color: var(--line-strong);
  color: var(--ink-2);
}

.readings .chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.readings .chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-small {
  min-height: 2.5rem;
  padding: 0.4rem 1rem;
  font-size: 0.92rem;
}

@media (max-width: 880px) {
  .tools .btn {
    display: none;
  }
}

.readout-note {
  margin: 0.8rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

/* ---------- feature rows ---------- */

.feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}

.feature + .feature {
  margin-top: clamp(3.5rem, 7vw, 6rem);
}

.feature.flip .feature-text {
  order: 2;
}

.feature h2 {
  font-size: clamp(1.45rem, 1.1rem + 1.4vw, 2rem);
  max-width: 20ch;
}

.feature p {
  margin-top: 1rem;
  color: var(--ink-2);
  max-width: 56ch;
}

.feature ul {
  margin: 1.1rem 0 0;
  padding: 0;
  list-style: none;
  max-width: 56ch;
}

.feature li {
  position: relative;
  padding: 0.45rem 0 0.45rem 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
}

.feature li:last-child {
  border-bottom: 1px solid var(--line);
}

.feature li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 1.05rem;
  width: 0.5rem;
  height: 0.5rem;
  border: 2px solid var(--accent);
  border-radius: 50%;
}

.tag {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.45rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  vertical-align: 0.15em;
}

.figure {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(0.75rem, 2vw, 1.1rem);
}

.figure svg {
  width: 100%;
  height: auto;
  color: var(--ink);
}

.figure figcaption {
  margin-top: 0.9rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.fg-line {
  stroke: var(--line-strong);
}

.fg-ink {
  fill: var(--ink);
}

.fg-muted {
  fill: var(--muted);
}

.fg-accent {
  fill: var(--accent);
}

.fg-accent-stroke {
  stroke: var(--accent);
}

.fg-accent2 {
  fill: var(--accent-2);
}

.fg-soft {
  fill: var(--accent-soft);
}

.fg-text {
  font-family: var(--mono);
}

.fg-fill-bg {
  fill: var(--bg);
}

.fg-stroke-bg {
  stroke: var(--bg);
}

.fg-stroke-danger {
  stroke: var(--danger);
}

.fg-surface-fill {
  fill: var(--surface);
}

.fg-accent2-stroke {
  stroke: var(--accent-2);
}

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

  .feature.flip .feature-text {
    order: 0;
  }
}

/* ---------- tables ---------- */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.97rem;
}

th,
td {
  padding: 0.8rem 1rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

thead th {
  font-size: 0.8rem;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

tbody th {
  font-weight: 600;
}

.plans th:first-child {
  width: 44%;
}

.plans td:nth-child(n + 2),
.plans th:nth-child(n + 2) {
  min-width: 8rem;
}

.yes {
  color: var(--accent-2);
  font-weight: 700;
}

.no {
  color: var(--muted);
}

/* ---------- facts, faq, cta ---------- */

.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 2.5rem 0 0;
  padding: 0;
  list-style: none;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.facts li {
  padding: 1.25rem 1.25rem 1.4rem;
  background: var(--surface);
}

.facts strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.facts span {
  display: block;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink-2);
}

@media (max-width: 900px) {
  .facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

.faq {
  max-width: 50rem;
  margin-top: 2rem;
  border-top: 1px solid var(--line);
}

.faq details {
  border-bottom: 1px solid var(--line);
}

.faq summary {
  position: relative;
  padding: 1.1rem 2.5rem 1.1rem 0;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "";
  position: absolute;
  right: 0.4rem;
  top: 50%;
  width: 0.6rem;
  height: 0.6rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.15s;
}

.faq details[open] summary::after {
  transform: translateY(-30%) rotate(-135deg);
}

.faq details > div {
  padding: 0 0 1.2rem;
  color: var(--ink-2);
  max-width: 62ch;
}

.faq details > div > :last-child {
  margin-bottom: 0;
}

.cta-band {
  padding-block: clamp(3rem, 6vw, 4.5rem);
  background: var(--screen-bg);
  color: var(--screen-ink);
  border-top: 1px solid var(--screen-line);
}

.cta-band .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem 3rem;
}

.cta-band h2 {
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem);
  max-width: 24ch;
}

.cta-band p {
  margin: 0.6rem 0 0;
  color: var(--screen-dim);
  max-width: 48ch;
}

.cta-band .btn-primary {
  background: var(--screen-accent);
  color: #04212a;
}

.cta-band .btn-primary:hover {
  background: var(--screen-ink);
}

:root[data-theme="night"] .cta-band .btn-primary {
  background: #7f1d1d;
  color: #fecaca;
}

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

.site-footer {
  padding-block: 3rem 2.5rem;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  font-size: 0.95rem;
}

.has-cta .site-footer {
  border-top: 0;
}

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

.footer-grid h2 {
  margin-bottom: 0.8rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.footer-grid ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-grid li + li {
  margin-top: 0.45rem;
}

.footer-grid a {
  color: var(--ink-2);
  text-decoration: none;
}

.footer-grid a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.footer-about p {
  max-width: 34ch;
  margin: 0.8rem 0 0;
  color: var(--muted);
}

.footer-legal {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
}

.footer-legal p {
  margin: 0 0 0.4rem;
  max-width: 80ch;
}

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

  .footer-about {
    grid-column: 1 / -1;
  }
}

/* ---------- article pages (legal, support, accuracy) ---------- */

.page-head {
  padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(1.5rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: -1px -1px;
}

.page-head h1 {
  font-size: clamp(2rem, 1.2rem + 3vw, 3.2rem);
  max-width: 20ch;
}

.page-head .lead {
  margin: 1rem 0 0;
  max-width: 62ch;
  font-size: 1.15rem;
  color: var(--ink-2);
}

.page-head .cta-row {
  margin-top: 1.6rem;
}

.page-head .meta {
  margin: 1.1rem 0 0;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--muted);
}

.article {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  padding-block: clamp(2rem, 5vw, 3.5rem) clamp(3.5rem, 8vw, 6rem);
  align-items: start;
}

.article.no-toc {
  grid-template-columns: minmax(0, 1fr);
}

.toc {
  position: sticky;
  top: 5.5rem;
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
  font-size: 0.92rem;
}

.toc h2 {
  margin-bottom: 0.7rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--line);
}

.toc a {
  display: block;
  padding: 0.3rem 0 0.3rem 0.9rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--ink-2);
  text-decoration: none;
  line-height: 1.35;
}

.toc a:hover {
  color: var(--accent);
  border-left-color: var(--accent);
}

@media (max-width: 960px) {
  .article {
    grid-template-columns: minmax(0, 1fr);
  }

  .toc {
    position: static;
    max-height: none;
    padding: 1rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
  }
}

.prose {
  max-width: 46rem;
  min-width: 0;
}

.prose > :first-child {
  margin-top: 0;
}

.prose h2 {
  margin: 3rem 0 1rem;
  padding-top: 0.5rem;
  font-size: clamp(1.4rem, 1.1rem + 1vw, 1.8rem);
}

.prose h3 {
  margin: 2rem 0 0.7rem;
  font-size: 1.2rem;
}

.prose h4 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.02rem;
}

.prose ul,
.prose ol {
  margin: 0 0 1.2em;
  padding-left: 1.4rem;
}

.prose li {
  margin-bottom: 0.4em;
  padding-left: 0.2rem;
}

.prose li > ul,
.prose li > ol {
  margin-top: 0.4em;
  margin-bottom: 0.4em;
}

.prose table {
  margin: 0 0 1.5rem;
  font-size: 0.93rem;
}

.prose .table-wrap {
  margin: 0 0 1.6rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.prose .table-wrap table {
  margin: 0;
  min-width: 34rem;
}

.prose blockquote {
  margin: 0 0 1.4rem;
  padding: 0.9rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink);
}

.prose blockquote > :last-child {
  margin-bottom: 0;
}

.prose .notice {
  margin: 0 0 1.5rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--warn-line);
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  color: var(--warn-ink);
}

.prose .notice > :last-child {
  margin-bottom: 0;
}

.prose hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.prose code {
  padding: 0.1em 0.35em;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
}

.prose dl {
  margin: 0 0 1.4rem;
}

.prose dt {
  margin-top: 0.9rem;
  font-weight: 650;
}

.prose dd {
  margin: 0.15rem 0 0;
  color: var(--ink-2);
}

.prose .anchor {
  margin-left: 0.4rem;
  color: var(--muted);
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
}

.prose h2:hover .anchor,
.prose h3:hover .anchor,
.prose .anchor:focus {
  opacity: 1;
}

.placeholder {
  padding: 0 0.3em;
  border-radius: 3px;
  background: #fde68a;
  color: #7c2d12;
  font-weight: 600;
}

/* ---------- converter ---------- */

.tool {
  padding-block: clamp(2rem, 5vw, 3.5rem) clamp(3.5rem, 8vw, 6rem);
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 24rem) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}

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

.panel {
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel h2 {
  margin-bottom: 0.9rem;
  font-size: 1.1rem;
}

.field {
  margin-bottom: 1.1rem;
}

.field label,
.field .label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-2);
}

.field input[type="text"],
.field select {
  width: 100%;
  min-height: 3rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}

.field input[type="text"] {
  font-family: var(--mono);
  font-size: 1rem;
}

.field .hint {
  margin: 0.4rem 0 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.examples button {
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-family: var(--mono);
  font-size: 0.82rem;
  cursor: pointer;
}

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

.status {
  min-height: 1.6rem;
  margin: 0 0 1rem;
  font-size: 0.95rem;
  color: var(--ink-2);
}

.status.error {
  color: var(--danger);
}

.readings {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.results {
  margin: 0;
  padding: 0;
  list-style: none;
}

.results li {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}

.results li:first-child {
  border-top: 0;
}

.results .k {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.results .v {
  font-family: var(--mono);
  font-size: 0.98rem;
  overflow-wrap: anywhere;
}

.results .copy {
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.results .copy:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.results h3 {
  margin: 1.4rem 0 0.2rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.results .warn .v {
  color: var(--danger);
}

.badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0 0.4rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

@media (max-width: 560px) {
  .results li {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .results .k {
    grid-column: 1 / -1;
  }
}

/* ---------- misc ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.card {
  padding: 1.3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.card h3 {
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}

.card p {
  margin: 0;
  font-size: 0.97rem;
  color: var(--ink-2);
}

.spacer {
  height: 1.75rem;
}

.notfound {
  padding-block: 6rem;
  text-align: center;
}

.notfound h1 {
  font-size: clamp(2.2rem, 1.2rem + 4vw, 4rem);
}

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

  * {
    transition: none !important;
    animation: none !important;
  }
}

@media print {
  .site-header,
  .cta-band,
  .site-footer,
  .toc,
  .skip {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  .article {
    display: block;
    padding: 0;
  }

  .prose {
    max-width: none;
  }

  a {
    color: #000;
  }
}
