/* Design Patterns for AI Software Factory. One stylesheet, system fonts, no external requests. */
:root {
  --bg: #fbfaf7; --card: #ffffff; --ink: #1a1c1e; --muted: #55595f; --line: #e2dfd8; --link: #1f4fbf;
  --soft: #f3f1ec; --focus: #1f4fbf;
  --h-amber: #b7791f; --h-teal: #0f766e; --h-violet: #7c3aed; --h-blue: #2563eb; --h-crimson: #be123c;
  --h-green: #15803d; --h-indigo: #4338ca; --h-orange: #c2410c; --h-magenta: #a21caf;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121416; --card: #1a1d20; --ink: #e9eaec; --muted: #a3a8ae; --line: #2c3136; --link: #8fb1ff;
    --soft: #1f2327; --focus: #8fb1ff;
    --h-amber: #f0a830; --h-teal: #2dd4bf; --h-violet: #a78bfa; --h-blue: #60a5fa; --h-crimson: #fb7185;
    --h-green: #4ade80; --h-indigo: #818cf8; --h-orange: #fb923c; --h-magenta: #e879f9;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121416; --card: #1a1d20; --ink: #e9eaec; --muted: #a3a8ae; --line: #2c3136; --link: #8fb1ff;
  --soft: #1f2327; --focus: #8fb1ff;
  --h-amber: #f0a830; --h-teal: #2dd4bf; --h-violet: #a78bfa; --h-blue: #60a5fa; --h-crimson: #fb7185;
  --h-green: #4ade80; --h-indigo: #818cf8; --h-orange: #fb923c; --h-magenta: #e879f9;
  color-scheme: dark;
}
.hue-amber { --hue: var(--h-amber); } .hue-teal { --hue: var(--h-teal); } .hue-violet { --hue: var(--h-violet); }
.hue-blue { --hue: var(--h-blue); } .hue-crimson { --hue: var(--h-crimson); } .hue-green { --hue: var(--h-green); }
.hue-indigo { --hue: var(--h-indigo); } .hue-orange { --hue: var(--h-orange); } .hue-magenta { --hue: var(--h-magenta); }

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); line-height: 1.6; overflow-wrap: break-word; }
h1, h2, h3 { font-family: var(--sans); line-height: 1.2; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
main:focus { outline: none; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.wrap { max-width: 72rem; margin: 0 auto; padding: 0 1rem; }
.skip { position: absolute; left: 0.5rem; top: -4rem; background: var(--ink); color: var(--bg); padding: 0.7rem 1rem; z-index: 20; }
.skip:focus { top: 0.5rem; }

/* header */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 0 1.5rem; padding-top: 0.25rem; padding-bottom: 0.25rem; }
.site-title { font-weight: 700; color: var(--ink); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; margin-right: auto; letter-spacing: -0.01em; }
.nav { display: flex; flex-wrap: wrap; gap: 0 0.25rem; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.6rem; color: var(--ink); text-decoration: none; font-size: 0.94rem; border-bottom: 2px solid transparent; }
.nav a:hover { border-bottom-color: var(--line); }
.nav a[aria-current="page"] { border-bottom-color: var(--ink); font-weight: 600; }
.theme-toggle { display: none; min-height: 44px; padding: 0 0.8rem; font: inherit; font-size: 0.88rem; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; }
.js .theme-toggle { display: inline-flex; align-items: center; gap: 0.3em; }
.theme-toggle:hover { border-color: var(--muted); }

/* buttons, inputs */
.button, .btn { font: inherit; font-size: 0.94rem; min-height: 44px; padding: 0 1rem; border-radius: 4px; cursor: pointer; display: inline-flex; align-items: center; }
.button { line-height: 1.3; padding-top: 0.5rem; padding-bottom: 0.5rem; background: var(--ink); color: var(--bg); border: 1px solid var(--ink); text-decoration: none; font-weight: 600; }
.button:hover { text-decoration: underline; }
.btn { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn:hover { border-color: var(--muted); }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--muted); margin-bottom: 0.25rem; letter-spacing: 0.02em; }
input[type="search"], select { font: inherit; font-size: 1rem; min-height: 44px; width: 100%; padding: 0 0.75rem; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 4px; }
select { padding-right: 0.5rem; }
input[type="search"]:hover, select:hover { border-color: var(--muted); }

/* shared */
.eyebrow { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 1rem; font-weight: 600; }
.lede-sm { color: var(--muted); max-width: 46rem; margin-top: 0.75rem; }
.sec-note { color: var(--muted); margin: 0.4rem 0 1.25rem; max-width: 46rem; font-size: 0.94rem; }
main h1 { font-size: clamp(1.9rem, 4.5vw, 2.6rem); margin-top: 2.5rem; }
h2 { font-size: 1.3rem; }
.badge { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.78rem; line-height: 1.3; white-space: nowrap; }
.badge.entry { font-variant: small-caps; letter-spacing: 0.06em; font-size: 0.88rem; font-weight: 600; color: var(--muted); }
.evshape { flex: none; }
.mark { flex: none; color: var(--hue, var(--ink)); }

/* home */
.hero { padding: 2.5rem 0 1rem; }
.hero h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(2rem, 5.5vw, 3.4rem); line-height: 1.12; max-width: 22ch; margin: 0 0 1.5rem; letter-spacing: -0.015em; }
.hero-link { margin-bottom: 1.5rem; }
.lede { font-family: var(--serif); font-size: 1.15rem; line-height: 1.6; max-width: 40rem; color: var(--ink); }
.search { max-width: 40rem; margin-top: 1.75rem; }
.search label { font-size: 0.9rem; color: var(--ink); }
.search-row { display: flex; gap: 0.5rem; }
.search-row input { flex: 1; min-width: 0; }
.home section + section { margin-top: 3rem; }
.home .ways-sec { margin-top: 2.5rem; }
.home h2, .ways-sec h2 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 1rem; }
.ways { display: grid; gap: 1rem; grid-template-columns: repeat(3, 1fr); }
.ways a { display: flex; flex-direction: column; gap: 0.4rem; padding: 1.25rem 1.25rem 1.4rem; background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--ink); border-radius: 2px; text-decoration: none; color: var(--ink); height: 100%; }
.way-name { font-size: 1.35rem; font-weight: 650; letter-spacing: -0.01em; }
.way-desc { color: var(--muted); font-size: 0.94rem; line-height: 1.5; }
.ways a:hover .way-name { text-decoration: underline; }
.cat-grid { display: grid; gap: 1rem; grid-template-columns: repeat(3, 1fr); }
.cat-cell { position: relative; background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--hue); padding: 1rem 1.1rem; border-radius: 2px; }
.cat-head { display: flex; align-items: center; gap: 0.5rem; font-weight: 650; font-size: 1.1rem; }
.cat-head a { color: var(--ink); text-decoration: none; }
.cat-head a::after { content: ""; position: absolute; inset: 0; }
.cat-head a:hover { text-decoration: underline; }
.cat-q { font-family: var(--serif); margin: 0.4rem 0 0.5rem; line-height: 1.45; }
.cat-count { font-size: 0.85rem; color: var(--muted); margin: 0; }
.cat-cell:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.cat-cell a:focus-visible { outline: none; }

/* legend */
.legend { display: grid; gap: 0.9rem 2rem; grid-template-columns: repeat(4, 1fr); }
.legend li { display: grid; grid-template-columns: 14px 1fr; column-gap: 0.55rem; row-gap: 0.15rem; align-items: baseline; font-size: 0.92rem; }
.legend .evshape { margin-top: 0.3em; align-self: start; }
.lg-name { font-weight: 650; }
.lg-name .count { color: var(--muted); font-weight: 500; margin-left: 0.25rem; }
.lg-mean { grid-column: 2; color: var(--muted); font-size: 0.86rem; line-height: 1.45; }
.legend-sec { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.legend-sec h2 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 1rem; }
.home .legend-sec { border-top: 0; padding-top: 0; }
.home { padding-bottom: 3rem; }

/* catalogue */
.catalogue-page .wrap, .questions-page .wrap, .landscape-page .wrap { padding-bottom: 3rem; }
.filters { margin: 1.75rem 0 1.25rem; padding: 1rem 0 0.25rem; border-top: 1px solid var(--line); display: none; }
.js .filters { display: block; }
.filter-search { max-width: 36rem; margin-bottom: 0.75rem; }
.filter-details summary { display: none; }
.filter-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.75rem 1rem; margin-bottom: 0.75rem; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; justify-content: space-between; padding: 0.5rem 0 0.75rem; border-bottom: 1px solid var(--line); }
.count { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.filter-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.view-toggle { display: inline-flex; }
.view-toggle .btn:first-child { border-radius: 4px 0 0 4px; }
.view-toggle .btn:last-child { border-radius: 0 4px 4px 0; margin-left: -1px; }
.empty { padding: 1.5rem 0; color: var(--muted); }
.group { margin-top: 2.25rem; }
.group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; padding-bottom: 0.6rem; margin-bottom: 1rem; border-bottom: 3px solid var(--hue); }
.group-head h2 { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 1.4rem; }
.group-q { margin: 0; font-family: var(--serif); color: var(--muted); font-size: 1.02rem; }
.cards { display: grid; gap: 1rem; grid-template-columns: repeat(2, 1fr); }
.card { position: relative; display: grid; grid-template-columns: auto 1fr; column-gap: 0.75rem; row-gap: 0.45rem; align-content: start; background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--hue); border-radius: 2px; padding: 1rem 1.15rem 1rem 1rem; }
.card[hidden], .group[hidden] { display: none !important; }
.num { font-size: 0.82rem; font-variant-numeric: tabular-nums; color: var(--muted); padding-top: 0.22rem; min-width: 1.4rem; }
.card-name { font-size: 1.12rem; }
.card-name a { color: var(--ink); text-decoration: none; }
.card-name a::after { content: ""; position: absolute; inset: 0; }
.card-name a:hover { text-decoration: underline; }
.card:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.card a:focus-visible { outline: none; }
.statement { grid-column: 2; margin: 0; font-family: var(--serif); font-size: 1rem; line-height: 1.55; }
.labels { grid-column: 2; display: flex; flex-wrap: wrap; gap: 0.3rem 0.9rem; align-items: center; margin-top: 0.3rem; font-size: 0.8rem; color: var(--muted); }
.lab { font-size: 0.8rem; }
.lab.kind { font-weight: 600; color: var(--ink); }
.view-list .cards { display: block; border-top: 1px solid var(--line); }
.view-list .card { display: grid; grid-template-columns: 2rem minmax(10rem, 15rem) 1fr; column-gap: 1rem; align-items: baseline; border: 0; border-bottom: 1px solid var(--line); border-left: 3px solid var(--hue); border-radius: 0; background: transparent; padding: 0.5rem 0.75rem 0.5rem 0.75rem; }
.view-list .card .statement { grid-column: 3; font-family: var(--sans); font-size: 0.9rem; color: var(--muted); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.view-list .labels { display: none; }
.view-list .card-name { font-size: 1rem; }
.view-list .num { padding-top: 0; }
.view-list .group { margin-top: 1.75rem; }

/* landscape */
.matrix-wrap { margin-top: 1.5rem; }
.matrix-scroll { position: relative; overflow-x: auto; border: 1px solid var(--line); background: var(--card); border-radius: 2px; }
.matrix { border-collapse: collapse; width: 100%; table-layout: auto; font-size: 0.86rem; }
.matrix th, .matrix td { border: 1px solid var(--line); vertical-align: top; padding: 0.5rem 0.4rem; text-align: left; }
.matrix thead th { background: var(--soft); font-weight: 400; position: sticky; top: 0; }
/* Longest unbreakable word in a pattern name is Inconsistency, 90px at the chip size; chip chrome adds 33px and cell padding 15px, so 8.3rem (141px) holds it. */
.matrix thead th { min-width: 8.3rem; }
.matrix .corner { width: 10.5rem; min-width: 10.5rem; }
.st-name { display: block; font-weight: 700; font-size: 0.95rem; margin-bottom: 0.2rem; }
.st-what { display: block; font-size: 0.78rem; color: var(--muted); line-height: 1.4; font-weight: 400; }
.matrix tbody th { background: var(--card); font-weight: 400; border-left: 3px solid var(--hue); padding: 0.7rem 0.6rem; }
.row-head { display: flex; align-items: center; gap: 0.45rem; font-weight: 700; font-size: 0.98rem; }
.row-q { display: block; margin-top: 0.3rem; font-size: 0.8rem; color: var(--muted); line-height: 1.4; font-family: var(--serif); }
.chips { display: flex; flex-direction: column; gap: 0.35rem; }
.chips li { min-width: 0; }
.chip { overflow-wrap: break-word; word-break: normal; hyphens: none; display: flex; align-items: flex-start; gap: 0.4rem; padding: 0.3rem 0.35rem; background: var(--soft); border: 1px solid var(--line); border-radius: 3px; color: var(--ink); text-decoration: none; line-height: 1.3; font-size: 0.84rem; }
.chip .evshape { margin-top: 0.15em; }
.chip:hover { border-color: var(--muted); text-decoration: underline; }
.stage-stack { display: none; }
.stage-sec { margin-top: 2rem; }
.stage-sec h2 { font-size: 1.4rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--ink); }
.stage-sec .st-what { margin: 0.5rem 0 1rem; font-size: 0.92rem; }
.st-cat { border-left: 3px solid var(--hue); padding-left: 0.85rem; margin-bottom: 1rem; }
.st-cat h3 { display: flex; align-items: center; gap: 0.45rem; font-size: 0.95rem; margin-bottom: 0.5rem; }

/* questions */
.q-group { margin-top: 2.5rem; border-top: 3px solid var(--hue); padding-top: 0.9rem; }
.q-group h2 { font-family: var(--serif); font-weight: 600; font-size: 1.5rem; }
.q-cat { display: flex; align-items: center; gap: 0.45rem; margin: 0.4rem 0 0.75rem; font-size: 0.85rem; color: var(--muted); font-weight: 600; letter-spacing: 0.02em; }
.q-list li { border-top: 1px solid var(--line); }
.q-list li:last-child { border-bottom: 1px solid var(--line); }
.q-list a { display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 1.5rem; align-items: baseline; padding: 0.7rem 0; min-height: 44px; text-decoration: none; color: var(--ink); }
.q-list .when { font-family: var(--serif); font-size: 1.05rem; line-height: 1.5; max-width: 52rem; }
.q-list .pname { font-size: 0.88rem; font-weight: 600; color: var(--link); text-align: right; white-space: nowrap; }
.q-list a:hover .when { text-decoration: underline; }
.q-list a:hover { background: var(--soft); }

/* pattern page */
.pattern { max-width: 52rem; padding-bottom: 3rem; border-left: 0; }
.p-head { margin-top: 2rem; padding-top: 1rem; border-top: 3px solid var(--hue); }
.p-meta { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; align-items: center; font-size: 0.88rem; color: var(--muted); margin: 0 0 0.75rem; }
.p-cat { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--ink); font-weight: 650; text-decoration: none; min-height: 44px; }
.p-cat:hover { text-decoration: underline; }
.p-num { font-variant-numeric: tabular-nums; }
.pattern h1 { margin: 0 0 1rem; }
.p-statement { font-family: var(--serif); font-size: clamp(1.3rem, 2.8vw, 1.65rem); line-height: 1.45; margin: 0 0 1.5rem; max-width: 40rem; }
.facts { display: flex; flex-wrap: wrap; gap: 0.75rem 2rem; margin: 0; padding: 0.9rem 0 0; border-top: 1px solid var(--line); }
.facts dt { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.facts dd { margin: 0.1rem 0 0; font-size: 0.94rem; }
.p-sec { margin-top: 2.25rem; max-width: 68ch; }
.p-sec.full-entry { max-width: none; }
.p-sec h2 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.6rem; }
.prose-p { font-family: var(--serif); font-size: 1.08rem; line-height: 1.65; margin: 0 0 0.75rem; }
.note { color: var(--muted); margin: 0; }
.ev-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.9rem; margin: 0 0 0.6rem; font-size: 0.94rem; }
.ev-line .badge { font-size: 0.9rem; font-weight: 650; }
.related a { display: inline-flex; align-items: center; min-height: 44px; }
.related li { display: grid; grid-template-columns: 9.5rem 1fr auto; gap: 0.75rem; align-items: center; padding: 0; border-top: 1px solid var(--line); min-height: 44px; }
.related li:last-child { border-bottom: 1px solid var(--line); }
.rel { font-size: 0.82rem; color: var(--muted); }
.rel-cat { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; color: var(--muted); }
.plain li { padding: 0.35rem 0; }
.plain.inline { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.cite { font-size: 0.94rem; padding: 0.75rem 1rem; background: var(--soft); border-left: 3px solid var(--line); margin: 0 0 0.5rem; }
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.pn { display: flex; flex-direction: column; padding: 0.6rem 0.8rem; min-height: 44px; border: 1px solid var(--line); background: var(--card); border-radius: 2px; text-decoration: none; color: var(--ink); }
.pn.next { text-align: right; }
.pn:hover { border-color: var(--muted); }
.pn-l { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.pn-n { font-weight: 650; }
.p-index { margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--line); max-width: none; }
.p-index h2 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 1rem; }
.ix-cols { columns: 3 13rem; column-gap: 2rem; }
.ix-group { break-inside: avoid; margin-bottom: 1.1rem; }
.ix-group h3 { display: flex; align-items: center; gap: 0.4rem; font-size: 0.86rem; margin-bottom: 0.25rem; padding-bottom: 0.2rem; border-bottom: 2px solid var(--hue); }
.ix-group li a { display: block; padding: 0.15rem 0; font-size: 0.88rem; text-decoration: none; }
.ix-group li a:hover { text-decoration: underline; }
.ix-group a[aria-current="page"] { color: var(--ink); font-weight: 700; text-decoration: none; }
.ix-group a[aria-current="page"]::before { content: "\2192\00a0"; }

/* reading text */
.reading { max-width: 68ch; padding-bottom: 3rem; }
.reading-page .reading { margin: 0 auto 0 0; }
.prose { font-family: var(--serif); font-size: 1.08rem; line-height: 1.7; }
.prose h1 { font-family: var(--sans); margin: 2.5rem 0 1.25rem; font-size: clamp(1.9rem, 4.5vw, 2.5rem); }
.prose h2 { font-size: 1.5rem; margin: 2.5rem 0 0.75rem; }
.prose h3 { font-size: 1.15rem; margin: 2rem 0 0.5rem; }
.prose h4 { font-family: var(--sans); font-size: 1rem; margin: 1.5rem 0 0.4rem; }
.prose ul, .prose ol { padding-left: 1.4rem; margin: 0 0 1em; }
.prose ul { list-style: disc; }
.prose li { margin-bottom: 0.35em; }
.prose blockquote { margin: 1.25em 0; padding: 0 0 0 1.1rem; border-left: 3px solid var(--line); color: var(--muted); }
.prose code { font-size: 0.9em; background: var(--soft); padding: 0.1em 0.3em; border-radius: 2px; }
.prose table { border-collapse: collapse; margin: 1em 0; font-size: 0.94rem; font-family: var(--sans); display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 0.4rem 0.6rem; text-align: left; vertical-align: top; }
.prose th { background: var(--soft); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.full-entry .prose { max-width: 68ch; }
.full-entry .prose h3 { margin-top: 1.75rem; }
.case-uses { margin: 0 0 2rem; padding: 0.8rem 1rem; border-left: 3px solid var(--ink); background: var(--soft); font-family: var(--sans); }
.case-uses h2 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 0.3rem; }
.next-steps { margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--line); font-family: var(--sans); }
.next-steps h2 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 0.5rem; }

/* footer */
.site-footer { border-top: 1px solid var(--line); padding: 1.5rem 0 2.5rem; margin-top: 2rem; font-size: 0.88rem; color: var(--muted); }
.site-footer p { margin: 0 0 0.4rem; }
.foot-meta a { display: inline-flex; align-items: center; min-height: 44px; }

/* motion */
@media (prefers-reduced-motion: no-preference) {
  a, .btn, .button, .card, .cat-cell, .chip, .pn, select, input, .theme-toggle, .ways a { transition: color 180ms, background-color 180ms, border-color 180ms; }
}

/* responsive */
@media (max-width: 1023px) {
  .legend { grid-template-columns: repeat(2, 1fr); }
  .filter-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 767px) {
  html { font-size: 16.5px; }
  .ways, .cat-grid { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: 1fr 1fr; }
  .cards { grid-template-columns: 1fr; }
  .legend { grid-template-columns: 1fr; }
  .filter-details summary { display: flex; align-items: center; min-height: 44px; padding: 0 0.75rem; border: 1px solid var(--line); border-radius: 4px; background: var(--card); cursor: pointer; font-weight: 600; font-size: 0.94rem; margin-bottom: 0.75rem; }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .matrix-wrap { display: none; }
  .stage-stack .chip { min-height: 44px; align-items: center; }
  .ix-group li a { display: flex; align-items: center; min-height: 44px; }
  .stage-stack { display: block; }
  .q-list a { grid-template-columns: 1fr; }
  .q-list .pname { text-align: left; }
  .related li { grid-template-columns: 1fr; gap: 0.1rem; }
  .view-list .card { grid-template-columns: 2rem 1fr; }
  .view-list .card .statement { grid-column: 2; }
  .prevnext { grid-template-columns: 1fr; }
  .pn.next { text-align: left; }
  .hero { padding-top: 1.5rem; }
  .header-inner { gap: 0 0.5rem; }
  .site-title { order: 1; flex: 1; }
  .theme-toggle { order: 2; }
  .header-inner nav { order: 3; flex-basis: 100%; margin-left: -0.5rem; }
}
@media (max-width: 479px) {
  .cat-grid { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: 1fr; }
  .search-row { flex-direction: column; }
  .search-row .button { justify-content: center; }
  .nav a { padding: 0 0.42rem; font-size: 0.9rem; }
}

/* print */
@media print {
  :root, :root[data-theme="dark"], :root[data-theme="light"] {
    --bg: #fff; --card: #fff; --ink: #000; --muted: #333; --line: #bbb; --link: #000; --soft: #fff; --focus: #000;
    --h-amber: #444; --h-teal: #444; --h-violet: #444; --h-blue: #444; --h-crimson: #444; --h-green: #444;
    --h-indigo: #444; --h-orange: #444; --h-magenta: #444; color-scheme: light;
  }
  html { font-size: 12pt; }
  body { background: #fff; color: #000; }
  .site-header, .filters, .prevnext, .p-index, .skip, .theme-toggle, .view-toggle, .search, .hero-link { display: none !important; }
  a { color: #000; text-decoration: underline; }
  .card, .cat-cell, .ways a { break-inside: avoid; }
  .pattern { max-width: none; }
  .site-footer { border-top: 1px solid #000; }
  .matrix-scroll { overflow: visible; }
}

/* abridgement line */
.abridge { margin: 1rem 0 0; padding-top: 0.75rem; border-top: 1px solid var(--line); font-size: 0.94rem; color: var(--muted); }
.prose .case-uses ul { list-style: none; padding: 0; margin: 0; }
.prose .case-uses li { margin: 0; padding: 0; }
.case-uses a { display: inline-flex; align-items: center; min-height: 44px; }
