:root {
  --bg: #fff8ec;
  --card: #ffffff;
  --ink: #1d1410;
  --muted: #6b5d52;
  --line: #1d1410;
  --brand: #ffd23f;
  --good: #19e68c;
  --caution: #ffc93c;
  --danger: #ff5a5f;
  --info: #8ecbff;
  --shadow: 5px 5px 0 var(--line);
  --radius: 18px;
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15100d;
    --card: #221a15;
    --ink: #fff3e0;
    --muted: #c3b2a2;
    --line: #000000;
    --shadow: 5px 5px 0 #000;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.55 var(--display);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
code, .mono { font-family: var(--mono); font-size: .9em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: .85rem; max-width: 70ch; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  font: 800 1.05rem var(--display);
  background: var(--brand); color: #1d1410;
  border: 3px solid var(--line); border-radius: 14px;
  padding: .75em 1.3em; cursor: pointer; text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 6px 6px 0 var(--line); }
.btn:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--line); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-small { padding: .45em .9em; font-size: .9rem; box-shadow: 3px 3px 0 var(--line); }
.btn-ghost { background: var(--card); color: var(--ink); }
.btn[aria-disabled="true"] { background: var(--card); color: var(--muted); pointer-events: none; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem clamp(16px, 4vw, 48px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 3px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.25rem; text-decoration: none; }
.brand-dog { width: 40px; height: 40px; display: block; }
.brand-dog svg { width: 100%; height: 100%; }
.nav-links { display: flex; gap: 1.4rem; font-weight: 700; }
.nav-links a { text-decoration: none; }
.nav-links a:hover { text-decoration: underline; text-underline-offset: 4px; }
@media (max-width: 720px) { .nav-links { display: none; } }

/* ---------- hero ---------- */
main { padding: 0 clamp(16px, 4vw, 48px); max-width: 1180px; margin: 0 auto; }
.hero {
  display: grid; grid-template-columns: 1.2fr .8fr; gap: 2rem; align-items: center;
  padding: clamp(2rem, 6vw, 5rem) 0 2.5rem;
}
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } .hero-art { order: -1; max-width: 220px; margin: 0 auto; } }
.eyebrow {
  display: inline-block; margin: 0 0 .8rem; padding: .2em .7em;
  font-weight: 800; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em;
  background: var(--good); color: #1d1410; border: 2px solid var(--line); border-radius: 999px;
}
h1 { font-size: clamp(2.8rem, 8vw, 5.4rem); line-height: .95; margin: 0 0 1rem; letter-spacing: -.03em; }
.lede { font-size: 1.15rem; max-width: 52ch; color: var(--muted); margin: 0 0 1.6rem; }
.hero-dog { width: 100%; aspect-ratio: 1; animation: bob 3.2s ease-in-out infinite; }
.hero-dog svg { width: 100%; height: 100%; filter: drop-shadow(6px 6px 0 var(--line)); }
@keyframes bob { 50% { transform: translateY(-10px) rotate(-2deg); } }
@media (prefers-reduced-motion: reduce) { .hero-dog, .sniffing .loader-dog { animation: none !important; } }

.scan-form { display: flex; gap: .7rem; max-width: 640px; }
.scan-form input {
  flex: 1; min-width: 0;
  font: 500 1rem var(--mono);
  padding: .85em 1em;
  background: var(--card); color: var(--ink);
  border: 3px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow);
}
.scan-form input:focus { outline: 3px solid var(--good); outline-offset: 2px; }
@media (max-width: 520px) {
  .scan-form { flex-wrap: wrap; }
  .scan-form input { flex-basis: 100%; }
  .scan-form .btn { flex: 1; }
}
.form-msg { min-height: 1.5em; margin: .7rem 0 0; font-weight: 700; color: var(--danger); }
.form-msg:empty { min-height: 0; margin: 0; }
/* `hidden` must win over component display rules like .btn { display: inline-flex }. */
[hidden] { display: none !important; }

.examples { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin: .9rem 0 0; }
.examples-label { font-weight: 700; color: var(--muted); font-size: .92rem; margin-right: .15rem; }
.chip {
  font: 700 .85rem var(--display); color: var(--ink); background: var(--card);
  border: 2px solid var(--line); border-radius: 999px; padding: .3em .85em;
  box-shadow: 2px 2px 0 var(--line); cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease, background .08s ease;
}
.chip:hover { background: var(--brand); color: #1d1410; transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--line); }
.chip:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--line); }
.chip:focus-visible { outline: 3px solid var(--good); outline-offset: 2px; }

.trust { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; list-style: none; padding: 0; margin: 1rem 0 .4rem; font-size: .88rem; font-weight: 700; color: var(--muted); }
.trust li::before { content: '✓'; color: var(--good); font-weight: 800; margin-right: .35em; }

.ca-pill {
  display: inline-flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  margin-top: .6rem; padding: .45rem .5rem .45rem .9rem;
  background: var(--card); border: 2px dashed var(--line); border-radius: 12px;
  max-width: 100%;
}
.ca-label { font-weight: 800; font-size: .8rem; text-transform: uppercase; }
.ca-pill code { word-break: break-all; }
.ca-copy { font: 700 .8rem var(--display); border: 2px solid var(--line); border-radius: 8px; background: var(--brand); color: #1d1410; padding: .2em .6em; cursor: pointer; }

/* ---------- report ---------- */
.report-wrap { scroll-margin-top: 90px; margin-bottom: 3rem; }
.report {
  background: var(--card); border: 3px solid var(--line); border-radius: var(--radius);
  box-shadow: 8px 8px 0 var(--line); overflow: hidden;
}
.report-head {
  display: grid; grid-template-columns: 150px 1fr auto; gap: 1.5rem; align-items: center;
  padding: 1.5rem; border-bottom: 3px solid var(--line);
}
.report-head[data-verdict="good"] { background: var(--good); color: #1d1410; }
.report-head[data-verdict="caution"] { background: var(--caution); color: #1d1410; }
.report-head[data-verdict="danger"] { background: var(--danger); color: #1d1410; }
.report-dog svg { width: 150px; height: 150px; display: block; }
.report-title { margin: 0; font-size: clamp(1.4rem, 3.5vw, 2rem); line-height: 1.1; word-break: break-word; }
.report-sub { margin: .3rem 0 0; font-weight: 700; }
.report-ca { margin: .4rem 0 0; font-size: .8rem; word-break: break-all; opacity: .8; }
.score { text-align: center; }
.score-num { font-size: clamp(3rem, 8vw, 4.6rem); font-weight: 800; line-height: 1; }
.score-max { font-weight: 800; opacity: .7; }
.score-verdict { font-weight: 800; margin-top: .3rem; }
@media (max-width: 720px) {
  .report-head { grid-template-columns: 90px 1fr; }
  .report-dog svg { width: 90px; height: 90px; }
  .score { grid-column: 1 / -1; display: flex; align-items: baseline; gap: .6rem; justify-content: flex-start; text-align: left; }
}
.badge-partial {
  display: inline-block; margin-top: .5rem; padding: .1em .6em; font-size: .8rem; font-weight: 800;
  border: 2px solid #1d1410; border-radius: 999px; background: #fff; color: #1d1410;
}

.report-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.report-body > div { padding: 1.4rem 1.5rem; }
.report-body > div + div { border-left: 3px solid var(--line); }
@media (max-width: 860px) { .report-body { grid-template-columns: 1fr; } .report-body > div + div { border-left: 0; border-top: 3px solid var(--line); } }
.report h3 { margin: 0 0 .8rem; font-size: 1.15rem; }
.report h3 ~ h3 { margin-top: 1.6rem; }

.findings { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.finding { display: grid; grid-template-columns: auto 1fr; gap: .7rem; align-items: start; }
.finding strong { display: block; }
.finding span.detail { color: var(--muted); font-size: .92rem; }
.sev {
  font: 800 .7rem var(--display); text-transform: uppercase; letter-spacing: .04em;
  padding: .25em .55em; border: 2px solid var(--line); border-radius: 8px; color: #1d1410; white-space: nowrap; margin-top: .15em;
}
.sev-critical { background: var(--danger); }
.sev-high { background: #ff8a5c; }
.sev-medium { background: var(--caution); }
.sev-low { background: #ffe9a8; }
.sev-info { background: var(--info); }
.sev-good { background: var(--good); }

.holders { width: 100%; border-collapse: collapse; font-size: .9rem; }
.holders td { padding: .35rem .2rem; border-bottom: 1px dashed color-mix(in srgb, var(--muted) 50%, transparent); vertical-align: middle; }
.holders td.rank { width: 1.8em; color: var(--muted); font-weight: 700; }
.holders td.pct { text-align: right; font-family: var(--mono); white-space: nowrap; width: 5.5em; }
.holders .bar { height: 6px; border-radius: 3px; background: var(--good); margin-top: .25rem; border: 1px solid var(--line); }
.holders .kind-creator .bar { background: var(--danger); }
.holders .kind-program .bar, .holders .kind-curve .bar { background: var(--info); }
.tag { font-size: .72rem; font-weight: 800; padding: .05em .45em; border-radius: 6px; border: 1.5px solid var(--line); margin-left: .35rem; color: #1d1410; background: var(--info); white-space: nowrap; }
.tag-creator { background: var(--danger); }
.tag-fresh { background: var(--caution); }
.tag-hub { background: #e6e0d8; }

.progress { height: 18px; border: 2px solid var(--line); border-radius: 999px; overflow: hidden; background: color-mix(in srgb, var(--muted) 18%, transparent); }
.progress > div { height: 100%; background: var(--good); }
.clusters { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; font-size: .9rem; }

.report-actions {
  display: flex; flex-wrap: wrap; gap: .7rem; align-items: center;
  padding: 1.1rem 1.5rem; border-top: 3px solid var(--line);
}
.report-actions .links { margin-left: auto; display: flex; gap: 1rem; font-weight: 700; font-size: .9rem; flex-wrap: wrap; }
@media (max-width: 720px) { .report-actions .links { margin-left: 0; width: 100%; } }

.loading { display: flex; align-items: center; gap: 1.2rem; padding: 1.5rem; }
.loader-dog { width: 90px; height: 90px; animation: sniff .5s ease-in-out infinite alternate; }
.loader-dog svg { width: 100%; height: 100%; }
@keyframes sniff { to { transform: translateX(10px) rotate(4deg); } }
.error-box { padding: 1.5rem; display: flex; gap: 1rem; align-items: center; }
.error-box svg { width: 80px; height: 80px; flex: none; }

/* ---------- sections ---------- */
.section { padding: 3rem 0; border-top: 3px dashed color-mix(in srgb, var(--muted) 45%, transparent); }
.section h2 { font-size: clamp(1.8rem, 4.5vw, 2.6rem); margin: 0 0 1rem; letter-spacing: -.02em; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.1rem; margin-bottom: 1rem; }
.card { background: var(--card); border: 3px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 .3rem; }
.card p { margin: 0; color: var(--muted); }

.self-scan .report { box-shadow: var(--shadow); }
.ledger table { width: 100%; border-collapse: collapse; background: var(--card); border: 3px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ledger th, .ledger td { text-align: left; padding: .6rem .9rem; border-bottom: 1px solid color-mix(in srgb, var(--muted) 35%, transparent); }
.ledger th { background: var(--brand); color: #1d1410; }
.ledger td.num { font-family: var(--mono); }

.roadmap { padding-left: 1.3rem; display: grid; gap: .6rem; max-width: 70ch; }
.roadmap li.done::marker { content: '✓  '; color: var(--good); font-weight: 800; }
details { background: var(--card); border: 3px solid var(--line); border-radius: 14px; padding: .8rem 1.1rem; margin-bottom: .7rem; max-width: 760px; }
summary { font-weight: 800; cursor: pointer; }
details p { margin: .6rem 0 0; color: var(--muted); }

.footer { border-top: 3px solid var(--line); padding: 2rem clamp(16px, 4vw, 48px) 3rem; text-align: center; color: var(--muted); font-size: .9rem; }
.footer-links { display: flex; gap: 1rem; justify-content: center; margin-bottom: .8rem; flex-wrap: wrap; }
