:root {
  --bg: #fbfaf7;
  --fg: #1d1d1f;
  --muted: #6b6b70;
  --rule: #e4e2dc;
  --accent: #1f3a5f;
  --code-bg: #f1efe9;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161616;
    --fg: #e8e6e1;
    --muted: #9a9894;
    --rule: #2e2d2b;
    --accent: #8fb4e3;
    --code-bg: #222120;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0 auto;
  max-width: 44rem;
  padding: 0 1.25rem;
  background: var(--bg);
  color: var(--fg);
  font: 1.125rem/1.7 var(--serif);
}

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }

/* Header / footer */
.site-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: baseline;
  justify-content: space-between;
  padding: 2rem 0 1.25rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
}
.site-title { font-weight: 700; font-size: 1.25rem; color: var(--fg); text-decoration: none; letter-spacing: -0.01em; }
.site-subtitle { font-weight: 400; color: var(--muted); font-size: 1rem; }
.site-subtitle strong { font-weight: 600; }
@media (max-width: 480px) {
  .site-subtitle { display: block; font-size: 1rem; margin-top: 0.15rem; }
  .site-subtitle .sep { display: none; }
}
.site-header nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.9rem; font-size: 0.9rem; }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { color: var(--accent); }
.nav-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.9rem; }
.site-header .menu-toggle { display: none; padding: 0; background: none; border: 0; cursor: pointer; }
.menu-toggle .icon-close, .menu-toggle[aria-expanded="true"] .icon-open { display: none; }
.menu-toggle[aria-expanded="true"] .icon-close { display: block; }
.menu-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
/* Small screens: text links fold into the menu button; home and social icons stay in the bar */
@media (max-width: 600px) {
  .site-header nav { width: 100%; }
  .menu-ready .nav-icons { order: 1; }
  .menu-ready .menu-toggle { display: inline-flex; order: 2; margin-left: auto; }
  .menu-ready .nav-links { display: none; order: 3; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 0; border-top: 1px solid var(--rule); }
  .menu-ready .menu-toggle[aria-expanded="true"] ~ .nav-links { display: flex; }
  .menu-ready .nav-links a { padding: 0.7rem 0; font-size: 1rem; border-bottom: 1px solid var(--rule); }
  .menu-ready .nav-links a:last-child { border-bottom: 0; padding-bottom: 0; }
}

.site-footer {
  margin-top: 4rem;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--rule);
  font: 0.85rem var(--sans);
  color: var(--muted);
}
.site-footer a { color: inherit; }
.site-footer p { margin: 0.25rem 0; }

/* Icon links (LinkedIn, GitHub, RSS) */
.icon { display: block; }
.icon-link { display: inline-flex; color: var(--muted); }
.icon-link:hover { color: var(--accent); }
.nav-icons { display: inline-flex; align-items: center; gap: 0.9rem; }
.social { display: flex; gap: 1rem; margin-top: 0.75rem !important; }

/* Shared bits */
.meta, .kicker { font: 0.85rem/1.5 var(--sans); color: var(--muted); margin: 0.25rem 0; }
.kicker { text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; font-size: 0.75rem; }

.intro { padding: 2.5rem 0 0.5rem; }
.intro p { color: var(--muted); margin: 0.25rem 0; }
.intro h1 { font-size: 2rem; line-height: 1.2; margin: 0.25rem 0; }

/* Post list */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-card { padding: 1.75rem 0; border-bottom: 1px solid var(--rule); }
.post-card:last-child { border-bottom: 0; }
.post-card h2 { font-size: 1.4rem; line-height: 1.3; margin: 0.25rem 0 0.5rem; }
.post-card h2 a { color: var(--fg); text-decoration: none; }
.post-card h2 a:hover { color: var(--accent); }
.post-card > p:last-of-type { margin: 0; color: var(--muted); font-size: 1rem; }

/* Newest post on the home page */
.post-card.featured { padding: 2.25rem 0 2.5rem; border-bottom-width: 2px; }
.post-card.featured .kicker { color: var(--accent); margin-bottom: 0.4rem; }
.post-card.featured h2 { font-size: 2rem; line-height: 1.2; margin: 0.35rem 0 0.75rem; }
.post-card.featured > p:not(.meta):not(.kicker) { color: var(--fg); font-size: 1.15rem; margin: 0 0 1rem; }
.post-card.featured .tags { margin: 0; }
@media (max-width: 480px) { .post-card.featured h2 { font-size: 1.6rem; } }

/* Title-only promo box under the newest post (site.promoted in build.mjs) */
.promo { margin: 1.75rem 0 0.5rem; padding: 1.1rem 1.4rem; border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: 6px; background: var(--code-bg); }
.promo .kicker { margin: 0 0 0.3rem; }
.promo .tags { margin: 0 0 0.5rem; }
.promo h2 { font-size: 1.2rem; line-height: 1.35; margin: 0; }
.promo h2 a { color: var(--fg); text-decoration: none; }
.promo h2 a:hover { color: var(--accent); }

/* Tables in posts and pages */
.prose table { width: 100%; border-collapse: collapse; margin: 1.75rem 0; font: 0.9rem/1.45 var(--sans); }
.prose th, .prose td { padding: 0.6rem 0.75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
.prose thead th { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); border-bottom: 2px solid var(--rule); }
.prose td:first-child { font-weight: 600; }
.prose td:first-child a { text-decoration: none; }
.prose td:not(:first-child) strong { color: var(--accent); }
@media (max-width: 600px) { .prose table { display: block; overflow-x: auto; } .prose th, .prose td { min-width: 9rem; } }
/* Diagrams (SVGs in images/diagrams/) */
.prose img[src*="diagrams/"] { display: block; margin: 2rem auto; }

/* **Draft:** yes on a page */
.draft-bar { margin: 2rem 0 0; padding: 0.7rem 1rem; border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: 6px; background: var(--code-bg); font: 0.9rem/1.5 var(--sans); color: var(--muted); }
.draft-bar strong { color: var(--accent); }

/* Article */
.post > header { padding: 2.5rem 0 1rem; }
.post h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); line-height: 1.2; margin: 0.25rem 0 0.75rem; letter-spacing: -0.01em; }
/* Post tags (not links): pillars filled in the accent colour, their items outlined */
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0; margin: 0.9rem 0 0; }
.tags li { padding: 0.1rem 0.55rem; border: 1px solid var(--rule); border-radius: 4px; font: 0.8rem/1.5 var(--sans); color: var(--muted); }
.tags .tag-pillar { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }

.prose h2 { font-size: 1.5rem; line-height: 1.3; margin: 2.5rem 0 0.75rem; }
.prose h3 { font-size: 1.2rem; line-height: 1.35; margin: 2rem 0 0.5rem; }
.prose h4 { font-size: 1.05rem; margin: 1.75rem 0 0.5rem; }
/* Opening paragraph of every post and page: larger, in the sans font */
.prose > p:first-of-type, .prose > p.lead { font: 400 1.3rem/1.55 var(--sans); letter-spacing: -0.005em; color: var(--muted); }
@media (max-width: 480px) { .prose > p:first-of-type, .prose > p.lead { font-size: 1.15rem; } }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin: 0.35rem 0; }
.prose blockquote {
  margin: 1.5rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }
.prose img { max-width: 100%; height: auto; }

code { font: 0.85em var(--mono); background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; }
pre {
  background: var(--code-bg);
  padding: 1rem 1.25rem;
  border-radius: 6px;
  overflow-x: auto;
  line-height: 1.5;
}
pre code { background: none; padding: 0; font-size: 0.85rem; }

.post-footer { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); font-family: var(--sans); font-size: 0.9rem; }
.source { color: var(--muted); }
.post-nav { display: flex; justify-content: space-between; gap: 1.5rem; margin-top: 1.5rem; }
.post-nav a { text-decoration: none; max-width: 48%; }
.post-nav a[rel="next"] { text-align: right; }

/* Standalone pages */
/* Photo sits to the left of the first paragraph; the text wraps round it. */
.portrait {
  float: left;
  width: 120px; height: 120px;
  object-fit: cover;
  border-radius: 50%;
  margin: 0.35rem 1.5rem 0.75rem 0;
}
.prose h2 { clear: both; }
@media (max-width: 480px) { .portrait { width: 96px; height: 96px; margin-right: 1rem; } }
/* Keep the opening paragraph beside the photo, not wrapping under it */
.portrait + p { display: flow-root; }
.portrait + p + * { clear: left; }

/* Home page: photo to the left of the intro, text centred beside it */
.intro-photo { display: flex; align-items: center; gap: 1.5rem; }
.intro-photo .portrait { float: none; flex: none; margin: 0; }
.intro-photo p { font: 400 1.3rem/1.55 var(--sans); letter-spacing: -0.005em; }
@media (max-width: 480px) { .intro-photo p { font-size: 1.15rem; } }
@media (max-width: 480px) { .intro-photo { gap: 1rem; } }
.nowrap { white-space: nowrap; }

/* Linked images (e.g. project cards on the Links page) */
.prose a:has(> img) { display: block; margin: 0.75rem 0; }
.prose a > img { display: block; border: 1px solid var(--rule); border-radius: 8px; }
.prose a:hover > img { border-color: var(--accent); }

/* Tabs on pages with **Tabs:** yes (see tabify in build.mjs) */
.tab-list { display: flex; gap: 0.25rem; margin: 2.5rem 0 0; border-bottom: 1px solid var(--rule); }
.tab-list[hidden] { display: none; }
.tab-list [role="tab"] {
  flex: 1; padding: 0.75rem 0.5rem; margin-bottom: -1px;
  font: 600 0.95rem/1.3 var(--sans); color: var(--muted); text-align: center;
  background: none; border: 0; border-bottom: 3px solid transparent; cursor: pointer;
}
.tab-list [role="tab"]:hover { color: var(--fg); }
.tab-list [role="tab"][aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tab-list [role="tab"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.tabs-ready .tab-panel > h2:first-child {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.tabs-ready .tab-panel { padding-top: 1.5rem; }
/* First paragraph in each tab: same opening style as the page's first paragraph */
.tab-panel > h2:first-child + p { font: 400 1.3rem/1.55 var(--sans); letter-spacing: -0.005em; color: var(--muted); }
@media (max-width: 480px) { .tab-panel > h2:first-child + p { font-size: 1.15rem; } }
/* "Why it matters" drawers under each item in a tab (see drawers in build.mjs) */
.drawer { margin: -0.25rem 0 0.5rem; }
.drawer > summary {
  display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; list-style: none;
  font: 600 0.9rem var(--sans); color: var(--accent);
}
.drawer > summary::-webkit-details-marker { display: none; }
.drawer > summary::before { content: ""; width: 0.45em; height: 0.45em; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(-45deg); transition: transform 0.15s; }
.drawer[open] > summary::before { transform: rotate(45deg); }
.drawer > summary:hover { text-decoration: underline; }
.drawer > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.drawer[open] > summary { margin-bottom: 0.5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 480px) { .tab-list [role="tab"] { font-size: 0.85rem; padding: 0.6rem 0.25rem; } }

/* "The Classics I Still Dip Into": a smaller sub-heading under the books on the Resources page */
.prose h3#the-classics-i-still-dip-into { font-size: 1.05rem; color: var(--muted); font-family: var(--sans); }
/* Podcast artwork and book covers on the Resources page */
#podcasts-i-listen-to + ul { --thumb-w: 100px; --thumb-h: 100px; }
#books-i-ve-been-reading-recently + ul, #the-classics-i-still-dip-into + ul { --thumb-w: 100px; --thumb-h: 150px; }
.prose ul:has(> li > .thumb) { list-style: none; padding-left: 0; }
.prose li:has(> .thumb) { position: relative; min-height: var(--thumb-h); padding-left: calc(var(--thumb-w) + 1rem); margin: 1.1rem 0; }
.prose .thumb { position: absolute; left: 0; top: 0.2rem; width: var(--thumb-w); height: auto; border-radius: 3px; box-shadow: 0 1px 4px rgb(0 0 0 / 0.2); }
/* People: round photos, or initials until a photo is added to assets/images/people/ */
.prose ul.people { --thumb-w: 64px; --thumb-h: 64px; }
.prose .people .thumb { height: var(--thumb-h); border-radius: 50%; object-fit: cover; }
.prose .people .initials { display: flex; align-items: center; justify-content: center; background: var(--code-bg); color: var(--muted); font: 600 1.1rem var(--sans); letter-spacing: 0.03em; }
/* People and podcasts: the name, then icon links (LinkedIn, GitHub, Apple Podcasts, Spotify, YouTube, website) */
.prose .entry { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem 0.75rem; margin-bottom: 0.1rem; }
.prose .entry-links { display: inline-flex; gap: 0.6rem; }
.prose .entry-links .icon { width: 17px; height: 17px; }
/* Books: author after the title, and a small "Buy from" line of store links */
.prose .entry-by { font: 0.9rem var(--sans); color: var(--muted); }
.prose .entry-by::before { content: "by "; }
/* Books and podcasts: more room between items, and between the title, description, store links and tags */
.prose :is(.books, .podcasts) > li { margin: 0 0 2.25rem; }
.prose :is(.books, .podcasts) .desc { display: block; margin-top: 0.4rem; }
.prose :is(.books, .podcasts) > li > .tags { margin-top: 0.75rem; }
.prose .books .buy { display: block; margin-top: 0.6rem; font: 0.85rem/1.5 var(--sans); color: var(--muted); }
.prose .books .buy a { color: inherit; }
.prose .books .buy a:hover { color: var(--accent); }

/* Closing line at the end of a page */
.prose .closing { margin-top: 3rem; }

/* Cards on pages with **Cards:** yes (see cardify in build.mjs) */
.prose .cards { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.prose .cards + p { margin-top: 1.75rem; }
.prose .card {
  margin: 0; padding: 1.1rem 1.2rem 1.2rem; display: flex; flex-direction: column;
  border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: 6px; background: var(--code-bg);
}
.card-icon { display: inline-flex; color: var(--accent); margin-bottom: 0.5rem; }
.card-icon .icon { width: 24px; height: 24px; }
.prose .card h3 { margin: 0 0 0.35rem; font: 700 1.05rem/1.3 var(--sans); }
.prose .card p { margin: 0; font: 0.9rem/1.55 var(--sans); }
.prose .card .card-why { margin-top: auto; padding-top: 0.75rem; color: var(--muted); }
.why-label {
  display: inline-block; margin-right: 0.35rem; padding: 0 0.45rem; border-radius: 999px;
  font: 600 0.68rem/1.6 var(--sans); letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--accent); background: var(--bg); border: 1px solid var(--rule); vertical-align: 0.1em;
}
@media (max-width: 600px) { .prose .cards { grid-template-columns: 1fr; } }

/* Boxed section: wrap Markdown in <section class="box"> ... </section> with blank lines inside */
.prose .box { margin: 2.5rem 0 0; padding: 0.25rem 1.5rem 0.5rem; border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: 6px; background: var(--code-bg); }
.prose .box > h2 { margin-top: 1.25rem; }
.prose .box > h2 + p { font: 600 1.15rem/1.5 var(--sans); color: var(--accent); }

/* Timeline on pages with **Timeline:** yes (see timeline in build.mjs) */
.timeline { list-style: none; margin: 2.5rem 0 0; padding: 0 0 0 2rem; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 0.45rem; top: 0.6rem; bottom: 0.5rem; width: 2px;
  background: linear-gradient(var(--accent), var(--rule) 85%);
}
.prose .tl-item { position: relative; margin: 0 0 2.75rem; }
.tl-item::before {
  content: ""; position: absolute; left: -1.95rem; top: 0.35rem; width: 0.9rem; height: 0.9rem;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--accent);
}
.tl-item:first-child::before { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.tl-when {
  display: inline-block; margin: 0 0 0.4rem; padding: 0.1rem 0.6rem; border-radius: 999px;
  font: 600 0.75rem/1.6 var(--sans); letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--accent); background: var(--code-bg); border: 1px solid var(--rule);
}
.prose .tl-item h2 { margin: 0; font-size: 1.4rem; }
.tl-role { margin: 0.1rem 0 0.75rem; font: 600 0.95rem/1.4 var(--sans); color: var(--muted); }
.tl-tools { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0 !important; margin: 0.9rem 0 0; }
.prose .tl-tools li { margin: 0; padding: 0.1rem 0.55rem; border: 1px solid var(--rule); border-radius: 4px; font: 0.8rem/1.5 var(--sans); color: var(--muted); }
.prose .tags { padding: 0; }
.prose .tags li { margin: 0; }
.prose .tl-item .tags { margin: 0 0 1rem; }
.prose p + .tags { margin: 0.9rem 0 2.5rem; }
.prose h2 + .tags { margin: 0 0 1rem; }
/* Company logos on the About Me page (the names are in the text above, so the list is hidden from screen readers) */
.prose .logos { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem 2rem; padding: 0; margin: 1.25rem 0 1.5rem; }
.prose .logos li { margin: 0; }
.prose .logos img { display: block; height: 36px; width: auto; max-width: 100%; }
/* Tags under an item on the Resources page */
.prose li > .tags { margin: 0.5rem 0 0; }
@media (max-width: 480px) { .timeline { padding-left: 1.6rem; } .tl-item::before { left: -1.55rem; } }

@media (max-width: 480px) { .site-header nav { gap: 0.9rem; } }

/* Watermark: rainbow bars hanging from the top right, and the same bars rising from the bottom left. */
html { position: relative; min-height: 100%; }
body::before, body::after {
  content: "";
  position: absolute;
  width: 230px;
  height: 65px;
  background: url("watermark.svg") no-repeat center / contain;
  opacity: 0.3;
  pointer-events: none;
  z-index: -1;
}
body::before { top: 0; right: 0; }
body::after { bottom: 0; left: 0; transform: scale(-1, -1); }
@media (prefers-color-scheme: dark) { body::before, body::after { opacity: 0.35; } }
@media (max-width: 700px) { body::before, body::after { width: 100px; height: 28px; } }

/* Footer: right aligned, away from the bottom-left watermark */
.site-footer { text-align: right; }
.site-footer .social { justify-content: flex-end; }

/* Soft skills on The Human Side and "What They Have In Common" on How I Build: an illustration beside the intro, then an open two-column list with icons (no boxes) */
.prose .figure-intro { display: flex; align-items: center; gap: 1.75rem; margin: 1rem 0 1.5rem; }
.prose .figure-intro img { flex: none; height: auto; }
.prose .figure-intro p { margin: 0; }
.prose .features { list-style: none; padding: 0; margin: 1.5rem 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.6rem 2.25rem; }
.prose .features li { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto 1fr; align-content: start; column-gap: 0.9rem; margin: 0; }
.prose .feature-icon { grid-row: span 2; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--code-bg); color: var(--accent); }
.prose .feature-icon .icon { width: 20px; height: 20px; }
.prose .features h3 { margin: 0.1rem 0 0.25rem; font: 700 1rem/1.3 var(--sans); }
.prose .features p { margin: 0; font: 0.9rem/1.55 var(--sans); color: var(--muted); }
@media (max-width: 600px) {
  .prose .figure-intro { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .prose .figure-intro img { max-width: 160px; }
  .prose .features { grid-template-columns: 1fr; }
}

/* Home page: a row of round icons under the intro, linking to each main page (site.navIcons in build.mjs) */
.section-links { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1rem 0.5rem; margin: 2rem 0 0.5rem; }
.section-links a { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; text-align: center; text-decoration: none; color: var(--muted); font: 0.85rem/1.3 var(--sans); }
.section-icon { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 50%; background: var(--code-bg); color: var(--accent); transition: background 0.15s, color 0.15s; }
.section-icon .icon { width: 22px; height: 22px; }
.section-links a:hover { color: var(--accent); }
.section-links a:hover .section-icon { background: var(--accent); color: var(--bg); }
@media (max-width: 600px) { .section-links { grid-template-columns: repeat(3, 1fr); } }
