:root {
  --bg: #111513;
  --panel: #161b19;
  --card: #1a201d;
  --raise: #212824;
  --line: #27302c;
  --line-strong: #34403a;
  --text: #cfd6d2;
  --muted: #8e9a94;
  --head: #f1f5f2;
  --accent: #7ed957;
  --accent-dim: #5fae3f;
  --accent-bg: rgba(126, 217, 87, .1);
  --note-bg: #231c1b;
  --note-line: #563631;
  --code-bg: #26302b;
  --top-h: 60px;
  --side-w: 256px;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top-h) + 60px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.7 Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.icon { width: 18px; height: 18px; flex: none; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  height: var(--top-h);
  display: flex; align-items: center; gap: 18px;
  padding: 0 22px;
  background: rgba(17, 21, 19, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--head); }
.brand:hover { text-decoration: none; }
.brand img { height: 30px; width: auto; display: block; }
.brand span { font-size: 15px; color: var(--muted); padding-left: 12px; border-left: 1px solid var(--line-strong); }
.menu-btn { display: none; background: none; border: 0; color: var(--text); padding: 6px; cursor: pointer; }
.menu-btn .icon { width: 22px; height: 22px; }

.search-open {
  margin-left: auto;
  display: flex; align-items: center; gap: 10px;
  width: min(380px, 40vw);
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 8px 10px 8px 12px;
  color: var(--muted); font: inherit; font-size: 15px; text-align: left; cursor: pointer;
}
.search-open:hover { border-color: var(--accent-dim); color: var(--text); }
.search-open span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
kbd {
  font: 500 12px/1 Inter, "Segoe UI", system-ui, sans-serif;
  color: var(--muted); background: var(--raise); border: 1px solid var(--line-strong);
  border-radius: 6px; padding: 4px 7px;
}

/* ---------------------------------------------------------------- sidebar */
.sidebar {
  position: fixed; top: var(--top-h); bottom: 0; left: 0; z-index: 20;
  width: var(--side-w);
  overflow-y: auto;
  padding: 18px 12px 40px;
  background: var(--bg);
  border-right: 1px solid var(--line);
  font-size: 15px;
}
.sidebar a, .sidebar summary {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 12px; border-radius: 9px;
  color: var(--text); cursor: pointer;
}
.sidebar a:hover, .sidebar summary:hover { background: var(--panel); text-decoration: none; }
.sidebar summary { list-style: none; font-weight: 500; color: var(--head); user-select: none; }
.sidebar summary::-webkit-details-marker { display: none; }
.sidebar summary span { flex: 1; }
.sidebar summary .icon { color: var(--muted); }
.sidebar .chev { width: 15px; height: 15px; transition: transform .15s; }
.side-group[open] > summary .chev { transform: rotate(90deg); }
.side-group { margin: 2px 0; }
.side-group a { padding: 6px 12px 6px 41px; color: var(--muted); font-size: 14.5px; }
.side-group a:hover { color: var(--text); }
.sidebar a.active { background: var(--accent-bg); color: var(--accent); }
.side-home { margin-bottom: 8px; font-weight: 500; }
.side-home .icon { color: var(--muted); }
.side-home.active .icon { color: var(--accent); }

/* ---------------------------------------------------------------- content */
.content { margin-left: var(--side-w); padding-top: var(--top-h); min-height: 100vh; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 40px; }

.top { padding: 40px 0 22px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 8px; letter-spacing: .02em; }
.crumbs a { color: var(--muted); }
.top h1 { margin: 0 0 6px; font-weight: 700; font-size: 40px; line-height: 1.15; letter-spacing: -.01em; color: var(--head); }
.top p { margin: 0; color: var(--muted); font-size: 18px; max-width: 820px; }

.jump {
  position: sticky; top: var(--top-h); z-index: 10;
  background: rgba(17, 21, 19, .95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.jump .wrap { display: flex; gap: 6px 20px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; font-size: 14.5px; }
.jump a { color: var(--muted); }
.jump a:hover { color: var(--accent); text-decoration: none; }

section { padding: 44px 0 6px; }
section > .wrap > h2 { margin: 0 0 6px; font-weight: 650; font-size: 28px; letter-spacing: -.01em; color: var(--head); }
.lead { max-width: 860px; margin: 0 0 24px; }

.card {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 30px;
  align-items: start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 22px;
  scroll-margin-top: calc(var(--top-h) + 70px);
  transition: border-color .3s, box-shadow .3s;
}
.card:target, .card.flash { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.card.text { grid-template-columns: minmax(0, 860px); }
.card h3 { margin: 0 0 8px; font-weight: 650; font-size: 22px; color: var(--head); }
.card p { margin: 0 0 14px; }
.card p:last-child { margin-bottom: 0; }
b, strong { font-weight: 600; color: var(--head); }

.clip {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #0c0f0d;
  cursor: zoom-in;
  line-height: 0;
}
.clip video { width: 100%; height: auto; display: block; aspect-ratio: 1600 / 966; }
.clip.win video { aspect-ratio: 1600 / 1060; }
.clip.wide video { aspect-ratio: 16 / 9; }
.clip::after {
  content: "Click to enlarge";
  position: absolute; right: 10px; bottom: 10px;
  font: 500 12px/1 Inter, "Segoe UI", system-ui, sans-serif;
  color: #fff; background: rgba(0, 0, 0, .6);
  padding: 6px 9px; border-radius: 8px;
  opacity: 0; transition: opacity .15s;
}
.clip:hover::after { opacity: 1; }

.facts { margin: 0 0 14px; padding: 0; list-style: none; font-size: 14px; color: var(--muted); }
.facts li { display: inline-block; margin-right: 16px; }
.facts b { font-weight: 500; color: var(--text); }

code {
  font: 500 14px/1 Inter, "Segoe UI", system-ui, sans-serif;
  background: var(--code-bg);
  color: var(--head);
  padding: 3px 7px;
  border-radius: 6px;
  white-space: nowrap;
}

.note {
  background: var(--note-bg);
  border: 1px solid var(--note-line);
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 15.5px;
  line-height: 1.6;
}
.license-list { margin: 0; padding-left: 20px; }
.license-list li { margin: 0 0 10px; line-height: 1.6; }

.beta {
  margin: 18px 0 0; max-width: 820px;
  background: rgba(224, 166, 58, .09);
  border: 1px solid rgba(224, 166, 58, .35);
  border-left: 4px solid #e0a63a;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 15px; line-height: 1.6; color: var(--text);
}
.beta strong { color: #f0be62; font-weight: 700; margin-right: 6px; text-transform: uppercase; letter-spacing: .08em; font-size: 12.5px; }
.note strong { display: block; font-weight: 600; color: var(--head); margin-bottom: 2px; }

.shot { border-radius: 12px; overflow: hidden; background: #0c0f0d; }
.shot img { width: 100%; height: auto; display: block; }

.lightbox {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, .9);
  display: none; align-items: center; justify-content: center;
  padding: 24px; cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox video { max-width: 100%; max-height: 100%; border-radius: 12px; }

footer { padding: 30px 0 60px; font-size: 13.5px; color: var(--muted); }

/* ---------------------------------------------------------------- home */
.hero {
  position: relative;
  padding: 72px 40px 64px;
  background:
    linear-gradient(90deg, var(--bg) 0%, var(--bg) 34%, rgba(17, 21, 19, .6) 62%, rgba(17, 21, 19, .15) 100%),
    linear-gradient(0deg, var(--bg) 0%, rgba(17, 21, 19, 0) 30%),
    url(images/cover.jpg) right center / cover no-repeat;
  border-bottom: 1px solid var(--line);
}
.hero-text { max-width: 640px; }
.kicker { margin: 0 0 14px; font-size: 12.5px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); }
.hero h1 { margin: 0 0 14px; font-size: 52px; line-height: 1.08; font-weight: 400; color: var(--head); letter-spacing: -.02em; }
.hero h1 b { font-weight: 800; }
.hero p { margin: 0 0 26px; font-size: 18px; color: var(--text); max-width: 600px; }
.search-open.big { margin: 0 0 22px; width: 100%; padding: 14px 14px 14px 18px; font-size: 16.5px; border-radius: 12px; background: rgba(22, 27, 25, .92); }
.search-open.big .icon { width: 20px; height: 20px; }
.hero-links { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 11px;
  border: 1px solid var(--line-strong); background: rgba(22, 27, 25, .85);
  color: var(--head); font-weight: 500; font-size: 15.5px;
}
.btn:hover { text-decoration: none; border-color: var(--accent-dim); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #10200a; font-weight: 650; }
.btn.primary:hover { background: #8fe46a; }

.topics, .topic-pages { padding: 48px 40px 8px; max-width: 1320px; }
.topics h2, .topic-pages h2 { margin: 0 0 4px; font-size: 28px; font-weight: 700; color: var(--head); display: flex; align-items: center; gap: 12px; }
.topic-pages h2 .icon { width: 24px; height: 24px; color: var(--accent); }
.sub { margin: 0 0 22px; color: var(--muted); }
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.topic, .tile {
  display: block; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  color: var(--text); transition: border-color .15s, transform .15s;
}
.topic:hover, .tile:hover { border-color: var(--accent-dim); text-decoration: none; transform: translateY(-2px); }
.topic img, .tile img { width: 100%; display: block; aspect-ratio: 16 / 8; object-fit: cover; object-position: left center; }
.topic div, .tile div { padding: 16px 18px 18px; }
.topic h3 { margin: 0 0 6px; display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 650; color: var(--head); }
.topic h3 .icon { color: var(--accent); width: 22px; height: 22px; }
.topic h3 .go { margin-left: auto; color: var(--muted); }
.topic p, .tile p { margin: 0 0 10px; font-size: 14.5px; color: var(--muted); line-height: 1.55; }
.count { font-size: 13px; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; padding-top: 14px; }
.tile h3 { margin: 0 0 6px; font-size: 18px; font-weight: 650; color: var(--head); }
.topic-pages:last-of-type { padding-bottom: 20px; }

/* ---------------------------------------------------------------- search */
.search-box {
  position: fixed; inset: 0; z-index: 50;
  display: none; justify-content: center; align-items: flex-start;
  padding: 9vh 16px 16px;
  background: rgba(5, 8, 6, .72);
}
.search-box.open { display: flex; }
.search-panel {
  width: min(760px, 100%); max-height: 80vh;
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  overflow: hidden;
}
.search-field { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.search-field .icon { width: 20px; height: 20px; color: var(--muted); }
.search-field input {
  flex: 1; min-width: 0; background: none; border: 0; outline: 0;
  color: var(--head); font: inherit; font-size: 18px;
}
.search-status { padding: 8px 18px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); }
.search-status .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); margin-right: 7px; vertical-align: 1px; }
.search-status.ready .dot { background: var(--accent); }
.search-results { overflow-y: auto; padding: 8px; }
.result {
  display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 14px;
  padding: 10px; border-radius: 11px; color: var(--text);
}
.result:hover, .result.sel { background: var(--raise); text-decoration: none; }
.result img { width: 120px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: #0c0f0d; }
.result .noimg { width: 120px; aspect-ratio: 16 / 9; border-radius: 8px; background: var(--card); }
.result .where { font-size: 12.5px; color: var(--muted); }
.result .title { font-weight: 600; color: var(--head); font-size: 16px; margin: 1px 0 3px; }
.result .snip { font-size: 14px; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result mark { background: none; color: var(--accent); }
.search-empty { padding: 26px 18px; color: var(--muted); font-size: 15px; }
.search-hint { padding: 10px 18px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); display: flex; gap: 16px; }

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 1000px) {
  .menu-btn { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .5); }
  body.nav-open .sidebar { transform: none; }
  .content { margin-left: 0; }
  .brand span { display: none; }
}
@media (max-width: 900px) {
  .card { grid-template-columns: 1fr; padding: 16px; gap: 16px; }
  .wrap { padding: 0 16px; }
  .top h1 { font-size: 30px; }
  .hero { padding: 40px 16px; background: linear-gradient(0deg, var(--bg) 10%, rgba(17, 21, 19, .75) 100%), url(images/cover.jpg) center / cover no-repeat; }
  .hero h1 { font-size: 36px; }
  .topics, .topic-pages { padding: 36px 16px 4px; }
  .search-open { width: auto; }
  .search-open span, .topbar .search-open kbd { display: none; }
  .search-open.big span { display: inline; }
  .result { grid-template-columns: 1fr; }
  .result img, .result .noimg { display: none; }
}
