/* ---------------------------------------------------------------------------
   Belgians in SF — a plain, framework-free stylesheet.
   Warm, friendly, highly readable. Black / yellow / red as subtle Belgian
   accents only. Light theme only.
--------------------------------------------------------------------------- */

:root {
  /* Warm, neutral light theme — no black/yellow/red accents. */
  --bg: #fbf8f2;
  --bg-raised: #ffffff;
  --bg-sunken: #f3eee3;
  --text: #2b2825;
  --text-soft: #6b6559;
  --text-faint: #94897a;
  --border: #e7dfce;
  --border-strong: #d8cdb5;
  --accent: #9a8f7a;         /* subtle warm-gray accent (focus, markers) */
  --accent-strong: #57503f;  /* stronger neutral accent (buttons, active) */
  --link: #2b2825;           /* neutral ink links */
  --link-hover: #141210;
  --brand-blue: #0073e6;     /* Julie's website blue — used only for her links */
  --brand-blue-hover: #0062c4;
  --shadow: 0 1px 2px rgba(40, 33, 20, 0.04), 0 8px 24px rgba(40, 33, 20, 0.06);
  --shadow-sm: 0 1px 2px rgba(40, 33, 20, 0.05);

  --font-body: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-ui: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 1200px;
  --sidebar-w: 260px;
  --content-w: 720px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2, h3, h4, nav, button, input, select, textarea, .ui { font-family: var(--font-ui); }

h1, h2, h3, h4 { line-height: 1.2; color: var(--text); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 2.3rem; margin: 0 0 0.4em; }
h2 { font-size: 1.5rem; margin: 2.2rem 0 0.7rem; }
h3 { font-size: 1.18rem; margin: 1.8rem 0 0.5rem; }

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent);
}
a:hover { color: var(--link-hover); text-decoration-color: currentColor; }

p { margin: 0 0 1.1rem; }
ul, ol { margin: 0 0 1.2rem; padding-left: 1.3em; }
li { margin: 0.4rem 0; }
li::marker { color: var(--accent); }
strong { font-weight: 700; color: var(--text); }
em { font-style: italic; }

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--bg-sunken);
  padding: 0.1em 0.4em;
  border-radius: 5px;
}

hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }
img { max-width: 100%; height: auto; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Heading anchor links */
.heading-anchor {
  margin-left: 0.4em; color: var(--text-faint); text-decoration: none;
  opacity: 0; transition: opacity 0.15s ease, color 0.15s ease; font-weight: 400;
}
h2:hover .heading-anchor, h3:hover .heading-anchor, h4:hover .heading-anchor,
.heading-anchor:focus-visible { opacity: 1; }
.heading-anchor:hover { color: var(--accent); }
@media (hover: none) { .heading-anchor { opacity: 0.4; } }

/* Buttons */
.btn {
  font-family: var(--font-ui); font-weight: 600; font-size: 0.95rem;
  display: inline-flex; align-items: center; gap: 0.5em;
  padding: 0.7em 1.3em; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: transform 0.08s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent-strong); color: var(--bg); border-color: var(--accent-strong); }
.btn-primary:hover { background: #453f31; color: var(--bg); }
.btn-ghost { background: var(--bg-raised); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--text-soft); }
.btn-blue { background: var(--brand-blue); color: #fff; border-color: var(--brand-blue); }
.btn-blue:hover { background: var(--brand-blue-hover); color: #fff; }
.btn-blue-outline { background: var(--bg-raised); color: var(--brand-blue); border-color: var(--brand-blue); }
.btn-blue-outline:hover { background: color-mix(in srgb, var(--brand-blue) 8%, var(--bg-raised)); color: var(--brand-blue); }

/* Skip link */
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--accent-strong); color: var(--bg);
  padding: 0.6rem 1rem; border-radius: 0 0 8px 0; font-weight: 600; text-decoration: none;
}
.skip-link:focus { left: 0; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 1rem; padding: 0.7rem 1.25rem;
}
.menu-toggle {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--bg-raised);
  color: var(--text); cursor: pointer; flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 0.65rem; text-decoration: none; color: var(--text); flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand-sub { font-size: 0.75rem; color: var(--text-faint); }
.header-search { flex: 1; max-width: 420px; margin-left: auto; }

/* Layout shell */
.layout {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 2rem; padding: 0 1.25rem; align-items: start;
}
.sidebar {
  position: sticky; top: 92px; align-self: start;
  max-height: calc(100vh - 108px); overflow-y: auto;
  padding: 1.5rem 0.4rem 2rem 0;
}
.sidebar-mobile-search { display: none; margin-bottom: 1rem; }

.content-wrap {
  display: grid; grid-template-columns: minmax(0, 1fr) 220px;
  gap: 2.5rem; align-items: start; padding: 1.5rem 0 3rem;
}
.content-wrap.no-toc { grid-template-columns: minmax(0, 1fr); }
.main { min-width: 0; max-width: var(--content-w); }
.toc-rail { padding-top: 0.5rem; }
.toc-mobile { display: none; }

/* Sidebar nav */
.sidebar-nav { font-size: 0.95rem; }
.sidebar-heading {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint); font-weight: 700; margin: 1.6rem 0 0.5rem; padding-left: 0.6rem;
}
.sidebar-list { list-style: none; margin: 0; padding: 0; }
.sidebar-list li { margin: 2px 0; }
.sidebar-link {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.65rem; border-radius: var(--radius-sm);
  color: var(--text-soft); text-decoration: none; line-height: 1.3;
  border: 1px solid transparent; transition: background-color 0.12s ease, color 0.12s ease;
}
.sidebar-link:hover { background: var(--bg-sunken); color: var(--text); }
.sidebar-link.active {
  background: var(--bg-sunken);
  color: var(--text); font-weight: 600;
  border-color: var(--border-strong);
}
.sidebar-home { font-weight: 600; color: var(--text); }
.sidebar-num {
  font-size: 0.72rem; font-variant-numeric: tabular-nums; letter-spacing: 0.03em;
  color: var(--text-faint); min-width: 1.4rem; flex-shrink: 0;
}
.sidebar-link.active .sidebar-num { color: var(--accent-strong); }

/* Table of contents */
.toc { position: sticky; top: 92px; font-size: 0.85rem; max-height: calc(100vh - 120px); overflow-y: auto; }
.toc-title {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint); font-weight: 700; margin: 0 0 0.6rem;
}
.toc-list { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.toc-item a {
  display: block; padding: 0.32rem 0 0.32rem 0.85rem; margin-left: -2px;
  border-left: 2px solid transparent; color: var(--text-soft);
  text-decoration: none; line-height: 1.35;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.toc-sub a { padding-left: 1.7rem; font-size: 0.8rem; }
.toc-item a:hover { color: var(--text); }
.toc-item a.is-active { color: var(--link); border-left-color: var(--accent); font-weight: 600; }

/* Search */
.search { position: relative; width: 100%; }
.search-box {
  display: flex; align-items: center; gap: 0.55rem;
  background: var(--bg-raised); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 0 0.7rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.search-icon { color: var(--text-faint); flex-shrink: 0; }
.search-input {
  flex: 1; border: none; background: transparent; color: var(--text);
  font-size: 0.95rem; padding: 0.6rem 0; outline: none; min-width: 0;
}
.search-input::placeholder { color: var(--text-faint); }
.search-kbd {
  font-size: 0.72rem; color: var(--text-faint); border: 1px solid var(--border-strong);
  border-radius: 5px; padding: 0.05rem 0.4rem; background: var(--bg-sunken);
}
@media (max-width: 640px) { .search-kbd { display: none; } }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--bg-raised); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow);
  max-height: min(60vh, 420px); overflow-y: auto; z-index: 60; padding: 0.4rem;
}
.search-results[hidden] { display: none; }
.search-result {
  display: block; padding: 0.6rem 0.7rem; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text); border: 1px solid transparent;
}
.search-result:hover, .search-result.is-active { background: var(--bg-sunken); }
.sr-crumb {
  font-family: var(--font-ui); font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-faint);
  display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.15rem;
}
.sr-title { font-family: var(--font-ui); font-weight: 600; font-size: 0.95rem; display: block; }
.sr-snippet {
  font-family: var(--font-ui); font-size: 0.82rem; color: var(--text-soft); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 0.1rem;
}
.search-result mark {
  background: color-mix(in srgb, var(--accent-strong) 22%, transparent);
  color: inherit; border-radius: 3px; padding: 0 1px;
}
.search-empty {
  padding: 1rem 0.7rem; font-family: var(--font-ui); font-size: 0.9rem;
  color: var(--text-soft); text-align: center;
}

/* Cards (home) */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem; margin-top: 1.2rem;
}
.card {
  position: relative; display: flex; align-items: flex-start; gap: 1rem;
  padding: 1.3rem 1.3rem 1.3rem 1.4rem; background: var(--bg-raised);
  border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm); overflow: hidden;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}
.card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--card-accent); }
.accent-yellow, .accent-red, .accent-black { --card-accent: var(--border-strong); }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.card-num {
  font-size: 0.85rem; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--text-faint); flex-shrink: 0; margin-top: 0.15rem; min-width: 1.6rem;
}
.card-body { display: flex; flex-direction: column; gap: 0.25rem; }
.card-title { font-weight: 700; font-size: 1.12rem; letter-spacing: -0.01em; }
.card-desc { color: var(--text-soft); font-size: 0.92rem; line-height: 1.5; }
.card-arrow { margin-left: auto; align-self: center; color: var(--text-faint); font-size: 1.1rem; transition: transform 0.14s ease, color 0.14s ease; }
.card:hover .card-arrow { transform: translateX(3px); color: var(--accent); }

/* Hero */
.hero { padding: 1.5rem 0 2.5rem; }
.hero-kicker {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-faint); margin: 0 0 1rem; padding-left: 0.9rem; position: relative;
}
.hero-kicker::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 0.85em; background: var(--border-strong); border-radius: 2px;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); max-width: 15ch; margin-bottom: 0.6rem; }
.hero-lede { font-size: 1.18rem; color: var(--text-soft); max-width: 54ch; margin-bottom: 1.6rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.grid-title { margin-top: 0.5rem; }

/* Section article */
.crumbs { display: flex; gap: 0.5rem; align-items: center; font-size: 0.82rem; color: var(--text-faint); margin-bottom: 1.2rem; }
.crumbs a { color: var(--text-soft); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.section-head { margin-bottom: 1.8rem; }
.section-count { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); font-weight: 700; margin: 0 0 0.4rem; }
.section-head h1 { margin: 0 0 0.5rem; }
.section-desc { font-size: 1.15rem; color: var(--text-soft); margin: 0; max-width: 58ch; }

.prose h2 { scroll-margin-top: 92px; padding-top: 0.4rem; }
.prose h3 { scroll-margin-top: 92px; }
.prose ul { padding-left: 1.2em; }
.prose li { padding-left: 0.2em; }
.prose a { font-weight: 500; }

.section-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.section-nav-link {
  display: flex; flex-direction: column; gap: 0.2rem; text-decoration: none;
  padding: 0.8rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-raised); max-width: 48%;
  transition: border-color 0.14s ease, transform 0.1s ease;
}
.section-nav-link:hover { border-color: var(--accent); transform: translateY(-2px); }
.section-nav-link.next { text-align: right; align-items: flex-end; }
.nav-dir { font-size: 0.75rem; color: var(--text-faint); font-weight: 600; }
.nav-title { font-weight: 600; color: var(--text); font-size: 0.95rem; }

/* About */
.about-signoff { color: var(--text-soft); font-style: italic; margin-top: 1.6rem; line-height: 1.6; }
.about-links { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.6rem; }

/* 404 */
.notfound { padding: 3rem 0; max-width: 40ch; }
.notfound p { color: var(--text-soft); font-size: 1.1rem; margin-bottom: 1.6rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); margin-top: 2rem; background: var(--bg-sunken); }
.footer-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 1.6rem 1.25rem;
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between;
  font-size: 0.88rem; color: var(--text-soft);
}
.footer-inner p { margin: 0; }

/* Off-canvas scrim */
.scrim { display: none; position: fixed; inset: 0; background: rgba(20, 16, 8, 0.45); z-index: 40; }

/* Table-of-contents (mobile collapsible) */
.toc-mobile summary {
  cursor: pointer; font-weight: 600; font-size: 0.9rem; padding: 0.7rem 0.9rem;
  background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius-sm);
  list-style: none; color: var(--text);
}
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary::after { content: ' \2304'; color: var(--text-faint); }
.toc-mobile[open] { margin-bottom: 1.5rem; }
.toc-mobile .toc { position: static; padding: 0.4rem 0.9rem 0.9rem; max-height: none;
  border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.toc-mobile .toc-title { display: none; }

/* Responsive */
@media (max-width: 1080px) {
  .content-wrap, .content-wrap.no-toc { grid-template-columns: minmax(0, 1fr); }
  .toc-rail { display: none; }
  .toc-mobile { display: block; }
  .main { max-width: none; }
}
@media (max-width: 820px) {
  .menu-toggle { display: inline-flex; }
  .header-search { display: none; }
  .sidebar-mobile-search { display: block; }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .sidebar {
    position: fixed; top: var(--header-h, 66px); left: 0; bottom: 0; width: min(84vw, 320px);
    max-height: none; background: var(--bg-raised); border-right: 1px solid var(--border);
    box-shadow: var(--shadow); z-index: 45; padding: 1.25rem;
    transform: translateX(-100%); transition: transform 0.22s ease; overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); }
  .scrim.show { display: block; }
  body.drawer-open { overflow: hidden; }
  .section-nav-link { max-width: 47%; }
}
