:root {
  --bg: #f7f5ef;
  --fg: #1c2430;
  --muted: #5a6473;
  --accent: #0f2a3f;
  --gold: #b8892e;
  --rule: #dcd7cb;
  --card: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e141b;
    --fg: #e6e9ee;
    --muted: #9aa5b4;
    --accent: #dfe7f0;
    --gold: #e8c46a;
    --rule: #243040;
    --card: #151d27;
  }
}
:root[data-theme="dark"] {
  --bg: #0e141b;
  --fg: #e6e9ee;
  --muted: #9aa5b4;
  --accent: #dfe7f0;
  --gold: #e8c46a;
  --rule: #243040;
  --card: #151d27;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.6 Georgia, "Times New Roman", serif;
  -webkit-font-smoothing: antialiased;
}
main {
  max-width: 640px;
  margin: 0 auto;
  padding: 12vh 16px 8vh;
}
main.doc { padding-top: 8vh; }
.mark {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 40px;
}
.mark a { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.mark svg { width: 36px; height: 36px; flex: none; }
.mark span {
  font: 600 15px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted);
}
h1 {
  font-size: clamp(34px, 6vw, 48px);
  line-height: 1.1;
  margin: 0 0 20px;
  color: var(--accent);
  font-weight: 400;
  letter-spacing: -0.01em;
}
main.doc h1 { font-size: clamp(28px, 5vw, 36px); }
h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 36px 0 10px;
  color: var(--accent);
}
p { margin: 0 0 18px; }
.lede { font-size: 20px; color: var(--fg); }
.muted { color: var(--muted); }
.meta {
  font: 14px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--muted);
  margin-bottom: 28px;
}
ul { padding-left: 20px; margin: 0 0 18px; }
li { margin-bottom: 6px; }
.status {
  display: inline-block;
  font: 600 12px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 7px 12px;
  margin: 8px 0 28px;
}
hr { border: 0; border-top: 1px solid var(--rule); margin: 40px 0 24px; }
footer {
  font: 14px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--muted);
}
a { color: inherit; text-decoration-color: var(--gold); text-underline-offset: 3px; }
a:hover { color: var(--gold); }
code {
  font: 14px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1px 6px;
}

/* The comment box: the last item in every page's footer row, a <details> whose summary reads like the links beside
   it and whose form opens full-width underneath (deepalmanac_site.render_footer, and the same markup by hand in the
   pages at the root of public/). No JavaScript: the CSP allows no inline script and this must work on a page that
   loads none. display: contents lets the summary sit in the row while the form takes a row of its own:
   ::details-content where the browser has it, the children themselves where it does not. */
footer nav { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 16px; }
details.comment { display: contents; }
details.comment[open]::details-content { flex-basis: 100%; }
details.comment > :not(summary) { flex-basis: 100%; }
details.comment > summary {
  cursor: pointer;
  list-style: none;
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-underline-offset: 3px;
}
details.comment > summary::-webkit-details-marker { display: none; }
details.comment > summary::after { content: "\25B8"; display: inline-block; margin-left: 4px; text-decoration: none; }
details.comment[open] > summary::after { content: "\25BE"; }
details.comment > summary:hover { color: var(--gold); }
.comment-form { margin: 12px 0 0; max-width: 560px; }
.comment-form label { display: block; margin-bottom: 6px; }
.comment-form textarea {
  font: inherit;
  color: var(--fg);
  background: var(--card);
  border: 1px solid var(--rule);
}
.comment-form textarea { width: 100%; border-radius: 6px; padding: 10px 12px; resize: vertical; }
.comment-form .row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.comment-form button {
  font: inherit;
  color: var(--fg);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 8px 22px;
  cursor: pointer;
}
.comment-form button:hover { border-color: var(--gold); color: var(--gold); }
.comment-form textarea:focus { border-color: var(--gold); outline: 1px solid var(--gold); }
.agent-note { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.agent-note code { font-size: 12px; }
pre {
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 12px 14px;
  margin: 0 0 18px;
  overflow-x: auto;
}
pre code { background: none; border: 0; padding: 0; font: inherit; }
