/* Shared chrome and the homepage. Long-form prose styles live in post.css,
   syntax highlighting in the generated code.css. Both resolve through the
   custom properties defined here, so a theme is defined exactly once.

   Type: Newsreader for prose and headings, IBM Plex Mono for DATA ONLY —
   labels, dates, counts, tags. Mono never sets a sentence. */

/* ── Fonts ───────────────────────────────────────────────────────────────
   Self-hosted, latin subset. Nothing here reaches off-origin, which is what
   lets ALLOWED_HOSTS in tools/blog.py be empty and makes "no third-party
   requests" a build-time invariant rather than a habit. */
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/assets/fonts/newsreader-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/plexmono-latin.woff2') format('woff2');
}

:root {
  --bg: #faf9f6;
  --bg-soft: #f1efe9;
  --ink: #16171a;
  --muted: #5c5f66;
  /* --dim carries the small type: labels, dates, tags, the footer. At 11-12px
     that is "normal text" to WCAG, so it needs 4.5:1 — the previous #8b8e93
     managed only 3.12:1. This is 4.51:1 on --bg. Check both themes before
     lightening it again. */
  --dim: #717377;
  --rule: rgba(22, 23, 26, 0.13);
  --rule-strong: rgba(22, 23, 26, 0.85);
  --accent: #1e4d3c;
  --accent-soft: rgba(30, 77, 60, 0.16);
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: system-ui, -apple-system, 'Segoe UI', sans-serif;
}
body.dark {
  --bg: #12130f;
  --bg-soft: #1c1d18;
  --ink: #f2f1ec;
  --muted: #9a9c96;
  --dim: #7b7e77;  /* 4.52:1 on the dark --bg; see the note in :root */
  --rule: rgba(242, 241, 236, 0.15);
  --rule-strong: rgba(242, 241, 236, 0.8);
  --accent: #8ab99f;
  --accent-soft: rgba(138, 185, 159, 0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 180ms ease, color 180ms ease;
}
a { color: inherit; text-decoration: none; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 40px 56px 96px; }

/* ── Masthead ────────────────────────────────────────────────────────────
   Shared by every page. On the homepage the brand is the mark alone, because
   the name is the h1 directly below it; on generated pages the name rides
   alongside, since nothing else there identifies whose site this is. */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; padding-bottom: 14px; margin-bottom: 0;
  border-bottom: 1px solid var(--rule-strong);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand svg { width: 18px; height: 18px; flex: none; display: block; }
.brand .brand-name { font-size: 19px; font-weight: 500; letter-spacing: -0.01em; }
.nav-links { display: flex; align-items: baseline; gap: 20px; }
.nav-links a {
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  transition: color 120ms ease;
}
.nav-links a:hover, .nav-links a.is-active { color: var(--ink); }
.theme-toggle {
  background: none; border: 0; padding: 0; cursor: pointer;
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  transition: color 120ms ease;
}
.theme-toggle:hover { color: var(--ink); }

/* ── Sections ────────────────────────────────────────────────────────────*/
section { margin-bottom: 56px; scroll-margin-top: 28px; }
/* Section headings use this. It is applied to real <h2> elements on the
   homepage, so the UA's heading margins and bold weight have to be reset —
   the styling is deliberately quiet, but the document outline should not be. */
.label {
  font-family: var(--mono); font-size: 11px; color: var(--dim);
  letter-spacing: 0.13em; text-transform: uppercase;
  font-weight: 400; margin: 0;
}
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 20px; padding-bottom: 12px;
  border-bottom: 1px solid var(--rule-strong);
}

/* ── Homepage hero ───────────────────────────────────────────────────────*/
.hero { padding: 68px 0 44px; margin-bottom: 0; }
.hero h1 {
  font-family: var(--serif); font-size: clamp(40px, 6.4vw, 72px);
  font-weight: 400; line-height: 1.04; letter-spacing: -0.022em;
  margin: 0 0 26px; color: var(--ink);
}
.hero-rule {
  width: 88px; height: 2px; background: var(--accent); margin: 0 0 26px;
  transform: scaleX(0); transform-origin: left center;
  animation: draw 620ms cubic-bezier(0.2, 0.7, 0.3, 1) 180ms forwards;
}
@keyframes draw { to { transform: scaleX(1); } }

.hero .lede {
  font-size: 20px; line-height: 1.55; color: var(--ink);
  max-width: 46ch; margin: 0 0 18px;
}
.specialty {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.9;
  color: var(--muted); margin: 0 0 26px; max-width: 60ch;
}
.specialty .sep { color: var(--dim); padding: 0 8px; }

.meta-line {
  font-family: var(--mono); font-size: 12.5px; color: var(--muted);
  display: flex; flex-wrap: wrap; align-items: baseline;
}
.meta-line .sep { color: var(--dim); padding: 0 10px; }
.meta-line a { border-bottom: 1px solid var(--rule); padding-bottom: 1px; }
.meta-line a:hover { border-bottom-color: var(--accent); color: var(--ink); }

/* ── Figures ─────────────────────────────────────────────────────────────
   Set between hairlines so they read as a table of facts, not floating. */
.figures {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px;
  padding: 28px 0 30px;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.figure .n {
  font-family: var(--serif); font-size: 44px; font-weight: 400;
  line-height: 1; letter-spacing: -0.02em; color: var(--ink);
}
.figure .k {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.11em;
  text-transform: uppercase; color: var(--muted);
  margin-top: 12px; line-height: 1.5; max-width: 20ch;
}

/* ── Work entries ────────────────────────────────────────────────────────
   Deliberately not a problem/solution/result triad: that shape is narrative,
   and this page is meant to be scanned rather than read. A framing line, the
   results, then what it was built with. */
.entry {
  display: grid; grid-template-columns: 210px 1fr; gap: 48px;
  padding: 30px 0; border-bottom: 1px solid var(--rule);
}
.entry-key .idx {
  font-family: var(--mono); font-size: 11px; color: var(--dim);
  letter-spacing: 0.1em;
}
.entry-key .ttl {
  font-size: 19px; font-weight: 500; letter-spacing: -0.01em; margin-top: 8px;
}
.entry-key .where {
  font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 6px;
}
.entry-lede { font-size: 17px; line-height: 1.6; margin: 0 0 18px; max-width: 62ch; }
.entry ul { margin: 0 0 20px; padding: 0; list-style: none; display: grid; gap: 9px; }
.entry li {
  font-size: 16.5px; line-height: 1.55; color: var(--muted);
  padding-left: 20px; position: relative; max-width: 62ch;
}
.entry li::before {
  content: ""; position: absolute; left: 0; top: 0.7em;
  width: 7px; height: 1px; background: var(--accent);
}
/* Tag rows use the same middot run as the Tools section rather than pills —
   pills would fight the hairline-and-type discipline of everything else. */
.entry-tags {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.9; color: var(--dim);
}
.entry-tags .sep { padding: 0 7px; opacity: 0.55; }

/* ── Experience ──────────────────────────────────────────────────────────*/
.xp {
  display: grid; grid-template-columns: 210px 1fr; gap: 48px;
  padding: 26px 0; border-bottom: 1px solid var(--rule);
}
.xp-when { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.xp-title { font-size: 19px; font-weight: 500; letter-spacing: -0.01em; }
.xp-org { font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin: 5px 0 16px; }
.xp-org .note { color: var(--dim); }
.xp ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.xp li {
  font-size: 16.5px; line-height: 1.55; color: var(--muted);
  padding-left: 20px; position: relative;
}
.xp li::before {
  content: ""; position: absolute; left: 0; top: 0.7em;
  width: 7px; height: 1px; background: var(--accent);
}

/* ── Tools ───────────────────────────────────────────────────────────────*/
.stack { display: grid; grid-template-columns: 210px 1fr; gap: 0 48px; }
.stack-group {
  font-size: 17px; font-weight: 500; padding: 24px 0 0;
  border-top: 1px solid var(--rule);
}
.stack-items {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.95;
  color: var(--muted); padding: 24px 0 24px; border-top: 1px solid var(--rule);
}
.stack-items .sep { color: var(--dim); padding: 0 7px; }

/* ── Background (education / certification / location) ───────────────────*/
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 48px; padding: 28px 0; }
.three-col h3 {
  font-family: var(--mono); font-size: 11px; color: var(--dim);
  letter-spacing: 0.13em; text-transform: uppercase; margin: 0 0 14px;
}
.item + .item { margin-top: 18px; }
.item-t { font-size: 16.5px; }
.item-m { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ── Writing rows ────────────────────────────────────────────────────────
   Shared by the homepage, the blog index and the post footer. The first
   column is fixed, which is why blog.py keeps KIND_LABELS short. */
.writing-row {
  display: grid; grid-template-columns: 100px 1fr 130px; gap: 24px;
  padding: 18px 0; border-bottom: 1px solid var(--rule); align-items: baseline;
}
.writing-row .kind {
  font-family: var(--mono); font-size: 11px; color: var(--dim);
  letter-spacing: 0.12em; text-transform: uppercase;
}
.writing-row .title { font-size: 18px; color: var(--ink); }
.writing-row .when {
  font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right;
}
/* Post rows are anchors. Global `a { color: inherit }` already neutralises
   link styling, so only the hover affordance needs adding. */
a.writing-row .title { transition: color 120ms ease; }
a.writing-row:hover .title { color: var(--accent); }
a.writing-row:hover .kind { color: var(--muted); }

/* ── Blog index hero support ─────────────────────────────────────────────
   .hero-eyebrow, .lede, .meta-row and .dot are used by the blog index and
   404 templates. .lede is shared with the homepage hero above. */
.hero-eyebrow {
  font-family: var(--mono); font-size: 11px; color: var(--dim);
  letter-spacing: 0.13em; text-transform: uppercase; margin-bottom: 20px;
}
.lede { font-size: 19px; line-height: 1.6; color: var(--muted); max-width: 62ch; margin: 0; }
.dot { color: var(--accent); }
.meta-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* ── Chips (blog tag filters and post tags) ──────────────────────────────
   Not used on the homepage, but post.css builds on this base for both the
   tag filter and a post's own tag list. Do not remove with the homepage. */
.chip {
  font-family: var(--mono); font-size: 12px;
  padding: 6px 12px; border: 1px solid var(--rule); border-radius: 4px;
  color: var(--muted); transition: color 120ms ease, border-color 120ms ease;
}
.chip.is-accent { color: var(--accent); border-color: var(--accent); }

/* ── Contact links ───────────────────────────────────────────────────────
   Used by the 404 page and post headers/footers. The homepage contact
   section uses a definition list instead. */
.contact { display: grid; grid-template-columns: 210px 1fr; gap: 48px; padding: 28px 0; }
.contact dl { margin: 0; display: grid; grid-template-columns: 130px 1fr; gap: 12px 24px; }
.contact dt {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--dim); padding-top: 4px;
}
.contact dd { margin: 0; font-size: 17px; }
.contact dd a { border-bottom: 1px solid var(--rule); padding-bottom: 2px; }
.contact dd a:hover { border-bottom-color: var(--accent); }

.contact-link {
  font-family: var(--mono); font-size: 12.5px;
  padding: 10px 15px; border: 1px solid var(--rule); border-radius: 4px;
  display: inline-flex; gap: 10px; align-items: baseline;
  transition: border-color 120ms ease;
}
.contact-link .k { color: var(--dim); }
.contact-link .v { color: var(--ink); }
.contact-link:hover { border-color: var(--accent); }

/* ── Footer ──────────────────────────────────────────────────────────────*/
footer {
  margin-top: 68px; padding-top: 22px; border-top: 1px solid var(--rule-strong);
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 40px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 11.5px; color: var(--dim);
}
footer a { border-bottom: 1px solid var(--rule); }
footer a:hover { border-bottom-color: var(--accent); }
/* Bounded so it wraps into a tidy right-aligned block. Without a max-width the
   longest line sets the element's width and the whole block slides left under
   the copyright line. */
.colophon { line-height: 1.75; text-align: right; max-width: 46ch; }

/* ── Responsive ──────────────────────────────────────────────────────────*/
@media (max-width: 900px) {
  .wrap { padding: 28px 22px 64px; }
  .nav-links a { display: none; }
  .hero { padding: 48px 0 36px; }
  .hero .lede { font-size: 18px; }
  .figures { grid-template-columns: 1fr 1fr; gap: 26px 24px; }
  .entry, .xp, .three-col, .contact { grid-template-columns: 1fr; gap: 16px; }
  .three-col { gap: 28px; }
  .contact dl { grid-template-columns: 1fr; gap: 4px; }
  .contact dt { padding-top: 12px; }
  .stack { grid-template-columns: 1fr; }
  .stack-group { padding-bottom: 0; }
  .stack-items { border-top: 0; padding-top: 8px; }
  .writing-row { grid-template-columns: 1fr; gap: 4px; }
  .writing-row .when { text-align: left; }
  footer { flex-direction: column; gap: 16px; }
  .colophon { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-rule { animation: none; transform: scaleX(1); }
  body { transition: none; }
}
