/* Shared design for the SSG bake-off — identical in all three prototypes,
   so the only variable under test is the toolkit. */

:root {
  --bg: #fdfdfb;
  --surface: #f5f5f1;
  --text: #191918;
  --muted: #6c6c68;
  --rule: #e3e3dd;
  --accent: #2f5aa8;
  --warn-bg: #fdf7ec;
  --warn-edge: #c99a3e;

  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo,
    Consolas, monospace;

  --measure: 68ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141417;
    --surface: #1d1d21;
    --text: #e8e8e4;
    --muted: #97978f;
    --rule: #2b2b31;
    --accent: #8fb2ea;
    --warn-bg: #241f14;
    --warn-edge: #b08434;
  }
}

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

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

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.5rem;
}

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

.site-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 2.5rem 0 3.5rem;
  flex-wrap: wrap;
}

.site-head a {
  color: inherit;
  text-decoration: none;
}

.brand {
  font-weight: 620;
  letter-spacing: -0.015em;
}

.site-nav {
  display: flex;
  gap: 1.4rem;
  font-size: 0.94rem;
  color: var(--muted);
}

.site-nav a:hover {
  color: var(--accent);
}

.site-foot {
  margin-top: 6rem;
  padding: 2rem 0 3.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.88rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-foot a {
  color: var(--muted);
}

/* ---------- links & type ---------- */

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

h1,
h2,
h3 {
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-weight: 640;
}

h1 {
  font-size: 2.1rem;
  margin: 0 0 0.6rem;
}

h2 {
  font-size: 1.3rem;
  margin: 3rem 0 0.75rem;
}

.lede {
  font-size: 1.12rem;
  color: var(--muted);
  margin: 0 0 2.5rem;
}

.meta {
  color: var(--muted);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- home ---------- */

.intro p {
  margin: 0 0 0.4rem;
}

.intro .stack {
  color: var(--muted);
}

.social {
  display: flex;
  gap: 1.1rem;
  margin-top: 1.4rem;
  font-size: 0.94rem;
}

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

.timeline li {
  position: relative;
  padding: 0 0 2rem 1.75rem;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -3.5px;
  top: 0.72em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rule);
}

.timeline li:first-child::before {
  background: var(--accent);
}

.timeline .role {
  font-weight: 590;
}

.timeline p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------- post list ---------- */

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

.post-list li {
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--rule);
}

.post-list li:first-child {
  border-top: 1px solid var(--rule);
}

.post-list h2,
.post-list h3 {
  font-size: 1.12rem;
  margin: 0.2rem 0 0.35rem;
}

.post-list h2 a,
.post-list h3 a {
  color: var(--text);
  text-decoration: none;
}

.post-list h2 a:hover,
.post-list h3 a:hover {
  color: var(--accent);
}

.post-list p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------- prose ---------- */

.prose > * {
  margin-top: 0;
  margin-bottom: 1.15rem;
}

.prose img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  border: 1px solid var(--rule);
}

.prose blockquote {
  margin: 2rem 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
}

.prose blockquote p {
  margin: 0 0 0.5rem;
}

.prose code {
  font-family: var(--mono);
  font-size: 0.87em;
  background: var(--surface);
  padding: 0.12em 0.36em;
  border-radius: 3px;
}

/* code block with a filename bar */

/* Highlighter::to_html always emits <pre class="hl-code"><code>…</code></pre>,
   whether or not the block carries a title (djot::code_html only adds the
   .codeblock wrapper + filename bar when a title= attribute is present).
   Frame properties (padding, wrapping, type) live on pre.hl-code so an
   untitled block gets them too instead of being rendered bare. */
pre.hl-code {
  margin: 1.6rem 0;
  padding: 0.95rem 1.1rem;
  overflow-x: auto;
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 0.83rem;
  line-height: 1.6;
}

/* syntect writes both palettes into syntax.css keyed on .hl-code, so the
   frame must not impose its own background — only the filename bar tracks
   the theme. */
.codeblock {
  margin: 1.6rem 0;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: none;
}

/* When wrapped, the margin/radius belong to .codeblock instead: the pre
   sits flush below the filename bar, so its top corners must be square —
   the outer box's overflow:hidden + border-radius clip the whole frame
   (filename bar and pre together) into one rounded shape. */
.codeblock pre.hl-code {
  margin: 0;
  border-radius: 0;
}

.codeblock .filename {
  font-family: var(--mono);
  font-size: 0.76rem;
  padding: 0.5rem 0.9rem;
  color: #93a1a1;
  background: #eee8d5;
  border-bottom: 1px solid rgb(0 0 0 / 0.08);
}

@media (prefers-color-scheme: dark) {
  .codeblock .filename {
    color: #a7adba;
    background: #343d46;
    border-bottom-color: rgb(255 255 255 / 0.06);
  }
}

/* The inner <code> must not re-pad or re-colour — that belongs to the frame
   and to the highlighter respectively. Applies whether or not the block is
   wrapped, since both cases share <pre class="hl-code"><code>…</code></pre>. */
pre.hl-code code {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  background: none;
  padding: 0;
}

/* ---- Djot output ----
   `::: warning` renders as <div class="warning">, and the heading inside it
   is the callout's title. */

.prose .warning,
.prose .note {
  margin: 1.8rem 0;
  padding: 1rem 1.15rem;
  border-left: 2px solid var(--warn-edge);
  background: var(--warn-bg);
  border-radius: 0 5px 5px 0;
  font-size: 0.95rem;
}

.prose .note {
  border-left-color: var(--accent);
  background: var(--surface);
}

.prose .warning > h2,
.prose .note > h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 620;
}

.prose .warning > :last-child,
.prose .note > :last-child {
  margin-bottom: 0;
}

.math-error {
  background: var(--warn-bg);
  border-bottom: 1px dotted var(--warn-edge);
}

math {
  font-size: 1.05em;
}
