:root {
  --bg:         #f9f5ec;   /* cream */
  --text:       #1a1a1a;
  --text-2:     #55534d;
  --muted:      #777777;
  --border:     #e0dacb;
  --link:       #2e8b8b;
  --link-hover: #206868;
  --code-bg:    #2e8b8b14;

  /* chart tokens, validated against the cream surface */
  --s1:     #2a78d6;
  --s2:     #eb6834;
  --s3:     #1baf7a;
  --ord-lo: #6da7ec;
  --ord-hi: #2a78d6;
  --r8:     #4a3aa7;
  --r35:    #e34948;
  --grid:   #e4ded0;
  --axis:   #cdc6b6;

  --font-serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-sans:  system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:  'SF Mono', 'Fira Code', ui-monospace, Menlo, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 720px; margin: 0 auto; padding: 0 20px; }

/* ------------------------------------------------------------------ nav */
.navbar {
  max-width: 720px; margin: 0 auto; padding: 34px 20px 0;
  display: flex; align-items: baseline; justify-content: space-between; gap: 20px;
}
.nav-brand {
  font-family: var(--font-serif); font-size: 1.05em; font-weight: bold;
  color: var(--text); text-decoration: none;
}
.nav-links { display: flex; gap: 1.4em; }
.nav-link {
  font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--muted); text-decoration: none;
}
.nav-link:hover { color: var(--link); }
.nav-link.active { color: var(--text); }

main { padding-top: 64px; padding-bottom: 20px; }

/* ----------------------------------------------------------------- text */
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 2.2em; line-height: 1.2; margin: 0 0 0.1em; font-weight: bold; }
h2 {
  margin-top: 2.6em; margin-bottom: 0.8em;
  font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--text); font-weight: bold;
}
h2 .anchor { text-decoration: none; opacity: 0; margin-left: 8px; }
h2:hover .anchor { opacity: 1; }

p  { margin: 0 0 1.2em; }
ul { padding-left: 1.2em; margin: 0 0 1.2em; }
li { margin-bottom: 0.5em; }

.tagline { font-size: 1.25em; margin: 0 0 1.5em; }
.post-meta { font-size: 0.9em; color: var(--muted); margin: 0 0 2.4em; }
.post-endmark { text-align: center; color: var(--muted); margin: 3.4em 0 0; }

code { font-family: var(--font-mono); font-size: 0.82em;
       background: var(--code-bg); padding: 1px 4px; border-radius: 3px; }
code.fn { background: none; padding: 0; font-weight: bold; color: var(--text); }

hr { border: none; border-top: 1px solid var(--border); margin: 2.8em 0; }

/* --------------------------------------------------------------- tables */
.tablewrap { overflow-x: auto; margin: 1.6em 0; }
table { border-collapse: collapse; width: 100%;
        font-family: var(--font-sans); font-size: 0.8em; }
th, td { text-align: left; padding: 7px 14px 7px 0;
         border-bottom: 1px solid var(--border); white-space: nowrap;
         font-variant-numeric: tabular-nums; }
th { color: var(--muted); font-weight: normal; }

/* -------------------------------------------------------------- figures */
figure { margin: 2.6em 0; }
figcaption { font-size: 0.85em; line-height: 1.6; color: var(--muted); margin-top: 0.8em; }
figcaption code { background: none; padding: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 12px;
          font-family: var(--font-sans); font-size: 0.72em; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

svg.chart { width: 100%; height: auto; display: block; overflow: visible;
            font-family: var(--font-sans); }
svg.chart text      { fill: var(--muted); font-size: 11px; }
svg.chart text.val  { fill: var(--text-2); font-size: 11px; font-variant-numeric: tabular-nums; }
svg.chart text.cat,
svg.chart text.ttl  { fill: var(--text); font-size: 12.5px; font-weight: 600; }
svg.chart .grid      { stroke: var(--grid); stroke-width: 1; }
svg.chart .axis      { stroke: var(--axis); stroke-width: 1; }
svg.chart .rule      { stroke: var(--text-2); stroke-width: 1.5; }
svg.chart .marker    { stroke: var(--axis); stroke-width: 1; }
svg.chart .connector { stroke: var(--muted); stroke-width: 2; }
svg.chart .leader    { stroke: var(--axis); stroke-width: 1; }
svg.chart .dot       { stroke: var(--bg); stroke-width: 2; }
svg.chart .band      { stroke: var(--bg); stroke-width: 2; stroke-linejoin: round; }

/* ------------------------------------------------------------ post list */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { margin-bottom: 2.2em; }
.post-list .date { font-size: 0.85em; color: var(--muted); display: block; }
.post-list .title { font-weight: bold; font-size: 1.05em; margin: 0.1em 0 0.2em; }
.post-list .title a { color: var(--text); }
.post-list .title a:hover { color: var(--link); }
.post-list p { margin: 0; color: var(--text-2); }

/* --------------------------------------------------------------- footer */
.site-footer {
  max-width: 720px; margin: 4.5em auto 0; padding: 20px 20px 56px;
  border-top: 1px solid var(--border);
  font-size: 0.9em; color: var(--muted);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--link); }

/* --------------------------------------------------------- home page bits */
.work { margin-bottom: 2em; }
.work-title { font-weight: bold; font-size: 1.05em; margin-bottom: 0.2em; }
.work-title a { color: inherit; }
.work p { margin: 0.2em 0 0.5em; }
.meta { font-size: 0.9em; color: var(--muted); }
.now p { margin: 0.4em 0; }
.links { margin-top: 3em; font-size: 0.95em; }
.links a { margin-right: 1.4em; }

@media (max-width: 620px) {
  .container, .navbar { padding-left: 16px; padding-right: 16px; }
  h1 { font-size: 1.75em; }
  main { padding-top: 40px; }
}
