/* Prompts: one stylesheet, system fonts, no framework.
   Colour budget: neutral paper and ink for everything; one accent for actions, links and the active filter;
   amber only for placeholders and the "may be dated" flag. */

:root {
  color-scheme: light;
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --ink: #1c1b19;
  --muted: #66655d;
  --line: #e4e1d9;
  --line-strong: #cfcbc1;
  --accent: #a63d1a;
  --accent-ink: #ffffff;
  --accent-soft: #f6e6de;
  --warn: #7a4d00;
  --warn-bg: #fbf0d9;
  --ph: #6b3d00;
  --ph-bg: #fde9c8;
  --shadow: 0 1px 2px rgb(28 27 25 / 0.05), 0 4px 16px -8px rgb(28 27 25 / 0.12);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --fast: 120ms;
  --wrap: 1240px;
  --gutter: 16px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141413;
  --surface: #1c1c1a;
  --surface-2: #232320;
  --ink: #ecebe6;
  --muted: #a8a69d;
  --line: #2e2d29;
  --line-strong: #44433d;
  --accent: #f0875f;
  --accent-ink: #1a0f08;
  --accent-soft: #3a2219;
  --warn: #f3c56b;
  --warn-bg: #3a2c0b;
  --ph: #ffd9a0;
  --ph-bg: #4a3415;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 6px 20px -10px rgb(0 0 0 / 0.6);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141413;
    --surface: #1c1c1a;
    --surface-2: #232320;
    --ink: #ecebe6;
    --muted: #a8a69d;
    --line: #2e2d29;
    --line-strong: #44433d;
    --accent: #f0875f;
    --accent-ink: #1a0f08;
    --accent-soft: #3a2219;
    --warn: #f3c56b;
    --warn-bg: #3a2c0b;
    --ph: #ffd9a0;
    --ph-bg: #4a3415;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 6px 20px -10px rgb(0 0 0 / 0.6);
  }
}
@media (min-width: 720px) { :root { --gutter: 24px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  overflow-x: hidden;
}
a { color: var(--accent); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
svg { width: 16px; height: 16px; flex: none; }
code, kbd, pre { font-family: var(--mono); }
: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; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 10; background: var(--surface); padding: 8px 12px; border-radius: var(--r-sm); }
.skip:focus { left: 8px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

/* ── header and footer ─────────────────────────────────────────────── */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--ink); color: var(--bg); font: 600 12px/1 var(--mono); letter-spacing: -0.5px; }
.brand-name { font: 600 19px/1 var(--serif); letter-spacing: 0.1px; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a, .nav button { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: var(--r-sm); color: var(--muted); font: 500 14px/1 var(--sans); text-decoration: none; background: none; border: 0; cursor: pointer; }
.nav a:hover, .nav button:hover { color: var(--ink); background: var(--surface-2); }
.nav-icon { padding: 0 9px !important; }
.site-footer { margin-top: 64px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 24px; padding-top: 18px; padding-bottom: 28px; }
.footer-row p { margin: 0; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--ink); }

/* ── buttons, badges ───────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: 500 13.5px/1 var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap; transition: background var(--fast), border-color var(--fast); }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn.done { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font: 500 11.5px/1 var(--sans); white-space: nowrap; }
.badge svg { width: 13px; height: 13px; }
.badge.use { color: var(--ink); }
.badge.skill-file { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.2px; }
.level { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; border: 1px solid var(--muted); }
.dots i.on { background: var(--muted); }
.tag { color: var(--muted); font: 12px/1.4 var(--mono); text-decoration: none; }
a.tag:hover { color: var(--accent); }

.tested { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 12px; white-space: nowrap; }
.tested-label { color: var(--ink); font-weight: 600; }
.stale-flag { display: none; }
.tested.stale { border-color: transparent; background: var(--warn-bg); color: var(--warn); }
.tested.stale .tested-label { color: var(--warn); }
.tested.stale .stale-flag { display: inline; font-weight: 600; padding-left: 6px; border-left: 1px solid currentColor; }

/* ── home ──────────────────────────────────────────────────────────── */
.hero { padding: 36px 0 18px; }
.hero h1 { margin: 0; font: 600 clamp(28px, 4.2vw, 42px)/1.1 var(--serif); letter-spacing: -0.4px; max-width: 18ch; }
.lede { margin: 10px 0 0; max-width: 62ch; color: var(--muted); font-size: 17px; }
.search-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin-top: 22px; }
.search { position: relative; flex: 1 1 380px; max-width: 620px; display: flex; align-items: center; }
.search svg { position: absolute; left: 13px; color: var(--muted); pointer-events: none; }
.search input { width: 100%; height: 46px; padding: 0 44px 0 40px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font: 16px var(--sans); box-shadow: var(--shadow); }
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.search kbd { position: absolute; right: 12px; display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--muted); font-size: 12px; pointer-events: none; }
.search input:focus + kbd, .search input:not(:placeholder-shown) + kbd { display: none; }
.stats { margin: 0; color: var(--muted); font-size: 14px; }
.stats strong { color: var(--ink); font-weight: 600; }

.filters { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; padding: 14px 0 10px; border-top: 1px solid var(--line); margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: 500 13.5px/1 var(--sans); cursor: pointer; transition: background var(--fast), border-color var(--fast); }
.chip:hover { border-color: var(--line-strong); background: var(--surface-2); }
.chip .n { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip[aria-pressed="true"] .n { color: inherit; opacity: 0.7; }
.selects { display: flex; gap: 6px; }
.select select { height: 32px; padding: 0 30px 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%2366655d' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center / 14px; color: var(--ink); font: 500 13.5px var(--sans); appearance: none; -webkit-appearance: none; cursor: pointer; max-width: 220px; }
.select select.active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.result-line { min-height: 20px; margin: 4px 0 10px; color: var(--muted); font-size: 13px; }

.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 620px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 940px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card[hidden] { display: none; }
.card-link { display: flex; flex-direction: column; gap: 8px; height: 100%; padding: 14px 15px 13px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--ink); text-decoration: none; transition: border-color var(--fast), box-shadow var(--fast), transform var(--fast); }
.card-link:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-1px); text-decoration: none; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-cat { color: var(--muted); font: 600 11px/1 var(--sans); letter-spacing: 0.7px; text-transform: uppercase; }
.card-title { font: 600 17.5px/1.25 var(--serif); letter-spacing: -0.1px; }
.card-link:hover .card-title { color: var(--accent); }
.card-summary { color: var(--muted); font-size: 14px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-top: auto; padding-top: 4px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 2px 8px; min-width: 0; }
.card-foot .level-label { display: none; }
.empty { padding: 40px 0; text-align: center; color: var(--muted); }

/* ── entry page ────────────────────────────────────────────────────── */
.entry-article, .doc-article { max-width: 860px; margin: 0 auto; }
.crumbs { display: flex; gap: 8px; padding: 22px 0 0; color: var(--muted); font-size: 13.5px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.entry-head { padding: 10px 0 8px; }
.entry-head h1, .doc-article h1 { margin: 0; font: 600 clamp(28px, 4vw, 40px)/1.12 var(--serif); letter-spacing: -0.4px; }
.doc-article h1 { padding-top: 28px; }
.entry-summary { margin: 10px 0 0; color: var(--muted); font-size: 18px; line-height: 1.5; max-width: 64ch; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 16px; }
.meta .badge.use { height: 24px; font-size: 12px; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 12px 0 0; padding: 0; }

.prompt-section, .prose-section { margin-top: 34px; }
h2 { margin: 0 0 12px; font: 600 23px/1.2 var(--serif); letter-spacing: -0.2px; }
.lead-in p { margin: 0 0 14px; }

.fill { margin: 0 0 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.fill summary { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; padding: 11px 14px; cursor: pointer; font-weight: 600; font-size: 14.5px; list-style: none; }
.fill summary::-webkit-details-marker { display: none; }
.fill summary::before { content: "▸"; margin-right: 6px; color: var(--muted); font-size: 12px; }
.fill[open] summary::before { content: "▾"; }
.fill summary > span:first-child { margin-right: auto; }
.fill-hint { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.fill-grid { display: grid; grid-template-columns: 1fr; gap: 10px 14px; padding: 2px 14px 10px; }
@media (min-width: 640px) { .fill-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-name { font: 500 12px/1.3 var(--mono); color: var(--ph); }
.field textarea { width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--bg); color: var(--ink); font: 14px/1.4 var(--sans); resize: none; overflow: hidden; }
.field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.fill .link-btn { margin: 0 14px 12px; }

.prompt-card { position: relative; border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--surface-2); overflow: hidden; }
.prompt-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px 9px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.prompt-meta { color: var(--muted); font: 12px var(--mono); }
.prompt-actions { display: flex; flex-wrap: wrap; gap: 6px; }
pre.prompt { margin: 0; padding: 16px 18px 18px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.6; color: var(--ink); tab-size: 2; }
.prompt-card.collapsed pre.prompt { max-height: 34em; overflow: hidden; }
.prompt-card.collapsed::after { content: ""; position: absolute; left: 0; right: 0; bottom: 46px; height: 90px; background: linear-gradient(to bottom, transparent, var(--surface-2)); pointer-events: none; }
.expand { display: block; width: 100%; height: 46px; border: 0; border-top: 1px solid var(--line); background: var(--surface); color: var(--accent); font: 500 14px var(--sans); cursor: pointer; }
.expand:hover { background: var(--surface-2); }
mark.ph { background: var(--ph-bg); color: var(--ph); border-radius: 3px; padding: 0 2px; }
mark.ph.filled { background: var(--accent-soft); color: var(--ink); }
.copy-status { min-height: 18px; margin: 6px 2px 0; color: var(--muted); font-size: 13px; }

.prose { font-size: 16.5px; line-height: 1.65; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose table { margin: 0 0 14px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose li::marker { color: var(--muted); }
.prose strong { font-weight: 650; }
.prose h3 { margin: 22px 0 8px; font: 600 18px/1.3 var(--serif); }
.prose code { padding: 1px 5px; border-radius: 4px; background: var(--surface-2); font-size: 0.86em; overflow-wrap: anywhere; }
.prose pre { padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.55; }
.prose pre code { padding: 0; background: none; font-size: inherit; }
.prose blockquote { padding: 10px 15px; border-left: 3px solid var(--line-strong); background: var(--surface); border-radius: 0 var(--r-sm) var(--r-sm) 0; color: var(--ink); }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 14.5px; }
.prose th, .prose td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { font-weight: 600; border-bottom-color: var(--line-strong); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.skill-box { padding: 18px 20px 6px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.skill-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 14px; }

.entry-foot { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.entry-foot p { margin: 0 0 12px; }
.entry-foot a { color: var(--muted); }
.entry-foot a:hover { color: var(--accent); }
.pager { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 18px; }
@media (min-width: 640px) { .pager { grid-template-columns: 1fr 1fr; } }
.pager a { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--ink) !important; font: 600 15.5px/1.3 var(--serif); text-decoration: none; }
.pager a:hover { border-color: var(--line-strong); }
.pager a[rel="next"] { text-align: right; }
.pager span { color: var(--muted); font: 500 11.5px/1 var(--sans); letter-spacing: 0.6px; text-transform: uppercase; }

.doc-article .prose { margin-top: 26px; }
.doc-article .prose h2 { margin-top: 30px; }
.doc-article > p .btn { margin-right: 6px; }

@media (max-width: 520px) {
  .hero { padding-top: 24px; }
  .lede { font-size: 16px; }
  .brand-name { font-size: 18px; }
  .nav a:not(.nav-icon) { padding: 0 8px; }
  .prompt-actions { width: 100%; }
  .prompt-actions .btn { flex: 1 1 auto; justify-content: center; }
  pre.prompt { padding: 14px; font-size: 13px; }
  .selects { width: 100%; }
  .select { flex: 1; }
  .select select { width: 100%; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .card-link:hover { transform: none; }
}

@media print {
  .site-header, .site-footer, .prompt-bar, .fill, .expand, .pager, .skip { display: none !important; }
  .prompt-card.collapsed pre.prompt { max-height: none; }
  .prompt-card::after { display: none; }
}
