/* The glass theme for the docs at /docs/ (one folder per release). Each release's docs are
   kscript docs --export-to --stylesheet, which links this after its own stylesheet, so the
   docs keep their layout and search and wear the site's colours and fonts.
   The palette is the site's own, _data/palette.json. */
@font-face { font-family: 'Nunito Sans Variable'; font-style: normal; font-display: swap; font-weight: 200 1000; src: url(/assets/fonts/nunito-sans-latin-wght-normal.woff2) format('woff2-variations'); }
@font-face { font-family: 'JetBrains Mono Variable'; font-style: normal; font-display: swap; font-weight: 100 800; src: url(/assets/fonts/jetbrains-mono-latin-wght-normal.woff2) format('woff2-variations'); }

/* The dark glass; the light block at the end takes over when the device is light. */
:root:root:root {
  --bg: #070E24;
  --bg-soft: rgba(140, 120, 255, 0.08);
  --bg-code: rgba(20, 22, 70, 0.55);
  --fg: #F2F4FF;
  --fg-soft: #B9C2E6;
  --fg-faint: #8592BD;
  --border: rgba(160, 170, 255, 0.14);
  --accent: #30E9C1;
  --accent-soft: rgba(138, 80, 255, 0.22);
  --accent-fg: #070E24;
  --ok: #30E9C1;
  --err: #FF6F59;
  --err-bg: rgba(255, 111, 89, 0.1);
  --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.8);
  --hl-tag: #8DB2FF;
  --hl-attr: #C6A6FF;
  --hl-str: #4FEBC8;
  --hl-var: #8DB2FF;
  --hl-cmd: #5FD4FF;
  --hl-num: #FF8D7A;
  --hl-kw: #C6A6FF;
  --hl-com: #7F93BC;
  --hl-type: #FFC27A;
  --hl-re: #5FD4FF;
  --radius: 14px;
  --sans: 'Nunito Sans Variable', 'Nunito Sans', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: dark;
}
.theme-toggle { display: none; }

body {
  background:
    radial-gradient(60vw 50vh at 85% -10%, rgba(138, 80, 255, 0.22), transparent 70%),
    radial-gradient(50vw 40vh at -10% 20%, rgba(36, 92, 250, 0.16), transparent 70%),
    linear-gradient(180deg, #0A1230, #070E24 60%) fixed;
  -webkit-font-smoothing: antialiased;
}
code, kbd, pre, textarea.code-input { font-variant-ligatures: none; }
::selection { background: #8A50FF; color: #fff; }

.top {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02)), color-mix(in srgb, #070E24 75%, transparent);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  backdrop-filter: blur(22px) saturate(160%);
  border-bottom-color: rgba(178, 158, 255, 0.16);
}
.brand { font-weight: 900; letter-spacing: -0.02em; }
.brand img { border-radius: 7px; }
.version { border-color: rgba(178, 158, 255, 0.3); color: #B9C2E6; }
.version-pick select option { background: #070E24; }
.search input { border-radius: 12px; }
.results { background: color-mix(in srgb, #070E24 94%, #8A50FF); border-color: rgba(178, 158, 255, 0.22); }
.fmt-switch button[aria-pressed="true"], .fmt-switch button[aria-selected="true"] { color: #F2F4FF; }

.sidebar { border-right-color: rgba(160, 170, 255, 0.1); }
.nav-section a { border-radius: 10px; }
.nav-section a[aria-current="page"] {
  color: #F2F4FF;
  background: linear-gradient(90deg, rgba(138, 80, 255, 0.28), rgba(138, 80, 255, 0.06));
  box-shadow: inset 0 0 0 1px rgba(180, 140, 255, 0.18);
}
.toc li a.active { color: #F2F4FF; border-left-color: #B48CFF; }

.doc h1, .doc h2, .doc h3 { font-weight: 900; letter-spacing: -0.02em; }
.doc a:not(.card):not(.button) { text-decoration: underline; text-decoration-color: rgba(48, 233, 193, 0.4); text-underline-offset: 3px; }
.doc :not(pre) > code { background: rgba(160, 140, 255, 0.12); color: #E3D8FF; border-radius: 6px; }
.code, .try {
  background: linear-gradient(165deg, rgba(60, 50, 170, 0.22), rgba(10, 16, 48, 0.7));
  border-color: rgba(178, 158, 255, 0.22);
  border-radius: 16px;
}
.card {
  background: rgba(120, 110, 255, 0.07);
  border-color: rgba(160, 170, 255, 0.14);
  border-radius: 18px;
}
.card:hover { background: rgba(140, 120, 255, 0.12); border-color: rgba(178, 158, 255, 0.36); }
.button { border-radius: 999px; }
.button.primary { color: #0A0626; border: 0; background: linear-gradient(135deg, #D9C8FF, #B48CFF 40%, #7C8CFF); }

/* The language menu the translation step adds to each page's header
   (kscript docs --translate), drawn as the site's own. */
.lang-menu { position: relative; flex: none; }
.lang-menu summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 8px; border-radius: 12px; cursor: pointer; color: #B9C2E6; font-weight: 800; font-size: 14px; letter-spacing: 0.02em; user-select: none; }
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover, .lang-menu[open] summary { color: #F2F4FF; background: rgba(180, 140, 255, 0.12); }
.lang-menu summary:focus-visible { outline: 2px solid #B48CFF; outline-offset: 2px; }
.lang-menu svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.lang-globe { width: 19px; height: 19px; stroke-width: 1.6; }
.lang-chevron { width: 15px; height: 15px; stroke-width: 2.2; transition: transform 0.15s ease; }
.lang-menu[open] .lang-chevron { transform: rotate(180deg); }
.lang-panel { position: absolute; right: 0; top: calc(100% + 10px); z-index: 60; width: max-content; min-width: 220px; padding: 10px; border-radius: 18px; background: color-mix(in srgb, #070E24 94%, #8A50FF); box-shadow: inset 0 0 0 1px rgba(178, 158, 255, 0.22), 0 24px 48px -16px rgba(0, 0, 0, 0.7); }
.lang-panel ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.lang-panel a { display: block; padding: 8px 12px; border-radius: 10px; text-decoration: none; color: #B9C2E6; font-weight: 700; font-size: 15px; }
.lang-panel a:hover, .lang-panel a:focus-visible { background: rgba(180, 140, 255, 0.14); color: #F2F4FF; }
.lang-panel a[aria-current='true'] { color: #F2F4FF; background: rgba(180, 140, 255, 0.2); }
.lang-head { margin: 2px 12px 8px; font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: #8592BD; }
.lang-note { margin: 8px 12px 2px; font-size: 13px; color: #8592BD; max-width: 220px; }
@media (max-width: 720px) { .lang-code { display: none; } .lang-panel { right: -8px; } }

/* Light mode: when the device is light the docs are too, with frosted white glass and
   the light code colours from KScript's own docs. It switches live with the device. */
@media (prefers-color-scheme: light) {
  :root:root:root {
    --bg: #F1F3FC;
    --bg-soft: rgba(110, 90, 230, 0.06);
    --bg-code: rgba(255, 255, 255, 0.75);
    --fg: #10143A;
    --fg-soft: #3E4672;
    --fg-faint: #5F6896;
    --border: rgba(40, 40, 110, 0.12);
    --accent: #6A35E8;
    --accent-soft: rgba(110, 80, 230, 0.12);
    --accent-fg: #fff;
    --ok: #0C8F73;
    --err: #C62828;
    --err-bg: #FFF1F0;
    --shadow: 0 24px 50px -24px rgba(40, 30, 120, 0.35);
    --hl-tag: #2557B8;
    --hl-attr: #8250DF;
    --hl-str: #0F7B4F;
    --hl-var: #B35900;
    --hl-cmd: #C2185B;
    --hl-num: #0A6C8F;
    --hl-kw: #8250DF;
    --hl-com: #6E7591;
    --hl-type: #0B7A75;
    --hl-re: #A3460C;
    color-scheme: light;
  }
  body {
    background:
      radial-gradient(60vw 50vh at 85% -10%, rgba(138, 80, 255, 0.14), transparent 70%),
      radial-gradient(50vw 40vh at -10% 20%, rgba(36, 92, 250, 0.1), transparent 70%),
      linear-gradient(180deg, #E9E8FB, #F1F3FC 60%) fixed;
  }
  .top { background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.62)); border-bottom-color: rgba(60, 50, 150, 0.12); }
  .version { border-color: rgba(110, 80, 230, 0.3); color: #3E4672; }
  .version-pick select option { background: #fff; }
  .results, .lang-panel { background: #fff; border-color: rgba(60, 50, 150, 0.14); box-shadow: inset 0 0 0 1px rgba(60, 50, 150, 0.14), 0 24px 48px -16px rgba(40, 30, 120, 0.3); }
  .fmt-switch button[aria-pressed="true"], .fmt-switch button[aria-selected="true"],
  .toc li a.active, .lang-menu summary:hover, .lang-menu[open] summary, .lang-panel a:hover, .lang-panel a:focus-visible, .lang-panel a[aria-current='true'] { color: #10143A; }
  .sidebar { border-right-color: rgba(60, 50, 150, 0.1); }
  .nav-section a[aria-current="page"] { color: #10143A; background: linear-gradient(90deg, rgba(138, 80, 255, 0.16), rgba(138, 80, 255, 0.03)); box-shadow: inset 0 0 0 1px rgba(110, 80, 230, 0.18); }
  .toc li a.active { border-left-color: #6A35E8; }
  .doc a:not(.card):not(.button) { text-decoration-color: rgba(106, 53, 232, 0.4); }
  .doc :not(pre) > code { background: rgba(110, 90, 230, 0.09); color: #4B1FB8; }
  .code, .try { background: linear-gradient(165deg, rgba(255, 255, 255, 0.92), rgba(244, 242, 255, 0.8)); border-color: rgba(60, 50, 150, 0.14); }
  .card { background: rgba(255, 255, 255, 0.7); border-color: rgba(60, 50, 150, 0.12); }
  .card:hover { background: #fff; border-color: rgba(110, 80, 230, 0.36); }
  .lang-menu summary, .lang-panel a { color: #3E4672; }
  .lang-head, .lang-note { color: #5F6896; }
  .lang-menu summary:hover, .lang-menu[open] summary, .lang-panel a:hover, .lang-panel a:focus-visible, .lang-panel a[aria-current='true'] { background: rgba(110, 80, 230, 0.1); }
}
