/* PRISMA-Local project site.
   Light is the primary palette; dark is a token swap, never a separate layout.
   Every colour is defined on :root so nothing is only defined inside a media
   query -- a page whose ink exists only in the dark block renders invisible
   text the moment someone forces light. */
:root {
  --bg: #fbfaf7; --surface: #ffffff; --surface-2: #f4f1ea;
  --ink: #14171a; --muted: #5c6470; --faint: #8a919c;
  --rule: #e2ddd2; --rule-strong: #c9c2b3;
  --accent: #a83e18; --accent-soft: #fbeee7;
  --teal: #14615d; --teal-soft: #e2f0ef;
  --good: #1d6b45; --warn: #8a5a04; --warn-soft: #fdf3dd;
  --shadow: 0 1px 2px rgba(20,23,26,.05), 0 8px 24px -12px rgba(20,23,26,.16);
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --maxw: 1180px; --prose: 68ch;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1012; --surface: #15181b; --surface-2: #1b1f23;
    --ink: #e9e6e0; --muted: #a0a7b1; --faint: #79808a;
    --rule: #262b31; --rule-strong: #39404820;
    --accent: #e2865c; --accent-soft: #2a1c14;
    --teal: #59c3bb; --teal-soft: #102523;
    --good: #62c08d; --warn: #d9a441; --warn-soft: #2a2113;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -14px rgba(0,0,0,.7);
  }
}
:root[data-theme="dark"] {
  --bg: #0e1012; --surface: #15181b; --surface-2: #1b1f23;
  --ink: #e9e6e0; --muted: #a0a7b1; --faint: #79808a;
  --rule: #262b31; --rule-strong: #394048;
  --accent: #e2865c; --accent-soft: #2a1c14;
  --teal: #59c3bb; --teal-soft: #102523;
  --good: #62c08d; --warn: #d9a441; --warn-soft: #2a2113;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -14px rgba(0,0,0,.7);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.65 var(--sans); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.015em; margin: 0 0 .5em; font-weight: 600; }
a { color: var(--accent); text-underline-offset: 3px; }
code, kbd, .mono { font-family: var(--mono); font-size: .88em; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.prose { max-width: var(--prose); font-family: var(--serif); font-size: 1.06rem; }
.prose p { margin: 0 0 1.1em; }
.lede { font-size: 1.18rem; color: var(--muted); }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.small { font-size: .875rem; } .tiny { font-size: .8rem; }
.nowrap { white-space: nowrap; }

/* ---- top bar ---- */
header.bar {
  position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule);
}
.bar .wrap { display: flex; align-items: center; gap: 20px; height: 56px; }
.brand { font-weight: 650; letter-spacing: -.02em; margin-right: auto; display: flex; align-items: center; gap: 9px; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; }
nav.links { display: flex; gap: 4px; }
nav.links a {
  color: var(--muted); text-decoration: none; font-size: .875rem; padding: 6px 10px;
  border-radius: 7px; white-space: nowrap;
}
nav.links a:hover { color: var(--ink); background: var(--surface-2); }
nav.links a.on { color: var(--ink); background: var(--surface-2); font-weight: 550; }
@media (max-width: 860px) { nav.links { display: none; } }
.icon-btn {
  border: 1px solid var(--rule); background: var(--surface); color: var(--muted);
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer; display: grid; place-items: center;
}
.icon-btn:hover { color: var(--ink); border-color: var(--rule-strong); }

/* ---- hero ---- */
.hero { padding: 72px 0 40px; border-bottom: 1px solid var(--rule); }
.hero h1 { font-size: clamp(2.3rem, 5.5vw, 3.4rem); margin-bottom: .28em; }
.hero .sub { font-size: 1.2rem; color: var(--muted); max-width: 62ch; margin: 0 0 28px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 9px;
  font: 550 .95rem/1 var(--sans); cursor: pointer; text-decoration: none; border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #fff; }
:root[data-theme="dark"] .btn-primary, :root:not([data-theme="light"]) .btn-primary { color: #14100d; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .btn-primary { color: #fff; } }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { border-color: var(--rule-strong); color: var(--ink); background: var(--surface); }
.btn-ghost:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px;
  background: var(--rule); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; margin-top: 40px; }
.stat { background: var(--surface); padding: 16px 18px; }
.stat b { display: block; font: 650 1.5rem/1.1 var(--sans); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { display: block; font-size: .78rem; color: var(--muted); margin-top: 5px; }

/* ---- sections ---- */
section { padding: 64px 0; border-bottom: 1px solid var(--rule); }
.eyebrow { font: 600 .74rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 14px; }
section h2 { font-size: clamp(1.6rem, 3.2vw, 2.1rem); margin-bottom: .5em; }

.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 20px 22px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; }

.note { border-left: 3px solid var(--warn); background: var(--warn-soft); padding: 14px 18px;
  border-radius: 0 9px 9px 0; font-size: .93rem; }
.note b { color: var(--ink); }

/* ---- tables ---- */
.tablewrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .875rem; }
th, td { padding: 9px 13px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--rule); }
th:first-child, td:first-child { text-align: left; }
thead th { font: 600 .74rem/1.3 var(--sans); letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2); position: sticky; top: 0; }
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--ink); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
tr.best td { background: var(--teal-soft); }
tr.best td:first-child { font-weight: 600; }
.flag { display: inline-block; margin-left: 6px; color: var(--warn); cursor: help; }
.bar-cell { position: relative; }
.bar-cell i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-soft); z-index: 0; }
.bar-cell span { position: relative; z-index: 1; }

/* ---- charts ---- */
figure { margin: 0; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis line, .chart .axis path { stroke: var(--rule-strong); }
.chart text { fill: var(--muted); font: 11px var(--sans); }
.chart .grid line { stroke: var(--rule); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: .82rem; }
.legend button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: none;
  color: var(--muted); cursor: pointer; font: inherit; padding: 2px 0; }
.legend button.off { opacity: .38; text-decoration: line-through; }
.legend i { width: 15px; height: 3px; border-radius: 2px; flex: none; }

/* ---- demo ---- */
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; box-shadow: var(--shadow); }
.panel > .head { padding: 16px 20px; border-bottom: 1px solid var(--rule); display: flex;
  align-items: center; gap: 12px; flex-wrap: wrap; }
.panel > .body { padding: 20px; }
.steps { display: grid; gap: 18px; }
.step { display: grid; grid-template-columns: 26px 1fr; gap: 14px; align-items: start; }
.step .n { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); color: var(--muted);
  display: grid; place-items: center; font: 600 .75rem var(--mono); border: 1px solid var(--rule); }
.step.done .n { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.step h4 { font-size: .95rem; margin-bottom: 8px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { border: 1px solid var(--rule); background: var(--surface); border-radius: 10px; padding: 10px 14px;
  cursor: pointer; text-align: left; font: inherit; color: var(--ink); min-width: 190px; }
.choice:hover { border-color: var(--rule-strong); background: var(--surface-2); }
.choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.choice b { display: block; font-size: .9rem; font-weight: 600; }
.choice span { display: block; font-size: .78rem; color: var(--muted); margin-top: 2px; }
input[type=text], input[type=url], textarea, select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--rule); border-radius: 9px;
  background: var(--bg); color: var(--ink); font: .9rem var(--sans);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label.fld { display: block; font-size: .8rem; color: var(--muted); margin-bottom: 5px; font-weight: 550; }

.dropzone { border: 1.5px dashed var(--rule-strong); border-radius: 11px; padding: 22px; text-align: center;
  color: var(--muted); font-size: .88rem; cursor: pointer; background: var(--surface-2); }
.dropzone.hot { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 1px;
  background: var(--rule); border: 1px solid var(--rule); border-radius: 11px; overflow: hidden; }
.metrics div { background: var(--surface); padding: 12px 14px; }
.metrics b { display: block; font: 650 1.25rem/1.15 var(--mono); font-variant-numeric: tabular-nums; }
.metrics span { display: block; font-size: .72rem; color: var(--muted); margin-top: 4px; }
.metrics .delta { font-size: .72rem; font-family: var(--mono); }

.ranked { border: 1px solid var(--rule); border-radius: 11px; overflow: hidden; }
.rank-row { display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; padding: 11px 14px;
  border-bottom: 1px solid var(--rule); align-items: start; font-size: .875rem; }
.rank-row:last-child { border-bottom: 0; }
.rank-row .pos { font: 600 .8rem var(--mono); color: var(--faint); padding-top: 2px; }
.rank-row .ttl { line-height: 1.45; }
.rank-row .sc { font: 600 .82rem var(--mono); font-variant-numeric: tabular-nums; text-align: right; padding-top: 2px; }
.rank-row.hit { background: var(--teal-soft); }
.rank-row.hit .pos { color: var(--teal); }
.pill { display: inline-block; font: 600 .68rem var(--sans); padding: 2px 7px; border-radius: 20px;
  background: var(--surface-2); color: var(--muted); margin-left: 8px; vertical-align: 1px; }
.pill.inc { background: var(--teal-soft); color: var(--teal); }
.terms { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 5px; }
.terms code { font-size: .72rem; padding: 1px 6px; border-radius: 5px; background: var(--surface-2); color: var(--muted); }
.terms code.pos { background: var(--teal-soft); color: var(--teal); }
.terms code.neg { background: var(--accent-soft); color: var(--accent); }
.screen-btns { display: flex; gap: 5px; }
.screen-btns button { border: 1px solid var(--rule); background: var(--surface); border-radius: 7px;
  padding: 3px 9px; font: 600 .72rem var(--sans); cursor: pointer; color: var(--muted); }
.screen-btns button:hover { border-color: var(--rule-strong); color: var(--ink); }
.screen-btns button.inc:hover { border-color: var(--teal); color: var(--teal); }
.screen-btns button.exc:hover { border-color: var(--accent); color: var(--accent); }

.progress { height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.status { font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: 9px; min-height: 22px; }
.spinner { width: 13px; height: 13px; border: 2px solid var(--rule-strong); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
[hidden] { display: none !important; }

pre { background: var(--surface-2); border: 1px solid var(--rule); border-radius: 10px; padding: 14px 16px;
  overflow-x: auto; font-size: .82rem; line-height: 1.55; }
pre code { font-size: inherit; }
footer { padding: 44px 0 60px; color: var(--muted); font-size: .875rem; }
footer a { color: var(--muted); }
