/* ==========================================================================
   Proper Video Player (WebGL) — documentation site
   Old-school manual styling: dense classic type, square corners, solid
   1px borders, underlined links. Brand palette: near-black ground,
   hard-hat red #E4230D, work-shirt blue #5AA9E8.
   ========================================================================== */

:root {
  --bg: #0c0d10;
  --bg-raised: #101218;
  --bg-panel: #14161c;
  --bg-code: #101218;
  --border: #2b2f38;
  --border-soft: #1d2027;
  --text: #d9dce2;
  --text-dim: #9aa3af;
  --text-faint: #6b7380;
  --red: #e4230d;
  --red-hot: #ff4930;
  --red-soft: rgba(228, 35, 13, 0.12);
  --blue: #5aa9e8;
  --blue-bright: #8ec7f5;
  --topbar-h: 60px;
  --sidebar-w: 264px;
  --font: Verdana, Geneva, Tahoma, "DejaVu Sans", sans-serif;
  --mono: Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--topbar-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.65;
}

::selection { background: rgba(228, 35, 13, 0.35); }

* { scrollbar-width: thin; scrollbar-color: #2c3039 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #2c3039; }
*::-webkit-scrollbar-track { background: transparent; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--red); color: #fff; padding: 6px 12px;
}
.skip-link:focus { left: 0; }

a { color: var(--blue); text-decoration: underline; }
a:hover { color: var(--blue-bright); }
:focus-visible { outline: 2px solid var(--blue-bright); outline-offset: 2px; }

/* ==========================================================================
   Topbar
   ========================================================================== */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar-h); z-index: 100;
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  background: rgba(18, 20, 25, .96);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
  backdrop-filter: blur(12px);
}
.brand {
  display: flex; align-items: center; gap: 10px; min-width: 0; flex-shrink: 0;
  color: var(--text); text-decoration: none;
}
.brand:hover { color: var(--text); }
.brand-mark { display: block; width: 30px; height: 30px; }
.brand-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; line-height: 1.15; }
.brand-product { color: var(--text); font-size: 13.5px; white-space: nowrap; }
.brand-section {
  color: var(--text-dim); font-size: 10.5px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.topbar-link {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 10px;
  color: var(--text-dim); font-size: 12px; text-decoration: none;
}
.topbar-link:hover { background: var(--bg-panel); color: var(--text); }
.topbar-right .btn-demo {
  margin-left: 4px; background: transparent; color: var(--text); border-color: var(--border);
}
.topbar-right .btn-demo:hover { background: var(--red-soft); color: #fff; border-color: var(--red); }

.btn {
  display: inline-block;
  font-family: var(--font); font-weight: 700; font-size: 12.5px; line-height: 1;
  padding: 8px 14px; border: 1px solid transparent;
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn-demo, .btn-primary { background: var(--red); color: #fff; border-color: #7c1207; }
.btn-demo:hover, .btn-primary:hover { background: var(--red-hot); color: #fff; }
.btn-secondary { background: var(--bg-panel); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--text-faint); color: #fff; }
.btn-big { font-size: 13.5px; padding: 10px 18px; }

.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 4px;
  width: 34px; height: 34px; padding: 7px; margin-left: -4px;
  background: none; border: 1px solid var(--border); cursor: pointer;
}
.nav-toggle span { display: block; height: 2px; background: var(--text); }

/* ==========================================================================
   Shell / sidebar
   ========================================================================== */
.shell { display: flex; padding-top: var(--topbar-h); min-height: 100vh; }

.sidebar {
  position: sticky; top: var(--topbar-h); align-self: flex-start;
  width: var(--sidebar-w); flex-shrink: 0;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 18px 12px 22px 16px;
  border-right: 1px solid var(--border);
  background: var(--bg-raised);
  display: flex; flex-direction: column;
}
.sidebar-scrim { display: none; }

.nav-section { margin-bottom: 16px; }
.nav-section-title {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-faint); margin: 0 0 4px 8px;
}
.nav-section ul { list-style: none; margin: 0; padding: 0; }
.nav-section li a {
  display: block; color: var(--text-dim); font-size: 12.5px;
  padding: 4px 8px; text-decoration: none; border-left: 2px solid transparent;
}
.nav-section li a:hover { color: var(--text); text-decoration: underline; }
.nav-section li.active a {
  color: var(--red-hot); background: var(--red-soft);
  border-left-color: var(--red); font-weight: 700;
}
.nav-badge { display: none; }

.sidebar-footer {
  margin-top: auto; padding: 12px 8px 0; display: flex; gap: 10px; align-items: center;
  border-top: 1px solid var(--border-soft); font-size: 11.5px; color: var(--text-dim);
}
.sidebar-footer img { border: 1px solid var(--border); background: var(--bg-panel); object-fit: cover; object-position: top; }

/* --- search --------------------------------------------------------------- */
.search-box { position: relative; margin-bottom: 18px; }
#search-input {
  width: 100%; padding: 6px 10px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border);
  font-family: var(--font); font-size: 12.5px; outline: none;
}
#search-input:focus { border-color: var(--blue); }
#search-input::placeholder { color: var(--text-faint); }
.search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: -6px; z-index: 60;
  background: var(--bg-panel); border: 1px solid var(--border);
  max-height: 380px; overflow-y: auto;
}
.search-results a {
  display: block; padding: 8px 10px; border-bottom: 1px solid var(--border-soft);
  color: var(--text); font-size: 12px; text-decoration: none;
}
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover, .search-results a.sel { background: var(--red-soft); }
.search-results .sr-section { color: var(--text-faint); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.search-results .sr-match { color: var(--text-dim); font-size: 11px; display: block; margin-top: 1px; }
.search-results .sr-empty { padding: 10px; color: var(--text-faint); font-size: 12px; }
.search-results mark { background: none; color: var(--red-hot); font-weight: 700; }

/* ==========================================================================
   Content column
   ========================================================================== */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content {
  display: flex; gap: 38px; width: 100%;
  max-width: 1120px; margin: 0 auto; padding: 32px 38px 18px;
  flex: 1; align-items: flex-start;
}
.doc { flex: 1; min-width: 0; max-width: 780px; }

/* --- typography ----------------------------------------------------------- */
.doc h1 {
  font-size: 25px; line-height: 1.25;
  margin: 0 0 12px; font-weight: 700;
  padding-bottom: 10px; border-bottom: 3px double var(--border);
}
.doc .lead { font-size: 14.5px; color: var(--text-dim); margin: 0 0 24px; }
.doc h2 {
  font-size: 18px; font-weight: 700;
  margin: 38px 0 10px; padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
}
.doc h3 { font-size: 14.5px; font-weight: 700; margin: 26px 0 8px; }
.doc h4 { font-size: 13.5px; font-weight: 700; margin: 20px 0 6px; }
.doc p { margin: 0 0 12px; }
.doc ul, .doc ol { margin: 0 0 14px; padding-left: 26px; }
.doc ul { list-style: square; }
.doc li { margin-bottom: 5px; }
.doc li > ul, .doc li > ol { margin-top: 5px; }
.doc strong { color: #fff; }
.doc hr { border: 0; border-top: 1px solid var(--border); margin: 30px 0; }
.doc img { max-width: 100%; }

.hlink {
  margin-left: 8px; color: var(--text-faint); font-weight: 400; font-size: 0.8em;
  text-decoration: none; visibility: hidden;
}
h2:hover .hlink, h3:hover .hlink { visibility: visible; }
.hlink:hover { color: var(--red-hot); }

/* --- code ----------------------------------------------------------------- */
code {
  font-family: var(--mono); font-size: 0.93em;
  background: var(--bg-code); border: 1px solid var(--border-soft);
  padding: 1px 5px; color: #d8dee8;
  overflow-wrap: anywhere;
}
pre {
  position: relative;
  background: var(--bg-code); border: 1px solid var(--border);
  padding: 13px 15px; margin: 0 0 16px;
  overflow-x: auto; line-height: 1.5;
}
pre code { background: none; border: 0; padding: 0; font-size: 12.5px; color: #d8dee8; overflow-wrap: normal; }
.copy-btn {
  position: absolute; top: 6px; right: 6px;
  background: var(--bg-panel); color: var(--text-dim);
  border: 1px solid var(--border);
  font-size: 10.5px; font-family: var(--font); padding: 3px 8px; cursor: pointer;
  visibility: hidden;
}
pre:hover .copy-btn { visibility: visible; }
.copy-btn:hover { color: var(--text); border-color: var(--text-faint); }
.copy-btn.ok { color: #43b581; border-color: #43b581; }

/* minimal C# token colors (applied by site.js) */
.tok-k { color: #6cb3ee; }        /* keyword */
.tok-s { color: #e8a56c; }        /* string */
.tok-c { color: #5f9e63; font-style: italic; }  /* comment */
.tok-ty { color: #56c8c0; }       /* type */
.tok-n { color: #cfa9e8; }        /* number */

/* --- tables ---------------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 0 0 16px; }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
th, td { text-align: left; padding: 7px 12px; border: 1px solid var(--border); vertical-align: top; }
th {
  background: var(--bg-panel); color: var(--text); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap;
}
tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.015); }
td code, th code { white-space: nowrap; }

/* --- callouts --------------------------------------------------------------- */
.callout {
  display: flow-root; margin: 0 0 16px; padding: 11px 14px;
  border: 1px solid var(--border); border-left: 3px solid var(--border);
  background: var(--bg-panel); font-size: 12.5px;
}
.callout p:last-child { margin-bottom: 0; }
.callout .callout-title {
  display: block; font-weight: 700; font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; margin-bottom: 4px;
}
.callout-note { border-left-color: var(--blue); }
.callout-note .callout-title { color: var(--blue); }
.callout-tip { border-left-color: #43b581; }
.callout-tip .callout-title { color: #43b581; }
.callout-warn { border-left-color: #e8a13c; }
.callout-warn .callout-title { color: #e8a13c; }
.callout-danger { border-left-color: var(--red); }
.callout-danger .callout-title { color: var(--red-hot); }

/* --- pager / footer ---------------------------------------------------------- */
.pager {
  display: flex; justify-content: space-between; gap: 14px; margin-top: 44px;
  border-top: 1px solid var(--border); padding-top: 14px;
}
.pager a { display: block; color: var(--text); text-decoration: none; }
.pager a span { display: block; font-size: 11px; color: var(--text-faint); }
.pager a strong { font-size: 13px; text-decoration: underline; }
.pager a:hover strong { color: var(--red-hot); }
.pager .pager-next { text-align: right; margin-left: auto; }

.footer {
  max-width: 1120px; margin: 22px auto 0; padding: 16px 38px 26px; width: 100%;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  font-size: 11.5px; color: var(--text-dim);
}
.footer-dim { color: var(--text-faint); }

/* --- On this page TOC --------------------------------------------------------- */
.toc { width: 200px; flex-shrink: 0; position: sticky; top: calc(var(--topbar-h) + 28px); }
.toc-inner { border-left: 1px solid var(--border); padding-left: 14px; }
.toc-title {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .09em; color: var(--text-faint); margin-bottom: 7px;
}
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0 0 2px; }
.toc li.toc-h3 { padding-left: 12px; }
.toc a {
  display: block; color: var(--text-dim); font-size: 11.5px; line-height: 1.45;
  padding: 2px 0 2px 9px; margin-left: -15px; border-left: 2px solid transparent;
  text-decoration: none;
}
.toc a:hover { text-decoration: underline; }
.toc a.active { color: var(--red-hot); border-left-color: var(--red); }

/* ==========================================================================
   Documentation home
   ========================================================================== */
.doc-landing { max-width: 100%; }
.docs-home-header {
  margin: 0 0 28px; padding: 26px 28px;
  background: var(--bg-raised);
  border: 1px solid var(--border); border-left: 3px solid var(--red);
}
.docs-home-label {
  margin-bottom: 8px; color: var(--red-hot);
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  letter-spacing: .11em; text-transform: uppercase;
}
.docs-home-header h1 {
  margin: 0 0 12px; padding: 0; border: 0;
  font-size: clamp(28px, 4vw, 38px); line-height: 1.18;
}
.doc .docs-home-lead {
  max-width: 68ch; margin-bottom: 18px;
  color: #b6bdc8; font-size: 15px;
}
.docs-home-actions { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; }
.docs-home-jump { margin-left: 4px; font-size: 12.5px; }

.docs-start-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
  margin: 0 0 30px;
}
.docs-start-card {
  display: flex; flex-direction: column; gap: 4px; padding: 14px;
  background: var(--bg-panel); border: 1px solid var(--border);
  color: var(--text); text-decoration: none;
}
.docs-start-card:hover { color: var(--text); border-color: var(--blue); background: #171a21; }
.docs-start-card strong { font-size: 13px; text-decoration: underline; }
.docs-start-card > span:last-child { color: var(--text-dim); font-size: 11.5px; line-height: 1.5; }

/* ==========================================================================
   Interactive demo
   ========================================================================== */
.demo-stage {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  background: #000; border: 1px solid var(--border);
  overflow: hidden; margin: 18px 0 12px;
}
.demo-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.demo-poster {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px; text-align: center;
  background:
    radial-gradient(circle at 50% 35%, rgba(90,169,232,.1), transparent 42%),
    linear-gradient(145deg, #11141a, #090a0d);
  padding: 28px;
}
.demo-poster-copy { display: flex; flex-direction: column; align-items: center; max-width: 520px; }
.demo-label {
  margin-bottom: 6px; color: var(--blue-bright); font-family: var(--mono);
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.demo-poster-copy strong { color: #fff; font-size: 21px; line-height: 1.3; }
.demo-poster .demo-size { color: var(--text-faint); font-size: 11.5px; }
.demo-actions { display: flex; gap: 10px; align-items: center; margin: 4px 0 18px; flex-wrap: wrap; }
.demo-actions .btn[disabled] { opacity: .45; pointer-events: none; }
.demo-doc-link { margin-left: 2px; font-size: 12px; }

/* ==========================================================================
   Utility
   ========================================================================== */
.badge {
  display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .05em;
  padding: 1px 8px; vertical-align: 2px;
  background: rgba(90,169,232,.12); color: var(--blue-bright); border: 1px solid rgba(90,169,232,.35);
}
.badge-red { background: var(--red-soft); color: var(--red-hot); border-color: rgba(228,35,13,.4); }
.muted { color: var(--text-dim); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.doc .checklist { list-style: square; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1200px) {
  .toc { display: none; }
}
@media (max-width: 1020px) {
  .nav-toggle { display: flex; }
  .sidebar {
    position: fixed; left: 0; top: var(--topbar-h); bottom: 0; z-index: 90;
    display: none;
  }
  body.nav-open .sidebar { display: flex; }
  body.nav-open .sidebar-scrim {
    display: block; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 80;
    background: rgba(0, 0, 0, 0.55);
  }
  .content { padding: 24px 20px 12px; }
  .footer { padding: 14px 20px 22px; }
}
@media (max-width: 820px) {
  .docs-start-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .topbar-link { display: none; }
  .brand { gap: 8px; }
  .brand-mark { width: 27px; height: 27px; }
  .brand-product { font-size: 12.5px; }
  .brand-section { display: none; }
  .doc h1 { font-size: 21px; }
  .docs-home-header { padding: 20px; }
  .docs-home-header h1 { font-size: 27px; }
  .docs-home-actions { align-items: stretch; }
  .docs-home-actions .btn { text-align: center; }
  .docs-home-jump { width: 100%; margin: 4px 0 0; }
  .demo-stage { aspect-ratio: 4 / 3; }
  .demo-poster { padding: 20px; }
  .demo-poster-copy strong { font-size: 18px; }
  .content { padding: 18px 14px 10px; }
  .footer { padding: 14px; flex-direction: column; }
  .pager { flex-direction: column; }
}
