/* Drawnscale editorial theme: a clean, print-inspired system for the recovered content. */
:root {
  color-scheme: light;
  --color-bg: #f4f1eb;
  --color-paper: #fffdf9;
  --color-surface: #fffdf9;
  --color-surface-muted: #ebe6dd;
  --color-border: #d8d0c4;
  --color-border-strong: #1f2521;
  --color-text: #1f2521;
  --color-text-muted: #716d65;
  --color-brand: #a33b2e;
  --color-brand-strong: #822c23;
  --color-focus: #a33b2e;
  --font-sans: "Segoe UI", Arial, Helvetica, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --text-xs: .72rem;
  --text-sm: .86rem;
  --text-base: 1rem;
  --text-lg: 1.18rem;
  --text-xl: clamp(1.55rem, 2.5vw, 2.1rem);
  --text-2xl: clamp(2.45rem, 6vw, 5.4rem);
  --line-tight: 1.04;
  --line-normal: 1.62;
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 5rem;
  --radius-sm: .2rem;
  --radius-md: .3rem;
  --radius-lg: .45rem;
  --radius-pill: 9999px;
  --shadow-sm: 0 1px 0 rgba(31, 37, 33, .04);
  --shadow-md: 0 12px 35px rgba(31, 37, 33, .08);
  --shadow-focus: 0 0 0 3px rgba(163, 59, 46, .22);
  --content-max: 72rem;
  --header-height: 5rem;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { text-size-adjust: 100%; font-synthesis: none; scroll-behavior: smooth; }
body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--line-normal);
}
body::before { content: ""; display: block; height: .3rem; background: var(--color-brand); }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--color-brand); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--color-text);
  outline-offset: 3px;
  box-shadow: none;
}
/* The skip-link target receives focus programmatically; don't frame the whole page. */
main[tabindex]:focus-visible { outline: none; }
img { max-width: 100%; display: block; }
p, h1, h2, h3, h4, ul, ol, dl { margin-top: 0; }
h1, h2, h3, h4 { color: var(--color-text); font-family: var(--font-serif); font-weight: 700; letter-spacing: -.025em; }
h2, h3, h4 { line-height: 1.12; }
.container { width: min(100% - 2rem, var(--content-max)); margin-inline: auto; }
.surface { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 0; box-shadow: var(--shadow-sm); }

.skip-link {
  position: absolute; left: var(--space-4); top: -100%; z-index: 100;
  padding: .55rem .8rem; background: var(--color-brand); color: #fff;
  font-weight: 700;
}
.skip-link:focus-visible { top: var(--space-3); }

.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 253, 249, .94);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(12px);
}
.site-header .inner {
  min-height: var(--header-height);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-5);
}
.brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--color-text); }
.brand img { width: 1.45rem; height: 1.45rem; filter: sepia(.25) saturate(1.7); }
.brand span { font-family: var(--font-serif); font-size: 1.65rem; font-weight: 700; letter-spacing: -.045em; }
.site-header nav ul, .footer-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 1.15rem; list-style: none; margin: 0; padding: 0; }
.site-header nav a { color: var(--color-text-muted); font-size: var(--text-sm); font-weight: 700; letter-spacing: .045em; text-transform: uppercase; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { color: var(--color-brand); }
.site-header nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .4rem; }

main { padding-block: var(--space-8); }
.hero { display: grid; gap: var(--space-5); padding-block: var(--space-6) var(--space-8); border-bottom: 1px solid var(--color-border-strong); }
.hero::before { content: "The Drawnscale Journal / Field notes for making things"; color: var(--color-text-muted); font-size: var(--text-xs); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.eyebrow, .meta, .article-header .eyebrow, .related .type {
  margin: 0; color: var(--color-brand); font-size: var(--text-xs); font-weight: 800;
  letter-spacing: .13em; text-transform: uppercase;
}
.hero h1 { max-width: 12ch; margin: 0; font-size: var(--text-2xl); line-height: var(--line-tight); }
.summary { max-width: 58ch; margin: 0; color: var(--color-text-muted); font-size: var(--text-lg); }
.hero-actions, .page-actions, .link-row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.button, .page-button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.8rem; padding: .7rem 1rem; border: 1px solid var(--color-brand);
  background: var(--color-brand); color: #fff; font-weight: 800;
}
.button:hover, .page-button:hover { background: var(--color-brand-strong); color: #fff; }
.button.secondary, .page-button.secondary { background: transparent; color: var(--color-text); border-color: var(--color-border-strong); }
.button.secondary:hover, .page-button.secondary:hover { color: var(--color-brand); border-color: var(--color-brand); }

.block { display: grid; gap: var(--space-5); margin-top: var(--space-8); }
.block-header { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); padding-block: .75rem; border-top: 3px solid var(--color-border-strong); border-bottom: 1px solid var(--color-border); }
.block-header h2 { margin: 0; font-size: var(--text-xl); }
.block-header a, .read-link, .link, .text-link { color: var(--color-brand); font-weight: 800; text-decoration: underline; text-underline-offset: .2em; }
.cards { display: grid; gap: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--color-border); }
.card { min-height: 100%; padding: var(--space-5) var(--space-5) var(--space-6); display: grid; align-content: start; gap: var(--space-3); border: 0; border-bottom: 1px solid var(--color-border); border-right: 1px solid var(--color-border); background: transparent; }
.card:nth-child(3n) { border-right: 0; }
.card:hover { background: rgba(255, 253, 249, .7); }
.card h2, .card h3 { margin: 0; font-size: var(--text-lg); }
.card h3 a:hover { color: var(--color-brand); }
.card p { margin: 0; color: var(--color-text-muted); }
.feature-card { grid-template-columns: minmax(0, 1.4fr) minmax(14rem, .8fr); gap: var(--space-5); padding: var(--space-6); border-left: .45rem solid var(--color-brand); background: var(--color-paper); }
.feature-card > .meta, .feature-card > h3 { grid-column: 1 / -1; }
.feature-card h3 { max-width: 24ch; margin: 0; font-size: clamp(1.8rem, 4vw, 3.4rem); line-height: 1.03; }
.feature-card > p:not(.meta) { max-width: 48ch; font-size: var(--text-lg); }
.feature-card .read-link { align-self: end; justify-self: end; }
.home-cta { margin-top: var(--space-8); padding: var(--space-6); display: grid; gap: var(--space-3); border-top: 3px solid var(--color-brand); }
.home-cta h2 { max-width: 26ch; margin: 0; font-size: var(--text-xl); }
.home-cta p { margin: 0; color: var(--color-text-muted); }

.site-footer { margin-top: var(--space-8); border-top: 1px solid var(--color-border-strong); }
.site-footer .inner { padding-block: var(--space-5); }
.footer-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4); }
.site-footer p { margin: 0; color: var(--color-text-muted); font-size: var(--text-sm); }
.footer-nav { gap: var(--space-4); font-size: var(--text-sm); }
.footer-nav a { color: var(--color-text-muted); text-decoration: underline; text-underline-offset: .2em; }

.breadcrumbs { margin-bottom: var(--space-4); }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; margin: 0; padding: 0; color: var(--color-text-muted); font-size: var(--text-sm); }
.breadcrumbs li { display: inline-flex; align-items: center; gap: var(--space-2); }
.breadcrumbs li + li::before { content: "/"; color: var(--color-border-strong); }
.breadcrumbs a { color: var(--color-brand); text-decoration: underline; text-underline-offset: .18em; }
.article-layout { display: grid; gap: var(--space-5); }
.article-header { padding: var(--space-6); display: grid; gap: var(--space-4); border-top: .45rem solid var(--color-brand); }
.article-header h1 { max-width: 18ch; margin: 0; font-size: clamp(2.4rem, 5vw, 4.8rem); line-height: 1.02; }
.article-header .description { max-width: 68ch; margin: 0; color: var(--color-text-muted); font-size: var(--text-lg); }
.article-header .meta { display: flex; flex-wrap: wrap; gap: var(--space-5); }
.article-header .meta > div { display: grid; gap: var(--space-1); }
.article-header dt { color: var(--color-text-muted); font-size: var(--text-xs); letter-spacing: .08em; text-transform: uppercase; }
.article-header dd { margin: 0; font-weight: 700; }
.article-header .tags { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; margin: 0; padding: 0; }
.article-header .tags li { padding: .25rem .6rem; border: 1px solid var(--color-border); color: var(--color-text-muted); font-size: var(--text-sm); }
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(14rem, 18rem); gap: var(--space-5); align-items: start; }
.article-body { min-width: 0; padding: clamp(1.4rem, 4vw, 3.25rem); font-family: Georgia, "Times New Roman", serif; font-size: 1.1rem; line-height: 1.78; }
.article-body > *:first-child { margin-top: 0; }
.article-body > *:last-child { margin-bottom: 0; }
.article-body p, .article-body ul, .article-body ol, .article-body blockquote, .article-body table { margin-block: 0 var(--space-5); }
.article-body h2 { margin: var(--space-7) 0 var(--space-3); font-size: var(--text-xl); line-height: 1.08; }
.article-body h3 { margin: var(--space-6) 0 var(--space-3); font-size: var(--text-lg); line-height: 1.12; }
.article-body ul, .article-body ol { padding-left: 1.4rem; }
.article-body li + li { margin-top: var(--space-2); }
.article-body a { color: var(--color-brand); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; }
.article-body blockquote { margin-inline: 0; padding: var(--space-4) var(--space-5); border-left: 4px solid var(--color-brand); background: var(--color-surface-muted); }
.article-body blockquote p { margin: 0; }
.article-body strong { color: var(--color-text); }
.article-body table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; font-family: var(--font-sans); font-size: var(--text-sm); line-height: 1.4; }
.article-body th, .article-body td { min-width: 10rem; padding: .75rem; border: 1px solid var(--color-border); text-align: left; vertical-align: top; }
.article-body th { background: var(--color-surface-muted); font-family: var(--font-sans); }
.toc { position: sticky; top: calc(var(--header-height) + var(--space-4)); max-height: calc(100vh - var(--header-height) - var(--space-7)); overflow: auto; padding: var(--space-4); }
.toc > p { margin: 0 0 var(--space-3); font-weight: 800; }
.toc ol { display: grid; gap: var(--space-2); list-style: none; margin: 0; padding: 0; }
.toc li { line-height: 1.35; }
.toc li.depth-3 { padding-left: var(--space-3); }
.toc a { color: var(--color-text-muted); font-size: var(--text-sm); }
.toc a:hover { color: var(--color-brand); }
.related { padding: var(--space-5); display: grid; gap: var(--space-4); }
.related h2, .related h3, .related p { margin: 0; }
.related > ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0; list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--color-border); }
.related li a { height: 100%; padding: var(--space-4); display: grid; align-content: start; gap: var(--space-2); border-bottom: 1px solid var(--color-border); }
.related li a:hover { background: var(--color-surface-muted); }
.related .description { color: var(--color-text-muted); }
.pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.pager .card { padding: var(--space-5); border: 1px solid var(--color-border); }
.pager p, .pager h2 { margin: 0; }
.pager p { color: var(--color-brand); font-size: var(--text-sm); font-weight: 800; text-transform: uppercase; }

.trust-page { display: grid; gap: var(--space-5); max-width: 56rem; }
.trust-page h1, .trust-page h2, .trust-page h3, .trust-page p, .trust-page ul { margin: 0; }
.trust-page h1 { font-size: clamp(2.35rem, 5vw, 4.4rem); line-height: 1.02; }
.trust-page h2 { font-size: var(--text-xl); }
.trust-page h3 { font-size: var(--text-lg); }
.trust-page p, .trust-page li { color: var(--color-text-muted); }
.trust-page ul { display: grid; gap: var(--space-2); padding-left: 1.25rem; }
.lede { max-width: 68ch; font-size: var(--text-lg); }
.trust-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: var(--space-4); }
.trust-card, .prose-section, .contact-card, .article-callout { padding: var(--space-5); display: grid; gap: var(--space-3); }
.trust-card a, .contact-card a { color: var(--color-brand); font-weight: 800; }

.stack, .intro { display: grid; gap: var(--space-4); }
.intro h1 { max-width: 16ch; margin: 0; font-size: clamp(2.4rem, 5vw, 4.5rem); line-height: 1.02; }
.intro p, .controls p, .card p { color: var(--color-text-muted); }
.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--space-4); align-items: end; padding: var(--space-5); border-top: 3px solid var(--color-border-strong); border-bottom: 1px solid var(--color-border); }
.controls .full { grid-column: 1 / -1; margin: 0; color: var(--color-text); font-weight: 700; }
.controls label { display: grid; gap: var(--space-2); color: var(--color-text-muted); font-size: var(--text-sm); font-weight: 700; }
select { appearance: none; background: var(--color-paper); color: var(--color-text); border: 1px solid var(--color-border-strong); border-radius: 0; padding: .65rem .75rem; font: inherit; }
.empty { color: var(--color-text-muted); }

@media (max-width: 56rem) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card:nth-child(3n) { border-right: 1px solid var(--color-border); }
  .card:nth-child(2n) { border-right: 0; }
  .content-grid { grid-template-columns: 1fr; }
  .toc { position: static; max-height: none; order: -1; }
  .toc ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toc li.depth-3 { display: none; }
}
@media (max-width: 48rem) {
  :root { --header-height: 4.5rem; --space-8: 3.5rem; }
  .site-header { position: static; }
  .site-header .inner { align-items: flex-start; flex-direction: column; gap: 0; padding-block: var(--space-3) 0; }
  .site-header nav { width: 100%; }
  .site-header nav ul { flex-wrap: nowrap; gap: .9rem; overflow-x: auto; scrollbar-width: none; }
  .site-header nav a { display: inline-block; padding-block: .75rem; font-size: .75rem; white-space: nowrap; }
  .site-header nav a:focus-visible { outline-offset: -3px; } /* the scrollable row would clip an outside outline */
  main { padding-block: var(--space-7); }
  .hero h1 { font-size: clamp(2.6rem, 13vw, 4.5rem); }
  .feature-card { grid-template-columns: 1fr; }
  .feature-card .read-link { justify-self: start; }
  .cards { grid-template-columns: 1fr; }
  .card, .card:nth-child(2n), .card:nth-child(3n) { border-right: 0; }
  .block-header { align-items: flex-start; flex-direction: column; }
  .article-header { padding: var(--space-5); }
  .article-header h1 { font-size: clamp(2.35rem, 12vw, 4rem); }
  .article-header .meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
  .toc ol, .pager { grid-template-columns: 1fr; }
  .footer-row { align-items: flex-start; flex-direction: column; }
}

/* Keep filter state authoritative when cards use display:grid. */
[hidden] { display: none !important; }
/* Card link colors must not obscure filled action labels. */
a.button:not(.secondary), a.page-button:not(.secondary) { color: #fff; }
/* Preserve the native affordance for keyboard and touch select controls. */
select { appearance: auto; }
