/* OSS Fidelity: same palette as the workshop deck. Fonts are self-hosted, so the site makes no third-party requests. */
@font-face { font-family: "Inter"; src: url("../fonts/inter-var-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-var-latin.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }

:root {
  --bg: #0F1A14;
  --surface: #1A2B21;
  --surface-2: #223829;
  --text: #E9F2EC;
  --muted: #9DB8A8;
  --primary: #4ADE80;
  --accent: #BBF7D0;
  --warn: #FCD34D;
  --bad: #FCA5A5;
  --line: rgba(157, 184, 168, 0.2);
  --radius: 14px;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 1.0625rem/1.6 var(--sans); font-feature-settings: "cv11", "ss01";
}
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--primary); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 6px; }
code, .mono { font-family: var(--mono); font-size: 0.9em; }
code { background: var(--surface); padding: 0.1em 0.35em; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--primary); color: var(--bg); padding: 6px 10px; z-index: 10; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header / footer ---------- */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 14px; padding-bottom: 14px; }
.wordmark { font: 700 1.05rem var(--mono); color: var(--text); text-decoration: none; letter-spacing: -0.01em; }
.wordmark span { color: var(--primary); }
.nav { display: flex; gap: 4px 18px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); }
.nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--primary); }
main { padding: 40px 0 72px; min-height: 60vh; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.875rem; padding: 28px 0 40px; }
.site-footer p { margin: 0.4em 0; }

/* ---------- type ---------- */
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.1rem, 6vw, 3.4rem); font-weight: 800; margin: 0 0 16px; }
h1 em, h2 em { font-style: normal; color: var(--primary); }
h2 { font-size: clamp(1.4rem, 3.4vw, 1.9rem); font-weight: 750; margin: 56px 0 14px; }
h3 { font-size: 1.15rem; font-weight: 700; margin: 28px 0 8px; }
.lede { font-size: 1.2rem; color: var(--muted); max-width: 40ch; margin: 0 0 28px; }
.prose { max-width: 70ch; }
.prose li { margin: 0.3em 0; }

/* ---------- search ---------- */
.search { position: relative; display: flex; gap: 10px; max-width: 680px; }
.search input {
  flex: 1; min-width: 0; font: 500 1.05rem var(--sans); color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 15px 16px;
}
.search input::placeholder { color: var(--muted); opacity: 0.8; }
.search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.18); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
  font: 700 1rem var(--sans); border: 0; border-radius: 12px; padding: 0 20px; cursor: pointer;
  background: var(--primary); color: #062611; min-height: 48px;
}
.btn:hover { background: var(--accent); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--primary); }
.btn[disabled] { opacity: 0.6; cursor: wait; }
.suggest {
  position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.suggest[hidden] { display: none; }
.suggest li a { display: flex; justify-content: space-between; gap: 12px; padding: 9px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.suggest li a:hover, .suggest li a[aria-selected="true"] { background: var(--surface-2); }
.suggest .src { color: var(--muted); font: 0.78rem var(--mono); white-space: nowrap; }
.suggest .group { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; padding: 8px 10px 2px; }
.try { color: var(--muted); margin-top: 14px; font-size: 0.95rem; }

/* ---------- cards & grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 48px; }
.grid3 .card h3 { margin-top: 0; }
.grid3 .card p { margin: 0; color: var(--muted); }
@media (max-width: 720px) { .grid3 { grid-template-columns: 1fr; } }
.kicker { font: 600 0.75rem var(--mono); color: var(--primary); text-transform: uppercase; letter-spacing: 0.1em; }

/* ---------- chips & letters ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; font: 500 0.8rem var(--mono); padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.good { color: var(--primary); border-color: rgba(74, 222, 128, 0.4); }
.chip.warn { color: var(--warn); border-color: rgba(252, 211, 77, 0.4); }
.chip.bad { color: var(--bad); border-color: rgba(252, 165, 165, 0.4); }
.letter {
  display: inline-grid; place-items: center; width: 2.2em; height: 2.2em; border-radius: 10px; font: 800 1.05rem var(--sans);
  border: 2px solid currentColor; flex: none;
}
.letter.lg { width: 3.2em; height: 3.2em; font-size: 1.6rem; border-radius: 16px; }
.g-A, .g-B { color: var(--primary); }
.g-C { color: var(--accent); }
.g-D { color: var(--warn); }
.g-F { color: var(--bad); }
.g-\? { color: var(--muted); border-style: dashed; }

/* ---------- result page ---------- */
.result-head { display: flex; gap: 20px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.result-head > div:first-child { flex: 1 1 380px; min-width: 0; }
.result-head .fidelity { flex: none; }
#result { margin-top: 36px; }
.result-head h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); margin-bottom: 6px; }
.result-head .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.fidelity { display: flex; align-items: center; gap: 14px; }
.fidelity .num { font: 800 2.2rem var(--sans); line-height: 1; }
.fidelity .lbl { color: var(--muted); font-size: 0.85rem; }
.banner { border-left: 3px solid var(--warn); background: var(--surface); padding: 12px 16px; border-radius: 0 10px 10px 0; margin: 18px 0; }
.banner.info { border-left-color: var(--accent); }
.banner.bad { border-left-color: var(--bad); }
.grades { margin-top: 28px; display: grid; gap: 10px; }
details.grade { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
details.grade > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: auto 1fr auto 14px; gap: 16px; align-items: center; padding: 16px 18px; }
details.grade > summary::-webkit-details-marker { display: none; }
/* Subtle chevron: shows the card opens, flips when it does */
details.grade > summary::after {
  content: ""; width: 8px; height: 8px; justify-self: center; margin-top: -4px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform 0.2s ease, border-color 0.2s ease; opacity: 0.8;
}
details.grade[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
details.grade > summary:hover::after, details.grade > summary:focus-visible::after { border-color: var(--primary); opacity: 1; }
details.grade > summary:hover { background: rgba(74, 222, 128, 0.04); border-radius: var(--radius); }
@media (prefers-reduced-motion: reduce) { details.grade > summary::after { transition: none; } }
details.grade .gname { font-weight: 700; font-size: 1.1rem; }
details.grade .reason { color: var(--muted); font-size: 0.95rem; }
details.grade .score { font: 700 1.4rem var(--sans); }
details.grade .score small { display: block; color: var(--muted); font: 500 0.72rem var(--sans); text-align: right; }
details.grade[open] > summary { border-bottom: 1px solid var(--line); }
.why { padding: 8px 18px 18px; }
.sig { display: grid; grid-template-columns: minmax(140px, 1.1fr) 2fr auto; gap: 6px 14px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.sig:last-of-type { border-bottom: 0; }
.sig .label { font-weight: 600; }
.sig .detail { color: var(--muted); font-size: 0.9rem; grid-column: 1 / -1; }
.sig .pts { font: 600 0.9rem var(--mono); color: var(--muted); text-align: right; white-space: nowrap; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.sig.na .bar > i { background: transparent; }
.sig.na .label::after { content: " · not counted"; color: var(--muted); font-weight: 400; font-size: 0.85rem; }
.tune { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--muted); }
.tune input[type="range"] { width: 90px; accent-color: var(--primary); }
.why .foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; font-size: 0.85rem; color: var(--muted); }
.side { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 10px; }
@media (max-width: 720px) { .sig { grid-template-columns: 1fr auto; } .sig .bar { grid-column: 1 / -1; grid-row: 2; } }
.side .card h3 { margin: 0 0 8px; font-size: 1rem; }
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { display: flex; gap: 10px; padding: 5px 0; font-size: 0.93rem; }
.checks .mark { font-family: var(--mono); width: 1.2em; flex: none; }
.checks .yes { color: var(--primary); } .checks .no { color: var(--bad); } .checks .unk { color: var(--muted); }
.stamp { color: var(--muted); font-size: 0.85rem; margin-top: 18px; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.skeleton { color: var(--muted); padding: 40px 0; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -2px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; background: var(--surface); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .letter { width: 1.9em; height: 1.9em; font-size: 0.9rem; border-width: 1.5px; border-radius: 8px; }
tr.pending td { color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.filters button { font: 500 0.85rem var(--sans); color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.filters button[aria-pressed="true"] { color: var(--bg); background: var(--primary); border-color: var(--primary); }
.filters .sep { width: 1px; background: var(--line); margin: 0 4px; }

/* privacy matrix & openness dots (drawn in CSS: the half-circle glyph renders badly in many fonts) */
.pm th, .pm td { padding: 10px 8px; }
.pm th { font-size: 0.7rem; letter-spacing: 0.04em; }
.pm td.cell { text-align: center; }
.pip { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; vertical-align: -2px; }
.pip.p2 { color: var(--primary); background: var(--primary); }
.pip.p1 { color: var(--warn); background: linear-gradient(90deg, var(--warn) 50%, transparent 50%); }
.pip.p0 { color: var(--bad); }
.pip.pn { width: 6px; height: 6px; border: 0; background: var(--muted); vertical-align: 2px; opacity: 0.7; }
.checks .pip { margin-top: 5px; flex: none; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 24px; }
.grid-auto .card h3 { margin-top: 0; }
.grid-auto .card p { margin: 0; color: var(--muted); }
td.c, th.c { text-align: center; }
.dot { display: inline-block; width: 0.9em; text-align: center; }
.dot.p2 { color: var(--primary); } .dot.p1 { color: var(--warn); } .dot.p0 { color: var(--bad); } .dot.pn { color: var(--muted); }
.legend { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 0.9rem; margin: 12px 0; }

/* method page markdown tables */
.prose table { margin: 14px 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: block; overflow-x: auto; }
.prose pre { background: var(--surface); padding: 14px 16px; border-radius: 10px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { margin: 18px 0; padding: 4px 18px; border-left: 3px solid var(--primary); color: var(--muted); }

/* privacy "protections" bar: green = on by default, amber = after changing settings */
td.prot { white-space: nowrap; }
.protbar { display: flex; gap: 2px; margin-bottom: 4px; }
.protbar i { width: 9px; height: 6px; border-radius: 2px; background: var(--surface-2); }
.protbar i.on { background: var(--primary); }
.protbar i.set { background: var(--warn); }
