/* evilbyte — shared styles. draft-traviss-evil-byte-00 */

:root {
  --bg: #0a0b0d;
  --bg-panel: #15171b;
  --bg-panel-2: #1b1e23;
  --border: #2a2e35;
  --text: #e8e6e1;
  --text-dim: #9aa0a8;
  --text-faint: #666c76;
  --link: #7fb8ff;
  --link-hover: #a8d0ff;

  --good: #2fd48a;
  --good-dim: #1a5c42;
  --evil: #ff4d5e;
  --evil-dim: #6e1f28;
  --unrated: #f5a623;
  --unrated-dim: #6b4a12;
  --saturated: #ff1f3d;

  --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --radius: 10px;
  --max: 920px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

code, pre, kbd, .mono { font-family: var(--mono); }

::selection { background: var(--evil-dim); color: #fff; }

/* ---------- layout shells ---------- */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.wrap--wide { max-width: 1180px; }

/* ---------- nav ---------- */
.site-nav {
  position: sticky; top: 0; z-index: 40;
  background: rgba(10, 11, 13, 0.88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; max-width: 1180px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-weight: 700; color: var(--text); letter-spacing: 0.02em; }
.brand:hover { color: var(--text); text-decoration: none; }
.brand .byte {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 5px;
  background: linear-gradient(145deg, var(--evil), var(--saturated));
  color: #1a0508; font-size: 12px; font-weight: 800;
  box-shadow: 0 0 0 1px rgba(255,77,94,0.35), 0 0 18px -4px var(--evil);
}
.nav-links { display: flex; gap: 22px; align-items: center; font-size: 14.5px; }
.nav-links a { color: var(--text-dim); }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a.current { color: var(--evil); }
.nav-toggle { display: none; }

@media (max-width: 720px) {
  .nav-links {
    position: fixed; inset: 60px 0 auto 0; flex-direction: column; align-items: flex-start;
    background: var(--bg-panel); border-bottom: 1px solid var(--border);
    padding: 16px 24px 22px; gap: 14px; transform: translateY(-8px); opacity: 0; pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;
  }
  .nav-links.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav-toggle {
    display: inline-flex; background: none; border: 1px solid var(--border); color: var(--text);
    border-radius: 6px; padding: 6px 10px; font-family: var(--mono); font-size: 13px;
  }
}

/* ---------- doc header block (RFC boilerplate) ---------- */
.doc-header {
  font-family: var(--mono); font-size: 12.5px; color: var(--text-dim);
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; white-space: pre-wrap; line-height: 1.55; overflow-x: auto;
}

/* ---------- hero ---------- */
.hero { padding: 64px 0 40px; text-align: left; }
.eyebrow {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--evil); margin: 0 0 14px;
}
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); line-height: 1.08; margin: 0 0 14px; letter-spacing: -0.01em; }
.hero .lede { font-size: 1.15rem; color: var(--text-dim); max-width: 62ch; margin: 0 0 28px; }
.hero .meta-line { font-family: var(--mono); font-size: 13px; color: var(--text-faint); margin: 0 0 32px; }
.hero .meta-line strong { color: var(--text-dim); font-weight: 600; }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 14px; font-weight: 600;
  padding: 11px 18px; border-radius: 8px; border: 1px solid var(--border); cursor: pointer;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--evil); border-color: var(--evil); color: #200409; }
.btn--primary:hover { background: #ff6373; color: #200409; }
.btn--ghost { background: transparent; color: var(--text); }
.btn--ghost:hover { border-color: var(--text-dim); color: var(--text); background: var(--bg-panel); }

/* ---------- rating gadget ---------- */
.gadget {
  margin: 40px 0 8px; background: var(--bg-panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 26px; display: grid; grid-template-columns: auto 1fr; gap: 26px; align-items: center;
}
@media (max-width: 640px) { .gadget { grid-template-columns: 1fr; text-align: center; } }

.dial {
  --c: var(--unrated);
  width: 132px; height: 132px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--c) 35%, transparent), transparent 60%), var(--bg-panel-2);
  border: 2px solid var(--c);
  box-shadow: 0 0 30px -6px var(--c);
  margin: 0 auto;
  transition: border-color .3s ease, box-shadow .3s ease;
}
.dial .er-value { font-family: var(--mono); font-size: 2.6rem; font-weight: 800; color: var(--c); line-height: 1; transition: color .3s ease; }
.dial .er-max { font-family: var(--mono); font-size: 11px; color: var(--text-faint); }

.gadget-body h2 { margin: 0 0 6px; font-size: 1.05rem; }
.gadget-body .gadget-band {
  font-family: var(--mono); font-weight: 700; font-size: 0.95rem; margin: 0 0 10px; display: inline-block;
  padding: 3px 10px; border-radius: 999px; border: 1px solid var(--c, var(--border));
  color: var(--c, var(--text-dim));
}
.gadget-evidence { font-family: var(--mono); font-size: 12.5px; color: var(--text-dim); display: grid; gap: 6px; margin: 10px 0 14px; text-align: left; }
.gadget-evidence .row { display: flex; flex-wrap: wrap; gap: 2px 8px; }
.gadget-evidence .k { color: var(--text-faint); min-width: 15ch; white-space: nowrap; }
.gadget-foot { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.gadget-foot button.btn { padding: 8px 14px; font-size: 13px; }
.gadget-note { font-size: 12.5px; color: var(--text-faint); margin: 0; }

/* ---------- sections / cards ---------- */
section { padding: 44px 0; border-top: 1px solid var(--border); }
section:first-of-type { border-top: none; }
h2.section-title { font-size: 1.5rem; margin: 0 0 8px; }
p.section-sub { color: var(--text-dim); margin: 0 0 28px; max-width: 68ch; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 800px) { .grid-3 { grid-template-columns: 1fr; } }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card h3 { margin: 0 0 8px; font-size: 1rem; font-family: var(--mono); }
.card p { margin: 0; color: var(--text-dim); font-size: 14.5px; }

blockquote.abstract {
  margin: 0; padding: 20px 22px; background: var(--bg-panel); border-left: 3px solid var(--evil);
  border-radius: 0 var(--radius) var(--radius) 0; color: var(--text-dim); font-size: 15px;
}
blockquote.abstract p:first-child { margin-top: 0; }
blockquote.abstract p:last-child { margin-bottom: 0; }

/* ---------- footer ---------- */
footer.site-footer { border-top: 1px solid var(--border); padding: 36px 0 48px; margin-top: 24px; }
footer.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px; font-size: 13px; color: var(--text-faint); }
footer.site-footer a { color: var(--text-dim); }
footer.site-footer .foot-links { display: flex; gap: 16px; flex-wrap: wrap; }

/* ================= draft / spec page ================= */
.draft-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; align-items: start; padding: 36px 0 80px; }
@media (max-width: 900px) { .draft-layout { grid-template-columns: 1fr; } }

.draft-toc {
  position: sticky; top: 76px; max-height: calc(100vh - 100px); overflow-y: auto;
  font-family: var(--mono); font-size: 12.5px; border-right: 1px solid var(--border); padding-right: 18px;
}
@media (max-width: 900px) { .draft-toc { position: static; max-height: none; border-right: none; border-bottom: 1px solid var(--border); padding: 0 0 20px; } }
.draft-toc .toc-title { color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; font-size: 11px; margin-bottom: 10px; }
.draft-toc ul { list-style: none; margin: 0; padding: 0; }
.draft-toc li { margin: 2px 0; }
.draft-toc a { display: block; color: var(--text-dim); padding: 3px 0; border-left: 2px solid transparent; padding-left: 10px; }
.draft-toc a:hover { color: var(--text); text-decoration: none; }
.draft-toc ul ul a { padding-left: 20px; font-size: 12px; color: var(--text-faint); }
.draft-toc a.active { color: var(--evil); border-left-color: var(--evil); }

.draft-content { min-width: 0; font-size: 15.5px; }
.draft-content h1 { font-size: 1.9rem; margin: 0 0 6px; }
.draft-content h1 + p { font-family: var(--mono); color: var(--text-faint); font-size: 0.85rem; margin: -2px 0 20px; }
.draft-content h1 + p code { background: none; padding: 0; color: inherit; }
.draft-content h2 { font-size: 1.4rem; margin: 44px 0 14px; padding-top: 6px; scroll-margin-top: 76px; border-top: 1px solid var(--border); padding-top: 24px; }
.draft-content h2:first-of-type { border-top: none; margin-top: 20px; }
.draft-content h3 { font-size: 1.12rem; margin: 30px 0 10px; scroll-margin-top: 76px; }
.draft-content h4 { font-size: 0.98rem; margin: 24px 0 8px; font-family: var(--mono); color: var(--text-dim); scroll-margin-top: 76px; }
.draft-content h5 { font-size: 0.92rem; margin: 20px 0 6px; color: var(--text-dim); }
.draft-content p { color: #d8d6d1; margin: 0 0 14px; }
.draft-content ul, .draft-content ol { color: #d8d6d1; padding-left: 22px; }
.draft-content li { margin: 4px 0; }
.draft-content strong { color: var(--text); }
.draft-content hr { border: none; border-top: 1px solid var(--border); margin: 36px 0; }

.draft-content pre {
  background: #0d0e11; border: 1px solid var(--border); border-radius: 8px; padding: 16px 18px;
  overflow-x: auto; font-size: 12.8px; line-height: 1.55; margin: 0 0 18px;
}
.draft-content code { font-size: 0.92em; color: #e2c08d; }
.draft-content p code, .draft-content li code { background: var(--bg-panel-2); padding: 1px 5px; border-radius: 4px; }
.draft-content pre code { background: none; padding: 0; color: inherit; }

.draft-content table { width: 100%; border-collapse: collapse; margin: 0 0 22px; font-size: 13.5px; }
.draft-content th, .draft-content td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.draft-content th { background: var(--bg-panel); font-family: var(--mono); font-weight: 600; font-size: 12.5px; color: var(--text-dim); }
.draft-content tr:nth-child(even) td { background: rgba(255,255,255,0.015); }
.draft-content table + p em { color: var(--text-faint); }

.draft-content a { border-bottom: 1px dotted currentColor; }

.back-to-top {
  position: fixed; bottom: 22px; right: 22px; z-index: 30;
  background: var(--bg-panel); border: 1px solid var(--border); color: var(--text-dim);
  font-family: var(--mono); font-size: 12px; padding: 9px 13px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.back-to-top.visible { opacity: 1; pointer-events: auto; }
.back-to-top:hover { color: var(--text); text-decoration: none; }

/* ================= roadmap page ================= */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 2px 0 30px 26px; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--text-faint);
}
.timeline li.done::before { border-color: var(--good); background: var(--good); }
.timeline li.now::before { border-color: var(--evil); background: var(--evil); box-shadow: 0 0 0 4px var(--evil-dim); }
.timeline .t-title { font-weight: 700; margin: 0 0 4px; }
.timeline .t-status {
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-faint); margin-left: 8px;
}
.timeline li.done .t-status { color: var(--good); }
.timeline li.now .t-status { color: var(--evil); }
.timeline p { color: var(--text-dim); margin: 0; font-size: 14.5px; max-width: 60ch; }

.help-list { display: grid; gap: 12px; }
.help-list .card { display: flex; gap: 14px; align-items: flex-start; }
.help-list .card .n { font-family: var(--mono); color: var(--evil); font-weight: 800; }

.source-list { font-size: 14px; color: var(--text-dim); }
.source-list li { margin: 6px 0; }

/* ================= calculator page ================= */
.calc-layout { display: grid; grid-template-columns: 1fr 320px; gap: 32px; align-items: start; padding: 36px 0 80px; }
@media (max-width: 900px) { .calc-layout { grid-template-columns: 1fr; } }

.field-group { margin-bottom: 22px; }
.field-group > label.group-label {
  display: block; font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-faint); margin-bottom: 8px;
}
.field-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
select, input[type="number"] {
  background: var(--bg-panel); border: 1px solid var(--border); color: var(--text); border-radius: 7px;
  padding: 9px 11px; font-family: var(--sans); font-size: 14px; width: 100%;
}
select:focus, input:focus { outline: 2px solid var(--evil); outline-offset: 1px; }
.field-note { font-size: 12.5px; color: var(--text-faint); margin: 4px 0 0; }
label.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-dim); cursor: pointer; }
label.checkbox input { accent-color: var(--evil); }

.calc-result { position: sticky; top: 76px; background: var(--bg-panel); border: 1px solid var(--border); border-radius: 14px; padding: 22px; }
.calc-result .dial { margin-bottom: 14px; }
.calc-math {
  font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); background: var(--bg-panel-2);
  border-radius: 8px; padding: 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-word; line-height: 1.6;
}
.calc-breakdown { list-style: none; margin: 14px 0 0; padding: 0; font-family: var(--mono); font-size: 12px; color: var(--text-dim); display: grid; gap: 3px; }
.calc-breakdown li { display: flex; justify-content: space-between; gap: 10px; }
.calc-breakdown li span:last-child { color: var(--text); }

/* ================= misc pages ================= */
.prose { padding: 40px 0 80px; }
.prose h1 { font-size: 2rem; margin: 0 0 18px; }
.prose p { color: var(--text-dim); max-width: 66ch; }
