/* Yavi documentation — dark reading surface, magenta accent.
   Palette matches the yavithemes.com marketing site.
   No framework, no build: one file, plain CSS. */

:root {
  --bg: #150612;
  --bg-panel: #210b1c;
  --bg-soft: #1e0a19;
  --bg-deep: #0f040d;
  --line: #2d1a27;
  --line-soft: #23131e;
  --ink: #f7ecf2;
  --ink-2: #c6b0bd;
  --ink-3: #b39dab;
  --ink-4: #8d7784;
  --accent: #f0257f;
  --accent-2: #ff6fae;
  --accent-rgb: 240, 37, 127;
  --green: #86efac;
  --amber: #e1bb76;
  --rose: #ff7a5c;
  --rose-rgb: 255, 122, 92;
  --violet: #c9a6ff;
  --sans: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Space Grotesk', var(--sans);
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #452c3c; }

/* ---------- language hint ----------
   Der Balken, den auch yavithemes.com zeigt, hier mit den Tokens statt mit
   festen Werten - die Palette ist dieselbe, also faellt er identisch aus.
   Er steht unter der Topbar statt darueber: die Topbar ist sticky mit top:0,
   und die mobile Schublade haengt an ihren 62px. Ein Balken davor haette
   beide um seine eigene Hoehe verschoben. */
.lang-hint {
  /* Text, Link und Kreuz sind drei getrennte Flex-Items. Ohne wrap laeuft
     der Link auf schmalen Displays aus dem Balken heraus - mit wrap rutscht
     er in die zweite Zeile, das Kreuz bleibt oben rechts. */
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px;
  padding: 11px 24px;
  background: var(--bg-panel); border-bottom: 1px solid var(--line);
  font-size: 14.5px; line-height: 1.4; color: var(--ink-2);
}
.lang-hint a {
  color: var(--accent); text-decoration: underline; text-underline-offset: 3px;
  font-weight: 600;
}
.lang-hint a:hover { color: var(--accent-2); }
/* Schiebt das Kreuz nach rechts, ohne dem Text eine feste Breite zu geben. */
.lang-hint button {
  margin-left: auto; flex: none;
  width: 30px; height: 30px; padding: 0;
  background: none; border: 0; border-radius: 8px;
  color: var(--ink-4); font-family: inherit; font-size: 20px; line-height: 1;
  cursor: pointer; transition: color .2s, background .2s;
}
.lang-hint button:hover { color: var(--ink); background: rgba(255,255,255,.06); }
.lang-hint button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 620px) {
  .lang-hint { padding: 10px 20px; gap: 10px; font-size: 13.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .lang-hint button { transition: none; }
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 24px;
  background: rgba(21, 6, 18, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { height: 26px; width: auto; display: block; }
.brand-tag {
  font: 600 11px/1 var(--mono); color: var(--ink-3);
  background: var(--bg-soft); border: 1px solid var(--line);
  padding: 3px 7px; border-radius: 5px;
}

.topnav { display: flex; gap: 22px; font-size: 14px; }
.topnav a { color: var(--ink-3); }
.topnav a.active, .topnav a:hover { color: var(--accent); font-weight: 600; }
/* The two links that leave the docs sit behind a divider, so nobody clicks
   them expecting another chapter. */
.topnav a:not(.ext) + a.ext { border-left: 1px solid var(--line); padding-left: 22px; }

.spacer { flex: 1; }

.search {
  position: relative; width: 260px; height: 36px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg-soft);
  display: flex; align-items: center; padding: 0 10px 0 12px;
}
.search input {
  flex: 1; background: none; border: 0; outline: none;
  color: var(--ink); font-family: var(--sans); font-size: 13px;
}
.search input::placeholder { color: var(--ink-4); }
.kbd {
  font: 500 11px/1 var(--mono); color: var(--ink-4);
  border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px;
}

/* Two letters, not two flags: a flag is a country, and the docs are a
   language. Sits left of the version badge and survives down to 560px, where
   the version badge is the thing that goes. */
.langswitch {
  display: flex; align-items: center;
  /* The separator between EN and DE is a bare "|" text node. An anonymous flex
     item has no selector of its own, so the type lives on the pill and the
     segments inherit it — otherwise the bar renders in body font, top-aligned. */
  font: 600 11px/1 var(--mono); letter-spacing: 0.04em; color: var(--ink-4);
  border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  background: var(--bg-soft);
}
.langswitch a {
  /* stretch on the link, not the pill: the active segment's tint has to fill
     the full height, while the separator stays vertically centred. */
  align-self: stretch; display: flex; align-items: center;
  color: inherit; padding: 6px 8px;
}
.langswitch a:hover { color: var(--ink); }
.langswitch a.active { color: var(--accent); background: rgba(var(--accent-rgb), 0.12); }

.version {
  font: 600 12px/1 var(--mono); color: var(--accent);
  background: rgba(var(--accent-rgb), 0.12);
  border: 1px solid rgba(var(--accent-rgb), 0.32);
  padding: 5px 9px; border-radius: 6px;
}

/* The hamburger only exists below 1000px — see the responsive block. */
/* flex, not grid: grid rows would stretch to the button height and the two
   bars would never meet in the middle for the X. */
.burger {
  display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  width: 38px; height: 34px; padding: 0;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer;
}
.burger span {
  display: block; width: 17px; height: 2px; border-radius: 2px;
  background: var(--ink-2);
  transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}
.burger:hover span { background: var(--accent); }
body.nav-open .burger { border-color: rgba(var(--accent-rgb), 0.38); }
body.nav-open .burger span { background: var(--accent); }
body.nav-open .burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.nav-open .burger span:nth-child(2) { opacity: 0; }
body.nav-open .burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.nav-backdrop { display: none; }

/* ---------- layout ---------- */
.shell {
  display: grid;
  grid-template-columns: 262px minmax(0, 1fr) 260px;
  align-items: start;
  max-width: 1680px;
  margin: 0 auto;
}

.sidebar {
  position: sticky; top: 62px;
  height: calc(100vh - 62px);
  overflow-y: auto;
  padding: 22px 14px 60px;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 18px;
}
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--ink-4); padding: 0 10px 5px;
}
.sidebar a {
  display: block; padding: 7px 10px; border-radius: 6px;
  font-size: 14px; color: var(--ink-2); border-left: 2px solid transparent;
}
.sidebar a:hover { background: var(--bg-soft); color: var(--ink); }
.sidebar a.active {
  color: var(--accent); background: rgba(var(--accent-rgb), 0.12);
  font-weight: 600; border-left-color: var(--accent);
}

.main { min-width: 0; padding: 38px 46px 90px; }

.crumb { font-size: 13px; color: var(--ink-4); margin-bottom: 12px; }
.crumb span { color: var(--ink-3); }

/* ---------- typography ---------- */
.main h1 {
  font: 700 36px/1.2 var(--display); color: var(--ink);
  letter-spacing: -0.02em; margin: 0 0 18px;
}
.main h2 {
  font: 600 21px/1.3 var(--display); color: var(--ink);
  margin: 42px 0 14px; padding-top: 10px;
}
.main h3 { font: 600 17px/1.4 var(--display); color: var(--ink); margin: 30px 0 10px; }
.main h4 { font: 600 15px/1.4 var(--display); color: var(--ink); margin: 24px 0 8px; }
.main p { margin: 0 0 14px; max-width: 74ch; }
.main ul, .main ol { margin: 0 0 16px; padding-left: 22px; max-width: 74ch; }
.main li { margin: 6px 0; }
.main strong { color: var(--ink); font-weight: 600; }
.main em { color: var(--ink-2); }
.main hr { border: 0; border-top: 1px solid var(--line); margin: 34px 0; }

code {
  font-family: var(--mono); font-size: 0.88em; color: var(--accent-2);
  background: rgba(var(--accent-rgb), 0.1); padding: 1px 5px; border-radius: 4px;
}

/* ---------- code blocks ---------- */
.code {
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg-deep); margin: 0 0 20px; overflow: hidden;
  max-width: 940px;
}
.code-head {
  display: flex; align-items: center; height: 38px; padding: 0 14px;
  border-bottom: 1px solid var(--line);
  font: 600 12px/1 var(--mono); color: var(--accent);
}
.code-head .copy {
  margin-left: auto; background: none; border: 0; cursor: pointer;
  font: 400 11px/1 var(--sans); color: var(--ink-4);
}
.code-head .copy:hover { color: var(--accent); }
.code pre { margin: 0; padding: 16px; overflow-x: auto; }
.code code {
  background: none; padding: 0; color: #dcc9d5;
  font-size: 12.5px; line-height: 1.85; display: block;
}
.code .c { color: var(--ink-4); }
.code .k { color: var(--violet); }
.code .s { color: var(--accent-2); }
.code .v { color: #7fc9e8; }
.code .p { color: var(--accent); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 0 22px; max-width: 1100px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
thead th {
  text-align: left; padding: 11px 14px; background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  font: 700 11px/1.4 var(--sans); letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-4); white-space: nowrap;
}
tbody td {
  padding: 12px 14px; border-bottom: 1px solid var(--line-soft);
  vertical-align: top; color: var(--ink-2);
}
tbody tr:hover td { background: var(--bg-soft); }
tbody td:first-child { color: var(--ink); }

/* ---------- callouts ---------- */
.callout {
  display: flex; gap: 12px; border-radius: 8px;
  padding: 14px 16px; margin: 0 0 20px; max-width: 940px;
  background: rgba(var(--accent-rgb), 0.09);
  border: 1px solid rgba(var(--accent-rgb), 0.26);
  border-left: 3px solid var(--accent);
  color: #cbb5c3; font-size: 14px; line-height: 1.65;
}
.callout .mark { flex: none; font-weight: 700; color: var(--accent); }
.callout.warn {
  background: rgba(var(--rose-rgb), 0.08);
  border-color: rgba(var(--rose-rgb), 0.28);
  border-left-color: var(--rose);
}
.callout.warn .mark { color: var(--rose); }
.callout.danger {
  display: block; max-width: 1100px;
  padding: 22px 26px; margin: 0 0 28px;
  border-radius: 10px;
  background: rgba(var(--rose-rgb), 0.12);
  border: 1px solid rgba(var(--rose-rgb), 0.45);
  border-left: 5px solid var(--rose);
  color: #ffe3d9; font-size: 17px; line-height: 1.6;
}
.callout.danger .mark {
  display: block; float: left;
  margin: -2px 14px 0 0;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--rose); color: var(--bg-deep);
  font-size: 20px; font-weight: 700; line-height: 30px; text-align: center;
}
.callout.danger strong { color: #fff; }
.callout.danger code { color: #ffd9cc; font-size: 0.92em; }
.callout code { color: var(--accent-2); }

/* ---------- figures ---------- */
figure { margin: 0 0 26px; max-width: 1100px; }
figure img {
  width: auto; max-width: 100%;
  height: auto; max-height: 640px;
  display: block;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg-deep);
}
figure a:hover img { border-color: rgba(var(--accent-rgb), 0.5); }
figcaption { margin-top: 9px; max-width: 660px; font-size: 13px; color: var(--ink-4); }

/* ---------- videos ---------- */
/* Click-to-load, same player as yavithemes.com: a local poster with a button
   over it, and assets/video.js swaps in the YouTube iframe on activation.
   Nothing is requested from Google before the reader presses play. */
figure.video { max-width: 820px; }
.yt {
  position: relative; aspect-ratio: 16/9; overflow: hidden;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg-deep); cursor: pointer;
}
.yt img {
  width: 100%; height: 100%; max-height: none;
  object-fit: cover; display: block;
  border: 0; border-radius: 0;
}
.yt[data-yt-loaded] { cursor: default; }
.yt-play {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(21, 6, 18, 0.22); border: 0; cursor: pointer;
  transition: background 0.25s;
}
.yt-play:hover { background: rgba(21, 6, 18, 0.08); }
.yt-play:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
/* Disc and triangle are drawn in CSS rather than shipped as an icon file. */
.yt-play::before {
  content: ""; width: 66px; height: 66px; border-radius: 999px;
  background: linear-gradient(135deg, #e3017a, #ec0455);
  box-shadow: 0 10px 34px rgba(227, 1, 122, 0.42);
}
.yt-play::after {
  content: ""; position: absolute; width: 0; height: 0;
  border-left: 19px solid #fff;
  border-top: 11px solid transparent; border-bottom: 11px solid transparent;
  margin-left: 5px;
}
.yt-note { margin-top: 9px; max-width: 660px; font-size: 12.5px; color: var(--ink-4); }
@media (prefers-reduced-motion: reduce) { .yt-play { transition: none; } }

/* ---------- right column ---------- */
.toc {
  position: sticky; top: 62px;
  height: calc(100vh - 62px); overflow-y: auto;
  padding: 34px 22px 60px; border-left: 1px solid var(--line);
}
.toc-head {
  font-size: 11px; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--ink-4); margin-bottom: 12px;
}
.toc nav { display: flex; flex-direction: column; gap: 7px; }
.toc a { font-size: 13px; color: var(--ink-3); line-height: 1.45; }
.toc a:hover, .toc a.current { color: var(--accent); }
.toc a.lvl3 { padding-left: 12px; font-size: 12.5px; color: var(--ink-4); }

/* ---------- search results ---------- */
.results { display: none; flex-direction: column; gap: 2px; }
.results.open { display: flex; }
.results .hit { padding: 8px 10px; border-radius: 6px; }
.results .hit small { display: block; color: var(--ink-4); font-size: 11.5px; }

.foot {
  margin-top: 60px; padding-top: 18px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-4);
  display: flex; flex-wrap: wrap; gap: 8px 22px;
  align-items: baseline; justify-content: space-between;
}
/* The topnav hides these below 1000px, so the footer is where the way back to
   the site and the shop has to survive on a phone. */
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.foot-links a { color: var(--ink-3); }
.foot-links a:hover { color: var(--accent); }

/* ---------- responsive ---------- */
@media (max-width: 1400px) {
  .shell { grid-template-columns: 262px minmax(0, 1fr); }
  .toc { display: none; }
}
/* Below 1000px the sidebar stops being a column and becomes a drawer behind
   the hamburger: the chapter list is one tap away instead of a wall of links
   above every page. The search moves into the drawer with it (docs.js). */
@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .main { padding: 26px 20px 70px; }
  .topnav, .search { display: none; }
  .burger { display: flex; }

  .nav-backdrop {
    display: block;
    position: fixed; inset: 62px 0 0; z-index: 25;
    background: rgba(10, 3, 9, 0.7);
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .sidebar {
    position: fixed; top: 62px; right: 0; bottom: 0; left: auto;
    z-index: 26;
    width: min(320px, 86vw); height: auto;
    padding: 18px 14px 44px;
    background: var(--bg-panel);
    border-right: 0; border-left: 1px solid var(--line);
    overscroll-behavior: contain;
    transform: translateX(100%);
    transition: transform 0.22s ease;
  }
  .sidebar .search { display: flex; flex: none; width: auto; }

  body.nav-open { overflow: hidden; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
}

@media (max-width: 560px) {
  .topbar { gap: 12px; padding: 0 14px; }
  .brand-tag, .version { display: none; }
  .brand-logo { height: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .nav-backdrop, .burger span { transition: none; }
}

/* ---------- choice cards ---------- */
/* Two ways to continue, shown side by side. Used where a chapter forks and the
   reader has to pick before reading on. */
.choice {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px; margin: 0 0 24px; max-width: 940px;
}
.choice-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px 18px; border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  text-decoration: none; color: var(--ink);
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.choice-card:hover, .choice-card:focus-visible {
  background: rgba(var(--accent-rgb), 0.10);
  border-color: rgba(var(--accent-rgb), 0.40);
  border-left-color: var(--accent);
  transform: translateY(-1px);
}
.choice-label {
  font-weight: 700; font-size: 15px; line-height: 1.35;
}
.choice-label::after { content: " →"; color: var(--accent); }
.choice-note {
  font-size: 13.5px; line-height: 1.55; color: #cbb5c3;
}
@media (prefers-reduced-motion: reduce) {
  .choice-card { transition: none; }
  .choice-card:hover, .choice-card:focus-visible { transform: none; }
}
