/* style.css — dark ink ground, amber accent, serif headings. No frameworks, no JS. */

:root {
  /* blue-tinted "ink" neutrals rather than pure greys */
  --bg: #0f1116;
  --panel: #151820;
  --panel-raised: #1b1f29;
  --border: #262b36;
  --border-strong: #363c4a;
  --text: #e9e6df;
  --text-muted: #9ba1ad;
  --text-faint: #7b818d;
  --brand: #e3a857;
  --brand-dim: #a87a3c;
  --measure: 42rem;
  --radius: 3px;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
  color-scheme: dark;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(227, 168, 87, 0.3); }

/* ---- layout ---- */

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2rem 1.25rem 5rem;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  margin-bottom: 3.5rem;
  border-bottom: 1px solid var(--border);
}

.masthead a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.masthead .name {
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 500;
}

.masthead nav a {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.masthead nav a { margin-left: 1.5rem; }

.masthead nav a:hover,
.masthead nav a:focus-visible { color: var(--text); }

footer {
  margin-top: 5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.875rem;
}

footer a { color: var(--text-muted); }

/* ---- type ---- */

h1, h2, h3 {
  color: var(--text);
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.2;
  margin: 0 0 0.6em;
  letter-spacing: -0.01em;
}

h1 { font-size: 2.35rem; }
h2 { font-size: 1.5rem; margin-top: 2.4em; }
h3 { font-family: var(--sans); font-size: 1.05rem; font-weight: 600; margin-top: 1.8em; }

p, ul, ol, pre, blockquote, table, figure, details {
  margin: 0 0 1.25em;
}

a {
  color: var(--brand);
  text-decoration: underline;
  text-decoration-color: var(--brand-dim);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover, a:focus-visible { text-decoration-color: var(--brand); }

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

strong { color: var(--text); font-weight: 600; }

.lede {
  font-family: var(--serif);
  font-size: 1.35rem;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 3rem;
}

.meta {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.8rem;
  margin: -0.25rem 0 2.5rem;
}

/* ---- series list (home) ---- */

.series {
  list-style: none;
  padding: 0;
  margin: 0 0 2.5rem;
  counter-reset: part;
  border-top: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
}

.series li {
  counter-increment: part;
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 0.1rem 0.75rem;
  padding: 1.1rem 0;
  border-top: 1px solid var(--border);
}

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

.series li::before {
  content: counter(part, decimal-leading-zero);
  grid-row: 1 / span 2;
  color: var(--brand);
  font-family: var(--mono);
  font-size: 0.8rem;
  padding-top: 0.35rem;
}

.series .unpublished::before { color: var(--text-faint); }

.series .title { font-family: var(--serif); font-size: 1.2rem; line-height: 1.3; color: var(--text); }
.series .title a { color: var(--text); text-decoration: none; }
.series .title a:hover,
.series .title a:focus-visible { color: var(--brand); }
.series .summary { color: var(--text-muted); font-size: 0.925rem; line-height: 1.5; }
.series .unpublished .title { color: var(--text-muted); }
.series .unpublished .summary { color: var(--text-faint); }

/* ---- code ---- */

code, pre, kbd {
  font-family: var(--mono);
}

code {
  font-size: 0.875em;
  color: var(--text);
  background: var(--panel-raised);
  padding: 0.1em 0.35em;
  border-radius: var(--radius);
}

pre {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  overflow-x: auto;
  line-height: 1.55;
  font-size: 0.82rem;
  color: #d3d6dc;
}

pre.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }

pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* ---- post furniture ---- */

.series-note {
  font-size: 0.95rem;
  color: var(--text-muted);
  border-left: 2px solid var(--brand);
  padding: 0.15rem 0 0.15rem 1.1rem;
  margin-bottom: 2.75rem;
}

.prev-next {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  margin-top: 4rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.925rem;
}

.prev-next span { color: var(--text-faint); }

blockquote {
  margin-left: 0;
  padding-left: 1rem;
  border-left: 2px solid var(--border-strong);
  font-family: var(--serif);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--text-muted);
}

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

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

th {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom-color: var(--border-strong);
}
td { color: var(--text-muted); }

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

summary {
  cursor: pointer;
  padding: 0.65rem 1rem;
  color: var(--text-muted);
  font-size: 0.925rem;
  list-style: none;
}

summary::-webkit-details-marker { display: none; }
summary::before { content: "+"; display: inline-block; width: 1.25rem; color: var(--text-faint); }
details[open] summary::before { content: "–"; }
details[open] summary { border-bottom: 1px solid var(--border); }
details pre { border: 0; border-radius: 0; margin: 0; }

@media (max-width: 480px) {
  html { font-size: 16px; }
  h1 { font-size: 1.85rem; }
  .lede { font-size: 1.2rem; }
  .masthead { flex-direction: column; align-items: flex-start; gap: 0.35rem; }
  .masthead nav a { margin-left: 0; margin-right: 1.25rem; }
}

@media (prefers-reduced-motion: no-preference) {
  a { transition: color 120ms ease, text-decoration-color 120ms ease; }
}

@media print {
  html { color-scheme: light; }
  body { background: #fff; color: #000; }
  .masthead nav, .prev-next { display: none; }
  a { color: inherit; text-decoration: none; }
}
