/* Spice Rack — hand written, no build step. Light and dark theme follow the system setting. */
:root {
  --bg: #fbf9f7;
  --surface: #ffffff;
  --surface-2: #f4efeb;
  --border: #e4dcd5;
  --text: #241d19;
  --muted: #6d625b;
  --accent: #c8361a;
  --accent-strong: #a82a12;
  --accent-soft: #fbe8e2;
  --on-accent: #ffffff;
  --ok: #1d7a46;
  --ok-soft: #e0f3e8;
  --warn: #946200;
  --warn-soft: #fbf0d3;
  --danger: #b3261e;
  --code-bg: #f1ece7;
  --chart: #c8361a;
  --chart-grid: #e9e2db;
  --shadow: 0 1px 2px rgba(36, 29, 25, .06), 0 2px 8px rgba(36, 29, 25, .05);
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17120f;
    --surface: #211a16;
    --surface-2: #2a211c;
    --border: #3a2f28;
    --text: #f1e9e3;
    --muted: #b0a299;
    --accent: #ff6a45;
    --accent-strong: #ff8663;
    --accent-soft: #3b1f17;
    --on-accent: #1c0f0a;
    --ok: #55c785;
    --ok-soft: #173325;
    --warn: #f0bb4a;
    --warn-soft: #352a10;
    --danger: #ff8a80;
    --code-bg: #2a211c;
    --chart: #ff6a45;
    --chart-grid: #392e27;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.55; font-size: 16px; }
img, svg { max-width: 100%; }
main { flex: 1 0 auto; }
.site-footer { flex-shrink: 0; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
code, pre { font-family: var(--mono); font-size: .9em; }
code { background: var(--code-bg); padding: .1em .35em; border-radius: 5px; }
pre { background: var(--code-bg); padding: 1em; border-radius: 8px; overflow-x: auto; margin: 0 0 1em; }
pre code { background: none; padding: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.accent { color: var(--accent); }
.center-text { text-align: center; }
.spacer { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: .5em 1em; border-radius: 6px; z-index: 10; }
.skip-link:focus { left: 8px; text-decoration: none; }
.icon { width: 1.05em; height: 1.05em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.15em; flex: none; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.container.narrow { max-width: 760px; }
.section { padding-top: 32px; padding-bottom: 48px; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.header-inner { display: flex; align-items: center; gap: 20px; min-height: 60px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.15rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 6px; }
.header-search { flex: 1 1 220px; max-width: 360px; display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 0 14px; color: var(--muted); }
.header-search:focus-within { border-color: var(--accent); }
.header-search input { flex: 1; border: 0; background: none; color: var(--text); font: inherit; padding: 8px 0; min-width: 0; outline: none; }
.main-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.nav-link { color: var(--text); padding: 6px 12px; border-radius: 8px; font-weight: 500; }
.nav-link:hover { background: var(--surface-2); text-decoration: none; }
.nav-link.active { background: var(--accent-soft); color: var(--accent-strong); }
.user-menu { display: inline-flex; align-items: center; gap: 8px; margin-left: 6px; }
.user-login { font-weight: 600; font-size: .9rem; }
.avatar { border-radius: 50%; vertical-align: middle; background: var(--surface-2); }
.inline-form { display: inline-flex; margin: 0; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost { background: transparent; }
.btn-small { padding: 5px 11px; font-size: .875rem; }
.btn-block { display: flex; width: 100%; }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: var(--surface); border-color: var(--danger); }

/* Notices */
.notice { margin: 16px 0 0; padding: 12px 16px; border-radius: var(--radius); border: 1px solid; }
.notice ul { margin: 0; padding-left: 1.2em; }
.notice-ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.notice-err { background: var(--accent-soft); border-color: var(--danger); color: var(--danger); }

/* Hero */
.hero { background: radial-gradient(1200px 400px at 80% -10%, var(--accent-soft), transparent 70%), var(--bg); border-bottom: 1px solid var(--border); }
.hero-inner { padding-top: 56px; padding-bottom: 48px; text-align: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: .3em; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 640px; }
.hero .lead { margin: 0 auto 1.5em; }
.hero-search { display: flex; gap: 8px; max-width: 560px; margin: 0 auto 20px; }
.hero-search input { flex: 1; min-width: 0; font: inherit; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.hero-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hero-stats { list-style: none; display: flex; justify-content: center; gap: 28px; padding: 0; margin: 0 0 20px; color: var(--muted); flex-wrap: wrap; }
.hero-stats strong { color: var(--text); font-size: 1.1rem; }
.hero-tags { justify-content: center; }

/* Tags and badges */
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 .75em; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-size: .8rem; }
a.tag:hover { border-color: var(--accent); text-decoration: none; }
.tag-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.tag-count { color: var(--muted); font-size: .75rem; margin-left: 2px; }
.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.version { font-family: var(--mono); font-size: .8rem; color: var(--muted); font-weight: 500; }
.version.big { font-size: 1rem; background: var(--surface-2); padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border); }

/* Cards and lists */
.card-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.card:hover { border-color: var(--accent); }
.card-head h3 { margin: 0 0 4px; font-size: 1.1rem; }
.card-head a { color: var(--text); }
.card-desc { color: var(--muted); margin: 0 0 10px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: .85rem; }
.stat { display: inline-flex; align-items: center; gap: 5px; }
.columns-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.columns-2 { display: grid; grid-template-columns: 3fr 2fr; gap: 20px; align-items: start; }
.mini-list { list-style: none; padding: 0; margin: 0 0 12px; }
.mini-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.mini-list a { display: contents; color: var(--text); }
.mini-list a:hover { text-decoration: none; }
.mini-name { font-weight: 600; color: var(--accent-strong); grid-column: 1; }
.mini-desc { color: var(--muted); font-size: .875rem; grid-column: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-metric { grid-column: 2; grid-row: 1; color: var(--muted); font-size: .8rem; white-space: nowrap; }
.cta { background: var(--surface-2); border-top: 1px solid var(--border); }
.cta-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 32px; padding-bottom: 32px; flex-wrap: wrap; }
.cta h2 { margin-bottom: .2em; }
.cta p { margin: 0; }
.plain-list { list-style: none; padding: 0; margin: 0 0 1em; }
.plain-list li { padding: 4px 0; }

/* Page titles */
.page-title { background: var(--surface); border-bottom: 1px solid var(--border); padding: 24px 0 18px; }
.page-title h1 { margin-bottom: .15em; }
.page-title p { margin: 0; }
.title-flex { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.subnav { display: flex; gap: 4px; padding-top: 14px; padding-bottom: 0; }
.subnav a { padding: 6px 14px; border-radius: 8px; color: var(--text); font-weight: 500; }
.subnav a.active { background: var(--accent-soft); color: var(--accent-strong); }
.subnav a:hover { text-decoration: none; background: var(--surface-2); }

/* Search */
.search-layout { display: grid; grid-template-columns: 260px 1fr; gap: 28px; padding-top: 24px; padding-bottom: 48px; align-items: start; }
.filters h2 { font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-top: 1.4em; }
.filter-form label, .field label { display: block; font-weight: 600; font-size: .875rem; margin: 0 0 4px; }
.filter-form input, .filter-form select { width: 100%; margin-bottom: 12px; }
input[type="text"], input[type="search"], select, textarea { font: inherit; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); width: 100%; }
input[readonly] { background: var(--surface-2); color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 24px; }
.empty { text-align: center; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); padding: 32px 16px; }
.toolbar { display: flex; gap: 8px; margin-bottom: 16px; max-width: 520px; }

/* Package page */
.package-header { background: var(--surface); border-bottom: 1px solid var(--border); padding-top: 28px; }
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.title-row h1 { margin: 0; word-break: break-word; }
.package-header .lead { margin: .2em 0 .8em; }
.tabs { display: flex; gap: 4px; margin-top: 12px; overflow-x: auto; }
.tab { padding: 10px 16px; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--accent-strong); border-bottom-color: var(--accent); }
.tab-badge { margin-left: 6px; font-size: .75rem; background: var(--surface-2); padding: 1px 7px; border-radius: 999px; }
.package-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; padding-top: 24px; padding-bottom: 48px; align-items: start; }
.sidebar { display: grid; gap: 16px; }
.side-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.side-block h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .8em; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; word-break: break-word; }
.code { margin: 0 0 12px; font-size: .85rem; }
.readme { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 28px; overflow-x: auto; }

/* Rendered markdown (README, changelog) */
.markdown-body { overflow-wrap: anywhere; }
.markdown-body > :first-child { margin-top: 0; }
.markdown-body > :last-child { margin-bottom: 0; }
.markdown-body h1, .markdown-body h2 { padding-bottom: .3em; border-bottom: 1px solid var(--border); margin-top: 1.6em; }
.markdown-body h3, .markdown-body h4 { margin-top: 1.4em; }
.markdown-body img { max-width: 100%; height: auto; }
.markdown-body table { border-collapse: collapse; display: block; overflow-x: auto; margin: 0 0 1em; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 6px 12px; }
.markdown-body blockquote { margin: 0 0 1em; padding: 0 1em; border-left: 4px solid var(--border); color: var(--muted); }
.markdown-body pre { background: var(--code-bg); }
.markdown-body .anchor { float: left; margin-left: -20px; padding-right: 4px; opacity: 0; }
.markdown-body h1:hover .anchor, .markdown-body h2:hover .anchor, .markdown-body h3:hover .anchor { opacity: .6; }
.markdown-body .octicon { display: inline-block; width: 16px; height: 16px; fill: currentColor; vertical-align: text-bottom; }
.markdown-body hr { border: 0; border-top: 1px solid var(--border); margin: 1.5em 0; }
.markdown-body ul.contains-task-list { list-style: none; padding-left: 1.2em; }
.markdown-body .highlight pre { margin-bottom: 1em; }

/* Versions */
.versions { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.version-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.version-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.version-head h3 { margin: 0; font-family: var(--mono); }
.version-title { font-weight: 600; margin: 8px 0 0; }
.changelog { margin-top: 10px; }
.changelog summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.changelog .markdown-body, .changelog pre { margin-top: 10px; }

/* Dependencies */
.dep-tree { list-style: none; margin: 0; padding-left: 0; }
.dep-tree .dep-tree { padding-left: 22px; border-left: 1px dashed var(--border); margin-left: 6px; }
.dep-tree li { padding: 4px 0; }
.dep-tree summary { cursor: pointer; }
.dep-tree .dep-leaf { padding-left: 20px; }
.dep-name { font-weight: 600; }
.dep-constraint { font-size: .8rem; }

/* Panels, tiles, tables */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.panel > :last-child { margin-bottom: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; }
.tile-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
.tile-label { color: var(--muted); font-size: .85rem; }
.chart { margin: 0; }
.chart figcaption { font-weight: 600; margin-bottom: 8px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.chart .bar { fill: var(--chart); }
.chart .bar:hover { opacity: .75; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; white-space: nowrap; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { white-space: nowrap; display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 0; }
.table tr:last-child td { border-bottom: 0; }
.bar-cell { width: 25%; min-width: 80px; }
.inline-bar { display: block; height: 8px; border-radius: 4px; background: var(--chart); min-width: 2px; }

/* Forms */
.form .field { margin-bottom: 16px; }
.hint { margin: 4px 0 0; color: var(--muted); font-size: .85rem; }
.req { color: var(--danger); }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.danger-zone { border-color: var(--danger); }
.danger-zone h2 { color: var(--danger); }

/* Prose / docs */
.prose h2 { margin-top: 1.6em; }
.steps { padding-left: 0; list-style: none; counter-reset: step; }
.steps > li { counter-increment: step; position: relative; padding-left: 48px; margin-bottom: 20px; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 700; display: grid; place-items: center; }
.steps h2 { margin-bottom: .2em; font-size: 1.1rem; }
.error-code { font-size: 4rem; font-weight: 800; color: var(--accent); margin: 0; line-height: 1; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .9rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; padding-top: 22px; padding-bottom: 22px; flex-wrap: wrap; align-items: center; }
.footer-inner .brand-mark { width: 16px; height: 16px; vertical-align: -3px; }
.footer-links { display: flex; gap: 18px; }

@media (max-width: 860px) {
  .columns-3, .columns-2 { grid-template-columns: 1fr; }
  .search-layout, .package-layout { grid-template-columns: 1fr; }
  .header-search { order: 3; max-width: none; flex-basis: 100%; }
  .main-nav { margin-left: 0; }
  .readme { padding: 16px; }
  .user-login { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .card, .tag { transition: border-color .15s, background-color .15s; }
}
