/* Westerberg — shared site styles */

:root {
  --bg: #f8f6f2;
  --paper: #ffffff;
  --ink: #1c1b19;
  --ink-2: #322f2b;
  --ink-3: #5c5850;
  --ink-4: #928d83;
  --rule: #e4ded2;
  --cream: #f0ead9;
  --sand: #e8ddc7;
  --accent: #8a3324;
  --brand-gray: #4d473f;
  --brand-orange: #c1440e;

  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "URW Palladio L", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --brand-font: "Jersey 25", var(--sans);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.6;
}
a { color: inherit; }
img { max-width: 100%; display: block; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 24px; }

/* ── Topbar ── */
.topbar {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  font-family: var(--brand-font);
  font-size: 2rem;
  font-weight: 400;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}
.brand .brand-1 { color: var(--brand-gray); }
.brand .brand-2 { color: var(--brand-orange); }
.nav-links { display: flex; gap: 28px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  padding-bottom: 4px;
}
.nav-links a:hover,
.nav-links a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ── Hero (start page + category pages) ── */
.hero { padding: 56px 0 40px; border-bottom: 1px solid var(--rule); }
.hero .eyebrow:empty { display: none; }
.hero .eyebrow {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin: 0 0 12px;
}
.hero h1 { font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 400; margin: 0 0 12px; }
.hero p.lede { font-size: 1.05rem; color: var(--ink-3); max-width: 640px; margin: 0; }

/* ── Hero card (home page, featured/latest article) ── */
.hero-card-wrap { padding: 40px 0; border-bottom: 1px solid var(--rule); }
.hero-card {
  display: block;
  text-decoration: none;
  color: inherit;
}
.hero-card-media { aspect-ratio: 3 / 1; background: var(--sand); overflow: hidden; }
.hero-card-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-card-body {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 40px;
  align-items: start;
  margin-top: 28px;
}
.hero-card .tag {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.hero-card h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); font-weight: 400; margin: 0; line-height: 1.15; }
.hero-card-body p { font-size: 1.05rem; color: var(--ink-3); margin: 0; line-height: 1.55; }

@media (max-width: 760px) {
  .hero-card-media { aspect-ratio: 16 / 10; }
  .hero-card-body { grid-template-columns: 1fr; gap: 12px; margin-top: 20px; }
}

/* ── Card grid ── */
.card-grid-wrap { padding: 40px 0 64px; }
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  background: var(--rule);
}
.card {
  background: var(--paper);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}
.card-thumb {
  aspect-ratio: 4 / 3;
  background: var(--sand);
  overflow: hidden;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-thumb.portrait img { object-fit: contain; background: var(--paper); }
.card-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.card .tag {
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 8px;
}
.card h3 { font-size: 1.1rem; font-weight: 400; margin: 0 0 8px; }
.card p { font-size: 0.9rem; color: var(--ink-3); margin: 0; line-height: 1.5; }
.card-placeholder { background: var(--bg); }

.empty-note {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink-4);
  padding: 24px 0;
}

@media (max-width: 860px) { .card-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .card-grid { grid-template-columns: 1fr; } .nav-links { gap: 16px; } }

/* ── Article reader ── */
.page { max-width: 720px; margin: 0 auto; padding: 3rem 24px 5rem; }
.doc-meta {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-4);
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}
.doc-meta a { color: var(--accent); text-decoration: none; }
.doc-title { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 400; margin: 0 0 12px; line-height: 1.2; }
.doc-subtitle { font-size: 1.05rem; color: var(--ink-3); margin: 0 0 2.5rem; }
.doc-body { font-size: 1.05rem; }
.doc-body h2 { font-family: var(--sans); font-size: 1.3rem; font-weight: 600; margin: 2.5rem 0 1rem; }
.doc-body h3 { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; margin: 2rem 0 0.75rem; }
.doc-body p { margin: 0 0 1.25rem; }
.doc-body a { color: var(--accent); }
.doc-body blockquote {
  margin: 1.5rem 0;
  padding-left: 1.25rem;
  border-left: 3px solid var(--rule);
  color: var(--ink-3);
  font-style: italic;
}
.doc-body img { margin: 1.5rem 0; }
.doc-body code { background: var(--cream); padding: 0.1em 0.3em; font-size: 0.9em; }
.doc-body pre { background: var(--cream); padding: 1rem; overflow-x: auto; }

/* ── Table of contents ── */
#toc {
  position: fixed;
  top: 3.5rem;
  /* sit just left of the 720px centred content column (see .page) */
  left: max(12px, calc(50vw - 580px));
  width: 196px;
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
  padding-bottom: 2rem;
}
.toc-label {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 0.75rem;
}
#toc-list { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--rule); }
#toc-list li { margin: 0; }
#toc-list a {
  display: block;
  font-family: var(--sans);
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--ink-4);
  text-decoration: none;
  padding: 0.3rem 0 0.3rem 0.85rem;
  transition: color .15s;
}
#toc-list a:hover { color: var(--ink-2); }
#toc-list a[aria-current] { color: var(--ink); font-weight: 600; }
#toc-list .toc-h3 > a { padding-left: 1.5rem; font-size: 0.8rem; }

#toc-cb { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }

/* Transparent backdrop — second label for the same checkbox, closes the panel on outside tap */
#toc-backdrop { display: none; position: fixed; inset: 0; z-index: 99; }

#toc-toggle {
  display: none;
  position: fixed;
  top: 1rem; right: 1rem;
  z-index: 101;
  appearance: none;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 8px;
  width: 38px; height: 38px;
  cursor: pointer;
  align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  color: var(--ink-3);
  transition: color .15s, background .15s;
}
#toc-toggle:hover { color: var(--ink); background: var(--cream); }
#toc-toggle svg { width: 16px; height: 16px; display: block; }

@media (max-width: 1080px) {
  #toc {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    width: auto;
    max-height: 70vh;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    z-index: 100;
    padding: 3.5rem 1.5rem 1.5rem;
    overflow-y: auto;
  }
  #toc-toggle { display: inline-flex; }
}
/* CSS-only toggle and backdrop — works without JavaScript */
@media (max-width: 1080px) {
  body:has(#toc-cb:checked) #toc { display: block !important; }
  body:has(#toc-cb:checked) #toc-backdrop { display: block; }
  #toc-list { border-left: 0; }
  #toc-list a { padding: 0.5rem 0; font-size: 0.9rem; }
  #toc-list .toc-h3 > a { padding-left: 1rem; font-size: 0.85rem; }
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 32px 0;
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--ink-4);
}
