:root {
  color-scheme: light dark;
  --bg: #f4f5f2;
  --ink: #1a1f1c;
  --muted: #636b66;
  --soft: #eaede8;
  --panel: #fff;
  --border: #d6dbd4;
  --secondary: #3a4240;
  --green: #1f5c3d;
  --blue: #2c5680;
  --amber: #8a5e1c;
  --pre-bg: #16201c;
  --pre-fg: #e2ede6;
}

* { box-sizing: border-box; }

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

a { color: inherit; }

code {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.9em;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 48px);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; text-decoration: none; }
.brand-mark { width: 110px; height: auto; }

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 2px;
}

nav a {
  padding: 6px 9px;
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
}

nav a:hover { background: var(--soft); color: var(--ink); }

/* Layout */
main {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
}

/* Hero */
.hero {
  padding: 48px 0 40px;
}

.hero h1 {
  margin: 0 0 14px;
  max-width: 700px;
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  line-height: 1.1;
}

.hero p {
  max-width: 660px;
  margin: 0 0 22px;
  color: var(--secondary);
  font-size: 1.05rem;
}

.article {
  max-width: 960px;
}

.article-hero h1 {
  max-width: 780px;
}

.article-hero p {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.btn:hover { background: var(--soft); }

.btn.primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.btn.primary:hover { background: #194e34; border-color: #194e34; }

/* Sections */
.section {
  padding: 40px 0;
  border-top: 1px solid var(--border);
}

.section h2 {
  margin: 0 0 14px;
  font-size: 1.5rem;
  line-height: 1.1;
}

.section > p {
  max-width: 660px;
  margin: 0 0 18px;
  color: var(--secondary);
}

/* Code block */
pre {
  margin: 0 0 18px;
  padding: 16px 20px;
  border-radius: 4px;
  background: var(--pre-bg);
  color: var(--pre-fg);
  font-size: 0.88rem;
  line-height: 1.55;
  overflow-x: auto;
}

/* Release meta */
.meta,
.status-grid {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  overflow: hidden;
}

.meta div,
.status-grid div {
  flex: 1 1 220px;
  min-width: 0;
  padding: 10px 14px;
  border-right: 1px solid var(--border);
}

.meta div:last-child,
.status-grid div:last-child { border-right: none; }

.meta dt,
.status-grid dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.meta dd,
.status-grid dd {
  margin: 0;
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

/* Validation table */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow-x: auto;
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th, td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  font-size: 0.92rem;
}

th {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td { color: var(--secondary); }

tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge.pass  { background: #dff0e5; color: var(--green); }
.badge.manual { background: #f5e8d3; color: var(--amber); }
.badge.pending { background: #e7edf5; color: var(--blue); }

/* Image contents */
.contents {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}

.contents div {
  padding: 16px;
  background: var(--panel);
}

.contents dt {
  margin: 0 0 6px;
  font-size: 0.88rem;
  font-weight: 700;
}

.contents dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

/* Article helpers */
.takeaways,
.decision-grid {
  display: grid;
  gap: 1px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}

.takeaways {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.decision-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.takeaways div,
.decision-grid div {
  padding: 16px;
  background: var(--panel);
}

.takeaways dt,
.decision-grid dt {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 0.92rem;
  font-weight: 700;
}

.takeaways dd,
.decision-grid dd {
  margin: 0;
  color: var(--secondary);
  font-size: 0.92rem;
}

.article-list {
  margin: 0 0 18px;
  padding-left: 1.3em;
  display: grid;
  gap: 8px;
}

.article-list li {
  color: var(--secondary);
}

/* Limits */
#limits ul {
  margin: 0;
  padding-left: 1.3em;
  display: grid;
  gap: 8px;
}

#limits li { color: var(--secondary); }

/* Roadmap */
.roadmap {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}

.roadmap div {
  padding: 16px;
  background: var(--panel);
}

.roadmap dt {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 0.88rem;
  font-weight: 700;
}

.roadmap dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

/* Links */
.link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.link-list a {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.link-list a:hover { background: var(--soft); }

/* Footer */
footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  justify-content: center;
  padding: 24px 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.88rem;
}

footer a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101512;
    --ink: #e4ece7;
    --muted: #8a9690;
    --soft: #1c2420;
    --panel: #161c19;
    --border: #2c3530;
    --secondary: #b0bfb8;
    --green: #4db87a;
    --blue: #6aa0cc;
    --amber: #c8883c;
    --pre-bg: #0c1210;
  }

  .badge.pass  { background: #1a3d28; }
  .badge.manual { background: #3d2a10; }
  .badge.pending { background: #152b3f; }
}

@media (max-width: 720px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  nav { justify-content: flex-start; }
  main { width: calc(100% - 28px); }
  .hero h1 { font-size: 2rem; }
  .meta div,
  .status-grid div { border-right: none; border-bottom: 1px solid var(--border); }
  .meta div:last-child,
  .status-grid div:last-child { border-bottom: none; }
  .contents,
  .roadmap,
  .takeaways,
  .decision-grid { grid-template-columns: 1fr; }
}
