/* Tokens follow the v2 portfolio (src/styles/site.css). No web fonts are
   loaded: a font fetched late would show up on the network counter. */
:root {
  --bg: #f4f5f2; --panel: #ffffff; --ink: #15171c; --body: #2c3038; --muted: #5b616b; --line: #dcdfd8;
  --accent: #ffc20e; --on-accent: #15171c;
  --ok: #0f7a4f; --ok-bg: #e3f3ea; --bad: #b42318; --bad-bg: #fde3dc; --warn-ink: #7a4b00;
  --cite-bg: #eef0ec; --cite-ink: #15171c; --hl: #fff6d6;
  --note-bg: #fff6d6; --note-ink: #4a3a00; --note-line: #e6c65a;
  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --sans: "IBM Plex Sans", -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101215; --panel: #181b20; --ink: #eceee9; --body: #cdd1d6; --muted: #9aa0a8; --line: #2a2e35;
    --ok: #4cc98f; --ok-bg: #12261c; --bad: #ff7a6b; --bad-bg: #3a1d17; --warn-ink: #f3c56a;
    --cite-bg: #23272e; --cite-ink: #eceee9; --hl: #2b2512;
    --note-bg: #2b2512; --note-ink: #f3e3a6; --note-line: #6b5a1d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101215; --panel: #181b20; --ink: #eceee9; --body: #cdd1d6; --muted: #9aa0a8; --line: #2a2e35;
  --ok: #4cc98f; --ok-bg: #12261c; --bad: #ff7a6b; --bad-bg: #3a1d17; --warn-ink: #f3c56a;
  --cite-bg: #23272e; --cite-ink: #eceee9; --hl: #2b2512;
  --note-bg: #2b2512; --note-ink: #f3e3a6; --note-line: #6b5a1d;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--body); font: 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2 { font-family: var(--display); color: var(--ink); letter-spacing: -0.02em; margin: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.1; }
h2 { font-size: 1.05rem; display: flex; align-items: center; gap: 0.5rem; }
p { margin: 0 0 0.6rem; }
code, .mono { font-family: var(--mono); font-size: 0.9em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: 0.875rem; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.top { padding: 40px 0 24px; }
.eyebrow { font-family: var(--mono); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.5rem; }
.lede { max-width: 68ch; margin-top: 0.8rem; color: var(--body); }
.notice, .note { background: var(--note-bg); color: var(--note-ink); border: 1px solid var(--note-line); border-radius: 8px; padding: 0.6rem 0.8rem; max-width: 68ch; }

.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 20px; align-items: start; padding-bottom: 32px; }
@media (max-width: 900px) { .grid { grid-template-columns: minmax(0, 1fr); } }
.col-main, .col-side { display: grid; gap: 20px; min-width: 0; }
.col-side { position: sticky; top: 16px; }
@media (max-width: 900px) { .col-side { position: static; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.8rem; }
.step { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 0.8rem; font-family: var(--mono); }
.row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.6rem; }

.btn { font: inherit; font-size: 0.95rem; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 0.5rem 0.9rem; cursor: pointer; display: inline-block; line-height: 1.3; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.small-btn { font-size: 0.85rem; padding: 0.3rem 0.7rem; }
.link-btn { font: inherit; font-size: 0.8rem; background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; padding: 0.2rem 0; }
.link-btn:hover { color: var(--ink); }
select, textarea, input[type="search"] { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem 0.6rem; max-width: 100%; }
select { min-width: 0; flex: 1 1 240px; }

.pill { font-family: var(--mono); font-size: 0.75rem; border: 1px solid var(--line); border-radius: 999px; padding: 0.15rem 0.6rem; color: var(--muted); white-space: nowrap; }
.pill.on, .pill.ok { color: var(--ok); border-color: currentColor; background: var(--ok-bg); }
.pill.bad { color: var(--bad); border-color: currentColor; background: var(--bad-bg); }

.ev-summary { border-top: 1px solid var(--line); padding-top: 0.6rem; margin-top: 0.4rem; }
.hash-line { overflow-wrap: anywhere; }
details > summary { cursor: pointer; color: var(--ink); margin: 0.4rem 0; }
#ev-filter { width: 100%; margin: 0.3rem 0 0.5rem; }

.msg-list { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.msg-list.compact { max-height: 260px; }
.msg { padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--line); }
.msg:last-child { border-bottom: 0; }
.msg.hl { background: var(--hl); box-shadow: inset 3px 0 0 var(--accent); }
.msg p { margin: 0.15rem 0 0; color: var(--ink); overflow-wrap: anywhere; }
.msg-meta { font-size: 0.8rem; overflow-wrap: anywhere; }
.msg-id { color: var(--ink); font-weight: 600; }

.bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 0.4rem 0; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s linear; }
#progress-text { overflow-wrap: anywhere; }

.suggest { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.7rem; }
.chip { font: inherit; font-size: 0.85rem; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 0.3rem 0.7rem; cursor: pointer; text-align: left; }
.chip:hover { border-color: var(--muted); }
.ask-form { display: flex; gap: 0.5rem; align-items: stretch; }
.ask-form textarea { flex: 1; resize: vertical; min-height: 2.8rem; min-width: 0; }
@media (max-width: 480px) { .ask-form { flex-direction: column; } }

.answers { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 0.9rem; }
.answer { border-top: 1px solid var(--line); padding-top: 0.9rem; }
.answer .q { font-weight: 600; color: var(--ink); }
.answer .a { color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.answer .a p { margin: 0 0 0.4rem; white-space: normal; }
.a-foot { margin-top: 0.5rem; }
.a-foot p { margin: 0.1rem 0; }
.warn { color: var(--warn-ink); }

.cite { font: 600 0.8rem var(--mono); border: 1px solid var(--line); background: var(--cite-bg); color: var(--cite-ink); border-radius: 5px; padding: 0.05rem 0.35rem; cursor: pointer; white-space: nowrap; vertical-align: 0.05em; }
.cite:hover { border-color: var(--ink); }
.cite-outside { border-style: dashed; border-color: var(--warn-ink); color: var(--warn-ink); }
.cite-missing { cursor: help; color: var(--bad); background: var(--bad-bg); border-color: transparent; text-decoration: line-through; text-decoration-thickness: 2px; }

.meter-num { font: 700 3.2rem/1 var(--display); color: var(--ok); margin: 0 0 0.4rem; }
.meter-num.bad { color: var(--bad); }
.net-list { list-style: none; padding: 0; margin: 0.3rem 0 0.6rem; font-family: var(--mono); font-size: 0.78rem; }
.net-list li { display: flex; justify-content: space-between; gap: 0.5rem; border-bottom: 1px dashed var(--line); padding: 0.15rem 0; overflow-wrap: anywhere; }
.net-list.after li { color: var(--bad); }

.head-hash { display: grid; gap: 0.1rem; margin-bottom: 0.6rem; }
.head-hash code { overflow-wrap: anywhere; font-size: 0.75rem; color: var(--ink); }
.chain { list-style: none; padding: 0; margin: 0 0 0.6rem; max-height: 60vh; overflow: auto; display: grid; gap: 0; }
.entry { position: relative; border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 8px; padding: 0.5rem 0.6rem; margin-bottom: 14px; }
.entry:not(:last-child)::after { content: ""; position: absolute; left: 14px; bottom: -15px; height: 14px; border-left: 2px solid var(--ok); }
.entry.broken { border-left-color: var(--bad); background: var(--bad-bg); }
.entry.broken::after, .entry.after-break::after { border-left: 2px dashed var(--bad); }
.entry.after-break { border-left-color: var(--warn-ink); }
.entry-head { display: flex; justify-content: space-between; gap: 0.4rem; font-size: 0.85rem; color: var(--ink); flex-wrap: wrap; }
.entry-status { font-family: var(--mono); font-size: 0.72rem; color: var(--ok); }
.entry.broken .entry-status { color: var(--bad); }
.entry.after-break .entry-status { color: var(--warn-ink); }
.entry-summary { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0.3rem 0; }
.entry-edit { width: 100%; font-size: 0.8rem; }
.hashes { white-space: pre; color: var(--muted); margin: 0.2rem 0 0; font-size: 0.72rem; overflow-x: auto; }
.entry-actions { display: flex; gap: 0.8rem; flex-wrap: wrap; }

dialog { border: 1px solid var(--line); border-radius: 12px; padding: 0; width: min(640px, calc(100vw - 32px)); background: var(--panel); color: var(--body); }
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.dlg { padding: 16px; }
.dlg .msg-list { max-height: 65vh; }

#drop-overlay { position: fixed; inset: 0; background: rgba(16, 18, 21, 0.7); display: grid; place-items: center; z-index: 10; pointer-events: none; }
#drop-overlay p { background: var(--panel); color: var(--ink); padding: 1rem 1.4rem; border-radius: 10px; border: 2px dashed var(--accent); }

.foot { padding-bottom: 32px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
.cite-weak { border-style: dashed; border-color: var(--warn-ink); }
