/* All colours come from site.config.json ("colors"). Change them there, not here. */
:root { --font-ui: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif; --font-read: "Literata", Georgia, serif; --radius: 16px; --page: 1200px; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.6 var(--font-ui); }
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; left: 16px; top: 16px; z-index: 20; background: var(--bg); padding: 10px 14px; border-radius: 8px; }
.container { max-width: var(--page); margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 760px; }
.meta { margin: 0; font-size: 14px; color: var(--muted); }

/* header */
.site-header { position: relative; border-bottom: 1px solid var(--line); }
.masthead { text-align: center; padding-top: 28px; padding-bottom: 4px; }
.brand { display: inline-block; font-weight: 700; font-size: clamp(28px, 5vw, 44px); letter-spacing: -.02em; color: var(--ink); }
.brand:hover { text-decoration: none; }
.tagline { margin: 4px 0 0; color: var(--muted); }
.nav-desktop { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 28px; padding-top: 14px; padding-bottom: 14px; }
.nav-desktop a { color: var(--muted); font-weight: 500; padding: 8px 0; }
.nav-desktop a:hover { color: var(--ink); text-decoration: none; }
.nav-desktop a[aria-current="page"] { color: var(--accent); font-weight: 700; }
.nav-mobile { display: none; }
.nav-mobile summary { list-style: none; cursor: pointer; min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 18px; border: 1px solid var(--line); border-radius: 99px; font-weight: 700; }
.nav-mobile summary::-webkit-details-marker { display: none; }
.nav-mobile nav { position: absolute; left: 0; right: 0; top: 100%; z-index: 10; display: flex; flex-direction: column; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 24px 16px; }
.nav-mobile nav a { color: var(--ink); font-weight: 500; padding: 12px 0; border-bottom: 1px solid var(--line); }
.nav-mobile nav a[aria-current="page"] { color: var(--accent); font-weight: 700; }
@media (max-width: 820px) {
  .nav-desktop, .tagline { display: none; }
  .nav-mobile { display: block; }
  .masthead { display: flex; align-items: center; justify-content: space-between; text-align: left; padding-top: 10px; padding-bottom: 10px; }
}

/* shared pieces */
.section-title { margin: 0 0 16px; font-size: 26px; line-height: 1.2; }
.page-title { margin: 48px 0 8px; font-size: clamp(32px, 5vw, 44px); line-height: 1.15; letter-spacing: -.01em; }
.lede { font-family: var(--font-read); font-size: 18px; line-height: 1.65; color: var(--muted); margin: 8px 0 0; }
.pill { align-self: flex-start; font-size: 13px; font-weight: 700; color: var(--accent); background: var(--soft); padding: 4px 12px; border-radius: 99px; }
.cover { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); background: var(--ph, var(--soft)); overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.block { padding: 8px 0 56px; }
.more { margin: 24px 0 0; font-weight: 700; }

/* home */
.lead { display: grid; grid-template-columns: 2fr 1fr; gap: 56px; padding: 48px 0; }
.featured { display: flex; flex-direction: column; gap: 14px; color: var(--ink); }
.featured:hover { text-decoration: none; }
.featured:hover .featured-title { color: var(--accent); }
.cover-lg { aspect-ratio: 16 / 8; }
.featured-title { margin: 0; font-size: clamp(28px, 4vw, 40px); line-height: 1.15; letter-spacing: -.01em; }
.guides ol { list-style: none; margin: 0; padding: 0; }
.guides .section-title { padding-bottom: 12px; border-bottom: 2px solid var(--ink); font-size: 20px; margin-bottom: 0; }
.guide { display: flex; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.guide:hover { text-decoration: none; }
.guide:hover .guide-title { color: var(--accent); }
.guide-n { font-size: 28px; font-weight: 700; color: var(--accent); min-width: 28px; line-height: 1.2; }
.guide-title { display: block; font-weight: 600; font-size: 17px; line-height: 1.35; margin-bottom: 4px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px 24px; }
.card { display: flex; flex-direction: column; gap: 12px; color: var(--ink); }
.card:hover { text-decoration: none; }
.card:hover .card-title { color: var(--accent); }
.card-title { margin: 0; font-size: 20px; line-height: 1.3; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.tile { display: flex; flex-direction: column; justify-content: space-between; gap: 12px; min-height: 170px; padding: 24px; border-radius: 20px; background: var(--tile); color: var(--tile-ink); }
.tile:hover { text-decoration: none; filter: brightness(.96); }
.tile-count { font-size: 14px; font-weight: 700; }
.tile-name { font-size: 24px; font-weight: 700; line-height: 1.2; }
.tile-desc { font-size: 15px; line-height: 1.45; }
.page-title + .tiles { margin-top: 32px; }

/* lists (topic, series, archive) */
.rows { list-style: none; margin: 24px 0 56px; padding: 0; }
.row { display: grid; grid-template-columns: 110px 1fr auto; gap: 16px; align-items: baseline; padding: 16px 0; border-top: 1px solid var(--line); color: var(--ink); }
.row:hover { text-decoration: none; }
.row:hover .row-title { color: var(--accent); }
.row-date, .row-meta { font-size: 14px; color: var(--muted); }
.row-title { font-weight: 600; font-size: 18px; line-height: 1.35; }
.year-group h2 { margin: 40px 0 0; font-size: 22px; }
.year-group .rows { margin-top: 8px; margin-bottom: 0; }
.search { display: flex; flex-direction: column; gap: 6px; margin-top: 24px; font-size: 14px; font-weight: 700; color: var(--muted); }
.search input { font: inherit; font-weight: 400; color: var(--ink); background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-height: 48px; }
@media (max-width: 900px) {
  .lead { grid-template-columns: 1fr; gap: 40px; padding-top: 32px; }
  .grid, .tiles { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .grid, .tiles { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; gap: 4px; }
  .row-meta { order: 2; }
}

/* post page */
.post-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 64px; justify-content: center; padding-top: 32px; padding-bottom: 64px; }
@media (min-width: 1100px) { .post-layout { grid-template-columns: minmax(0, 720px) 220px; } }
.post { min-width: 0; }
.crumb { margin: 0 0 16px; font-size: 14px; color: var(--muted); }
.post-title { margin: 0 0 12px; font-size: clamp(30px, 5vw, 44px); line-height: 1.15; letter-spacing: -.01em; }
.series-box { margin: 28px 0; border: 1px solid var(--line); background: var(--soft); border-radius: 14px; padding: 4px 20px; font-size: 15px; }
.series-box summary { cursor: pointer; font-weight: 700; padding: 14px 0; min-height: 44px; }
.series-box ol { margin: 0 0 14px; padding-left: 22px; }
.series-box li { padding: 4px 0; }
.series-box a[aria-current="page"] { color: var(--ink); font-weight: 700; pointer-events: none; }
.side { min-width: 0; }
.toc { position: sticky; top: 24px; font-size: 14px; max-height: calc(100vh - 48px); overflow: auto; border-left: 2px solid var(--line); padding-left: 16px; }
.toc-title { margin: 0 0 8px; font-weight: 700; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { padding: 4px 0; line-height: 1.35; }
.toc a { color: var(--muted); }
.toc a:hover { color: var(--accent); }
.toc-l3 { padding-left: 12px; }
.toc-mobile { margin: 20px 0; border: 1px solid var(--line); border-radius: 14px; padding: 0 20px; }
.toc-mobile summary { cursor: pointer; font-weight: 700; padding: 14px 0; min-height: 44px; }
.toc-mobile .toc { position: static; border: 0; padding: 0 0 14px; max-height: none; }
.toc-mobile .toc-title { display: none; }
@media (min-width: 1100px) { .toc-mobile { display: none; } }
@media (max-width: 1099px) { .side { display: none; } }

.prose { font-family: var(--font-read); font-size: 19px; line-height: 1.75; margin-top: 32px; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose h2, .prose h3 { font-family: var(--font-ui); line-height: 1.25; letter-spacing: -.01em; margin: 2.2em 0 .6em; scroll-margin-top: 16px; }
.prose h2 { font-size: 28px; }
.prose h3 { font-size: 22px; }
.prose p, .prose ul, .prose ol, .prose figure, .prose blockquote { margin: 0 0 1.3em; }
.prose li { margin: .3em 0; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose img { display: block; margin: 1.6em auto; border-radius: 10px; }
.prose blockquote { border-left: 4px solid var(--accent); padding: 4px 0 4px 20px; color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.prose :not(pre) > code { font-size: .85em; background: var(--soft); border-radius: 6px; padding: .12em .4em; }
.table-wrap { overflow-x: auto; margin: 0 0 1.3em; }
.prose table { border-collapse: collapse; font-family: var(--font-ui); font-size: 16px; min-width: 100%; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--soft); }

/* code blocks (always dark, in light and dark mode) */
pre.code { position: relative; margin: 1.6em 0; padding: 20px; background: var(--code); color: #e6e8f5; border-radius: 12px; overflow-x: auto; font-size: 14.5px; line-height: 1.6; -webkit-overflow-scrolling: touch; }
pre.code code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: none; padding: 0; font-size: inherit; }
pre.code[data-lang]::before { content: attr(data-lang); position: absolute; top: 6px; right: 12px; font: 12px var(--font-ui); color: #9ea2c4; }
.hljs-comment, .hljs-quote { color: #8d92b8; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-built_in { color: #c4b5fd; }
.hljs-string, .hljs-regexp, .hljs-addition { color: #a7f3d0; }
.hljs-number, .hljs-symbol, .hljs-bullet { color: #fdba74; }
.hljs-title, .hljs-section, .hljs-name, .hljs-type, .hljs-class .hljs-title { color: #93c5fd; }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable, .hljs-property { color: #fcd34d; }
.hljs-meta, .hljs-doctag { color: #f9a8d4; }
.hljs-deletion { color: #fca5a5; }

/* previous / next */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 56px; font-family: var(--font-ui); }
.pager-link { display: flex; flex-direction: column; gap: 6px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); }
.pager-link:hover { text-decoration: none; border-color: var(--accent); }
.pager-next { grid-column: 2; text-align: right; }
.pager-link:only-child { grid-column: auto; }
.pager-next:only-child { grid-column: 2; }
.pager-label { font-size: 14px; color: var(--muted); }
.pager-title { font-weight: 700; font-size: 18px; line-height: 1.3; }
@media (max-width: 600px) { .pager { grid-template-columns: 1fr; } .pager-next, .pager-next:only-child { grid-column: 1; text-align: left; } }

/* footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 24px; font-size: 14px; color: var(--muted); }
.foot { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; padding-top: 28px; padding-bottom: 28px; }
.foot nav { display: flex; gap: 20px; flex-wrap: wrap; }
.foot a { color: var(--muted); padding: 6px 0; display: inline-block; }
.foot a:hover { color: var(--accent); }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
