/* Brody's Builds */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --ink: #141821;
  --muted: #5a6273;
  --line: #e1e4ea;
  --accent: #f2622e;
  --accent-ink: #ffffff;
  --accent-soft: #fde9e1;
  --tip-bg: #e8f6f3;
  --tip-line: #0f9b8e;
  --warn-bg: #fff4dc;
  --warn-line: #e0a100;
  --shadow: 0 1px 2px rgba(16, 22, 34, .06), 0 6px 20px rgba(16, 22, 34, .07);
  --shadow-up: 0 2px 4px rgba(16, 22, 34, .08), 0 14px 34px rgba(16, 22, 34, .14);
  --band: #121722;
  --band-ink: #f3f5f8;
  --band-muted: #a9b2c2;
  --radius: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1016;
    --surface: #161a22;
    --surface-2: #1d222c;
    --ink: #e8ebf0;
    --muted: #9aa3b3;
    --line: #272d38;
    --accent-soft: #3a2117;
    --tip-bg: #10292a;
    --warn-bg: #2d2511;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --shadow-up: 0 2px 4px rgba(0, 0, 0, .35), 0 14px 34px rgba(0, 0, 0, .45);
    --band: #0a0d12;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1016;
  --surface: #161a22;
  --surface-2: #1d222c;
  --ink: #e8ebf0;
  --muted: #9aa3b3;
  --line: #272d38;
  --accent-soft: #3a2117;
  --tip-bg: #10292a;
  --warn-bg: #2d2511;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  --shadow-up: 0 2px 4px rgba(0, 0, 0, .35), 0 14px 34px rgba(0, 0, 0, .45);
  --band: #0a0d12;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--font);
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 820px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--band) 92%, transparent);
  backdrop-filter: blur(10px);
  color: var(--band-ink);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 800; font-size: 19px; white-space: nowrap; }
.topnav { display: flex; align-items: center; gap: 4px; }
.topnav a { color: var(--band-muted); text-decoration: none; font-size: 15px; font-weight: 600; padding: 8px 10px; border-radius: 8px; white-space: nowrap; }
.topnav a:hover { color: var(--band-ink); background: rgba(255, 255, 255, .07); }
.theme-btn { background: none; border: 0; color: var(--band-muted); padding: 8px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.theme-btn:hover { color: var(--band-ink); background: rgba(255, 255, 255, .07); }

/* ---------- home intro ---------- */
.intro {
  background-color: var(--band);
  background-image:
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px),
    radial-gradient(1000px 420px at 85% -10%, rgba(242, 98, 46, .28), transparent 60%),
    radial-gradient(800px 380px at 0% 110%, rgba(15, 155, 142, .25), transparent 60%);
  background-size: 28px 28px, 28px 28px, auto, auto;
  color: var(--band-ink);
  padding: 56px 0 40px;
}
.intro h1 { font-size: clamp(38px, 7vw, 64px); font-weight: 900; letter-spacing: -.03em; margin-bottom: 10px; }
.intro .lead { color: var(--band-muted); font-size: clamp(17px, 2.4vw, 20px); max-width: 640px; }
.search {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); color: var(--muted);
  border-radius: 14px; padding: 0 16px; margin: 26px 0 16px; max-width: 680px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  border: 2px solid transparent;
}
.search:focus-within { border-color: var(--accent); }
.search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink);
  font: inherit; font-size: 18px; padding: 15px 0;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  color: var(--band-ink); background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14); border-radius: 999px; padding: 6px 14px;
}
.chip:hover { background: rgba(255, 255, 255, .15); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stats { color: var(--band-muted); font-size: 14px; margin: 18px 0 0; }

/* ---------- sections and cards ---------- */
.section { margin: 44px 0; }
.sec-head { display: flex; align-items: baseline; gap: 12px; }
.sec-title { font-size: 26px; font-weight: 800; }
.count { color: var(--muted); font-size: 15px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.big-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }
.card {
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  color: inherit; text-decoration: none; box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-up); }
.card-img { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.card:hover .card-img img { transform: scale(1.04); }
.card-bg { display: none; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h3 { font-size: 18px; font-weight: 750; margin: 0; }
.card.big h3 { font-size: 21px; }
.card p { color: var(--muted); font-size: 15px; line-height: 1.5; margin: 0; }
.card .badges { margin-top: auto; }
/* Top projects: #1 is a big feature card, the next four sit beside it */
@media (min-width: 1000px) {
  .big-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
  .big-grid .card:first-child { grid-column: span 2; grid-row: span 2; }
  .big-grid .card:first-child .card-img { aspect-ratio: auto; flex: 1; min-height: 320px; }
  .big-grid .card:first-child .card-body { flex: none; }
  .big-grid .card:first-child .card-img img { position: absolute; inset: 0; object-fit: contain; }
  .big-grid .card:first-child .card-bg {
    display: block; position: absolute; inset: -40px;
    background-position: center; background-size: cover; filter: blur(26px) brightness(.85);
  }
  .big-grid .card:first-child h3 { font-size: 26px; }
  .big-grid .card:not(:first-child) h3 { font-size: 18px; }
  .big-grid .card:not(:first-child) p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
}
@media (min-width: 601px) and (max-width: 999px) {
  .big-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .big-grid .card:first-child { grid-column: span 2; }
}
.ribbon {
  position: absolute; top: 12px; left: 12px;
  background: #ffcc33; color: #3a2a00; font-size: 12px; font-weight: 800;
  padding: 4px 10px; border-radius: 999px; box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}
.rank {
  position: absolute; top: 12px; right: 12px;
  background: var(--accent); color: var(--accent-ink); font-weight: 900; font-size: 15px;
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .25);
}
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  font-size: 12.5px; font-weight: 700; line-height: 1;
  padding: 6px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted);
}
.badge.cat { background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); }
:root[data-theme="dark"] .badge.cat { color: color-mix(in srgb, var(--c) 60%, white); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.cat { color: color-mix(in srgb, var(--c) 60%, white); } }
.badge.d-easy { color: #1d8a3a; background: color-mix(in srgb, #1d8a3a 14%, transparent); }
.badge.d-medium { color: #b26b00; background: color-mix(in srgb, #e0a100 18%, transparent); }
.badge.d-hard { color: #c4302b; background: color-mix(in srgb, #c4302b 14%, transparent); }
.badge.wip { background: #ffcc33; color: #3a2a00; }
.empty { color: var(--muted); font-size: 18px; padding: 30px 0; }
.home.searching #top { display: none; }

/* other stuff */
.ogrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.ocard { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.ocard-img { aspect-ratio: 16 / 9; background: linear-gradient(135deg, #263042, #121722); }
.ocard-img img { width: 100%; height: 100%; object-fit: cover; }
.ocard-img img.icon { object-fit: contain; padding: 22px; }
.ocard-body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; align-items: flex-start; }
.ocard-body h3 { font-size: 18px; margin: 0; }
.ocard-body p { color: var(--muted); font-size: 15px; margin: 0 0 6px; flex: 1; }
.kind { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none;
  color: var(--ink); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 14px;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }

/* ---------- project page ---------- */
.project { padding-top: 22px; padding-bottom: 30px; }
.back { display: inline-block; font-weight: 700; text-decoration: none; margin-bottom: 18px; font-size: 15px; }
.hero { display: grid; grid-template-columns: 1.25fr 1fr; gap: 34px; align-items: center; }
.hero-img { border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-up); background: var(--surface-2); display: block; }
.hero-img img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.hero h1 { font-size: clamp(32px, 5vw, 46px); font-weight: 900; letter-spacing: -.025em; margin: 12px 0 10px; }
.lead { font-size: 19px; color: var(--muted); }
.board { font-size: 15px; color: var(--muted); }
.board strong { color: var(--ink); }
.jump { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.jump a {
  font-size: 14px; font-weight: 700; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px;
}
.jump a:hover { border-color: var(--accent); color: var(--accent); }
.project > .callout { margin-top: 30px; }

.parts { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.parts li { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.parts label { display: flex; gap: 12px; align-items: flex-start; padding: 11px 14px; cursor: pointer; font-size: 16px; line-height: 1.45; }
.parts input { width: 19px; height: 19px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.parts input:checked + span { color: var(--muted); text-decoration: line-through; }

.guide { max-width: 820px; }
.guide h2 { font-size: 28px; font-weight: 850; margin: 46px 0 14px; padding-top: 6px; }
.guide h3 { font-size: 21px; margin: 30px 0 10px; }
.guide h4 { font-size: 17px; margin: 22px 0 8px; }
.guide h3.step { display: flex; align-items: center; gap: 12px; }
.step-num {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center;
  font-size: 17px; font-weight: 900;
}
.guide ul, .guide ol { padding-left: 1.4em; margin: 0 0 1em; }
.guide li { margin: .3em 0; }
.guide code, .callout code, .parts code {
  font-family: var(--mono); font-size: .88em; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px;
}
.guide figure { margin: 18px 0 24px; }
.guide figure img { border-radius: 14px; box-shadow: var(--shadow); background: #fff; width: auto; max-width: 100%; max-height: 680px; height: auto; }
.guide figcaption { color: var(--muted); font-size: 14.5px; margin-top: 8px; }
.zoom { cursor: zoom-in; }
.callout { border-left: 4px solid var(--tip-line); background: var(--tip-bg); border-radius: 0 12px 12px 0; padding: 14px 18px; margin: 16px 0 20px; }
.callout p:last-child { margin-bottom: 0; }
.callout.warn { border-color: var(--warn-line); background: var(--warn-bg); }
.table-wrap { overflow-x: auto; margin: 10px 0 20px; border-radius: 12px; border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; background: var(--surface); font-size: 15.5px; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
pre.snippet { background: #0f131b; color: #e6e9ef; padding: 14px 16px; border-radius: 12px; overflow-x: auto; font: 14px/1.5 var(--mono); }
pre.snippet code { background: none; border: 0; padding: 0; color: inherit; }

/* code viewer */
.codebox { margin-top: 16px; border-radius: 14px; overflow: hidden; background: #0f131b; color: #e6e9ef; box-shadow: var(--shadow); }
.tabs { display: flex; overflow-x: auto; background: #161b25; border-bottom: 1px solid #252c39; }
.tab {
  font: 600 14px var(--mono); color: #9aa5b8; background: none; border: 0; cursor: pointer;
  padding: 12px 16px; white-space: nowrap; border-bottom: 2px solid transparent;
}
.tab.on { color: #fff; border-bottom-color: var(--accent); }
.pane { display: none; }
.pane.on { display: block; }
.code-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #222937; }
.fname { font: 13px var(--mono); color: #9aa5b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-btns { display: flex; gap: 8px; flex: none; }
.code-btns .btn, .code-btns button { font: 700 13px var(--font); color: #e6e9ef; background: #222a38; border: 1px solid #323b4d; border-radius: 8px; padding: 6px 12px; cursor: pointer; text-decoration: none; }
.code-btns button:hover, .code-btns .btn:hover { background: #2c3546; }
.code-note { margin: 0; padding: 10px 14px; font-size: 14px; color: #c5ccd8; background: #141a24; border-bottom: 1px solid #222937; }
pre.code { margin: 0; padding: 12px 0; overflow: auto; font: 13.5px/1.55 var(--mono); counter-reset: line; tab-size: 4; }
.pane.tall:not(.open) pre.code { max-height: 560px; }
pre.code code { display: block; min-width: max-content; }
.ln { display: block; padding: 0 18px 0 0; white-space: pre; min-height: 1.55em; }
.ln::before {
  counter-increment: line; content: counter(line);
  display: inline-block; width: 3.6em; padding-right: 1em; margin-right: .6em; text-align: right;
  color: #4f5a6e; border-right: 1px solid #222937; user-select: none;
}
.expand { display: none; width: 100%; font: 700 14px var(--font); color: #e6e9ef; background: #161b25; border: 0; border-top: 1px solid #252c39; padding: 11px; cursor: pointer; }
.pane.tall:not(.open) .expand { display: block; }
.t-com { color: #7d8aa0; font-style: italic; }
.t-str { color: #a5d68a; }
.t-num { color: #f5a26a; }
.t-kw { color: #c792ea; }
.t-ty { color: #63c5f0; }
.t-pre { color: #ff8f73; }

/* downloads and gallery */
.dls { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.dl { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; text-decoration: none; color: inherit; }
.dl:hover { border-color: var(--accent); }
.dl-icon { flex: none; width: 52px; height: 52px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-weight: 900; font-size: 13px; display: grid; place-items: center; }
.dl-text { display: flex; flex-direction: column; min-width: 0; }
.dl-text small { color: var(--muted); font-size: 13.5px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(5, 7, 10, .92); display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; background: #fff; }
.lb-close { position: absolute; top: 12px; right: 16px; font-size: 36px; line-height: 1; color: #fff; background: none; border: 0; cursor: pointer; }

/* footer */
.footer { border-top: 1px solid var(--line); margin-top: 60px; padding: 30px 0 40px; color: var(--muted); font-size: 15px; }
.footer strong { color: var(--ink); }

/* ---------- phones ---------- */
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 18px; }
}
@media (max-width: 600px) {
  body { font-size: 16.5px; }
  .wrap { padding: 0 16px; }
  .topnav a:not(:nth-child(2)) { display: none; }
  .topnav a { padding: 8px 7px; font-size: 14px; }
  .brand { font-size: 17px; }
  .brand img { width: 30px; height: 30px; }
  .intro { padding: 36px 0 30px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .big-grid { grid-template-columns: 1fr; gap: 18px; }
  .card-body { padding: 10px 12px 12px; }
  .card h3 { font-size: 16px; }
  .card.big h3 { font-size: 19px; }
  .grid .card:not(.big) .badge.diff { display: none; }
  .section { margin: 32px 0; }
  .guide h2 { font-size: 24px; }
  .parts { grid-template-columns: 1fr; }
  pre.code { font-size: 12.5px; }
  .ln::before { width: 2.8em; }
}
@media (max-width: 360px) {
  .topnav a { display: none !important; }
}
