/* ========================================================================================================
   EnlaceVRC — Documentation styles (cyanotype theme)
   ========================================================================================================
   Mirrors the bot's own icon art: a deep ultramarine "blueprint / cyanotype" background with a subtle
   paper grain, bone-white text and glowing white accents, plus sparse red marks used only as a highlight
   (never for body text). Wiki layout: fixed sidebar + centered content. No build step, no framework.
   ======================================================================================================== */

/* --------------------------------------------------------------------------------------------------------
   Design tokens
   -------------------------------------------------------------------------------------------------------- */

:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", "Cascadia Code", Menlo, Consolas, monospace;

  /* Cyanotype blues — deep base, lighter surfaces. */
  --blue-950: #081634;
  --blue-900: #0c1f47;
  --blue-850: #102554;
  --blue-800: #163063;
  --blue-700: #1d3d7a;
  --blue-600: #2a4f96;

  --color-bg: var(--blue-900);
  --color-bg-subtle: rgba(255, 255, 255, 0.04);
  --color-bg-code: rgba(255, 255, 255, 0.06);
  --color-surface: rgba(255, 255, 255, 0.035);
  --color-border: rgba(178, 205, 255, 0.16);
  --color-border-strong: rgba(178, 205, 255, 0.32);

  /* Bone-white text, like the exposed cyanotype highlights. */
  --color-text: #eef3ff;
  --color-text-muted: #b9c8ec;
  --color-text-faint: #7e90bd;

  /* Glowing white / pale-cyan accent. */
  --color-accent: #ffffff;
  --color-accent-text: #cfe0ff;
  --color-accent-soft: rgba(160, 196, 255, 0.14);
  --glow: 0 0 18px rgba(180, 210, 255, 0.45);

  /* Sparse red, used as the cyanotype annotation mark only. */
  --color-red: #ff5c5c;

  --radius-sm: 6px;
  --radius-md: 12px;

  --sidebar-w: 264px;
  --content-max: 760px;
}

/* --------------------------------------------------------------------------------------------------------
   Reset & base
   -------------------------------------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--color-text);
  background-color: var(--blue-900);
  /* Vignette gradient + faint grain overlay to read like cyanotype paper. */
  background-image:
    radial-gradient(1200px 600px at 80% -5%, rgba(75, 120, 210, 0.35), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(40, 80, 170, 0.3), transparent 55%),
    linear-gradient(180deg, var(--blue-850), var(--blue-950));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Animated grain canvas (drawn by effects.js) sits above the page, very faint. */
#grain {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: screen;
}

/* Static grain layer over the whole page (very subtle). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
}

/* Scrollbars tuned to the cyanotype palette (Firefox + WebKit/Chromium). */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(178, 205, 255, 0.28) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(178, 205, 255, 0.22);
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(200, 222, 255, 0.4);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

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

a:hover {
  color: #fff;
  text-decoration: underline;
}

code,
kbd {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

:not(pre) > code {
  background: var(--color-bg-code);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.38em;
  color: #e7eeff;
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid #9cc0ff;
  outline-offset: 2px;
  border-radius: 3px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: #fff;
  color: var(--blue-900);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  z-index: 100;
  font-weight: 600;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
}

/* --------------------------------------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 64px;
  padding: 0 24px;
  background: rgba(9, 24, 56, 0.72);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--color-border);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.topbar__brand:hover {
  text-decoration: none;
  color: #fff;
}

.topbar__mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #fff;
  color: var(--blue-900);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  box-shadow: var(--glow);
}

.topbar__tag {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-faint);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 2px 9px;
}

.topbar__spacer {
  flex: 1;
}

.topbar__links {
  display: flex;
  gap: 4px;
}

.topbar__link {
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
}

.topbar__link:hover {
  background: var(--color-bg-subtle);
  color: #fff;
  text-decoration: none;
}

/* Visually-hidden label, still read by assistive tech. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Top-bar controls: effects toggle + language picker. */
.topbar__controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fx-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--color-text-muted);
  cursor: pointer;
  user-select: none;
}

.fx-toggle input {
  width: 15px;
  height: 15px;
  accent-color: #cfe0ff;
  cursor: pointer;
}

.lang-select select {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--color-text);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  cursor: pointer;
}

.lang-select select:hover {
  border-color: var(--color-border-strong);
}

.lang-select option {
  /* Native dropdown list renders on the OS surface, so use a dark background for readability. */
  background: var(--blue-850);
  color: var(--color-text);
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-subtle);
  color: var(--color-text);
  cursor: pointer;
}

/* --------------------------------------------------------------------------------------------------------
   Layout shell
   -------------------------------------------------------------------------------------------------------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  align-items: start;
  max-width: 1240px;
  margin: 0 auto;
}

/* The mobile drawer scrim must not take a grid track on desktop (it would push the
   content into a third, implicit column and overlap the sidebar). Hidden until mobile. */
.scrim {
  display: none;
}

/* --------------------------------------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------------------------------------- */

.sidebar {
  position: sticky;
  top: 64px;
  align-self: start;
  height: calc(100vh - 64px);
  overflow-y: auto;
  padding: 28px 20px 48px;
  border-right: 1px solid var(--color-border);
}

/* Quick search box at the top of the sidebar (wiki style). */
.sidebar__search {
  position: relative;
  margin-bottom: 22px;
}

.sidebar__search input {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--color-text);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px 8px 32px;
}

.sidebar__search input::placeholder {
  color: var(--color-text-faint);
}

.sidebar__search input:focus {
  border-color: var(--color-border-strong);
  background: rgba(255, 255, 255, 0.06);
}

.sidebar__search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-faint);
  pointer-events: none;
}

.sidebar__group + .sidebar__group {
  margin-top: 26px;
}

/* Hides nav items filtered out by the quick-search. */
.sidebar__link[hidden],
.sidebar__group[hidden] {
  display: none;
}

.sidebar__empty {
  padding: 8px 10px;
  font-size: 13px;
  color: var(--color-text-faint);
}

.sidebar__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  margin: 0 0 8px;
  padding: 0 10px;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--color-text-muted);
  border-left: 2px solid transparent;
}

.sidebar__link:hover {
  background: var(--color-bg-subtle);
  color: #fff;
  text-decoration: none;
}

.sidebar__link svg {
  flex-shrink: 0;
  color: var(--color-text-faint);
}

.sidebar__link.is-active svg {
  color: #fff;
}

.sidebar__label {
  flex: 1;
  min-width: 0;
}

.sidebar__link code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  white-space: nowrap;
}

.sidebar__link.is-active {
  color: #fff;
  background: var(--color-accent-soft);
  border-left-color: #fff;
  font-weight: 550;
}

/* --------------------------------------------------------------------------------------------------------
   Content column
   -------------------------------------------------------------------------------------------------------- */

.content {
  min-width: 0;
  padding: 0 40px 120px;
}

.prose {
  max-width: var(--content-max);
  margin: 0 auto;
}

section[id] {
  scroll-margin-top: 84px;
  padding-top: 8px;
}

.section + .section {
  margin-top: 64px;
  padding-top: 56px;
  border-top: 1px solid var(--color-border);
}

h1,
h2,
h3,
h4 {
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: #fff;
  scroll-margin-top: 84px;
}

h2 {
  font-size: 28px;
  margin: 0 0 6px;
}

h3 {
  font-size: 19px;
  margin: 34px 0 8px;
}

h4 {
  font-size: 15px;
  margin: 22px 0 6px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

p {
  margin: 0 0 16px;
}

/* Emphasis that actually reads on the deep-blue background. Bold goes bright white with a
   touch more weight; <em> is not flat italic (it vanishes here) but a pale-cyan label-style
   highlight, which is also how UI labels/buttons are referenced in the copy. */
.prose strong {
  color: #fff;
  font-weight: 650;
}

.prose em {
  font-style: normal;
  color: var(--color-accent-text);
  font-weight: 550;
}

.lead {
  font-size: 18px;
  color: var(--color-text-muted);
  margin-bottom: 24px;
}

/* Section eyebrow — the one place the cyanotype red appears in text. */
.section__eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-red);
  margin: 0 0 10px;
}

/* The lightbox wraps icons in an <a>; keep it from disrupting flex alignment. */
a.glightbox {
  display: inline-flex;
  line-height: 0;
  cursor: zoom-in;
}

/* Heading paired with a real bot icon. */
.h-icon {
  display: flex;
  align-items: center;
  gap: 14px;
}

.h-icon img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--color-border), var(--glow);
}

ul,
ol {
  margin: 0 0 16px;
  padding-left: 22px;
}

li {
  margin: 4px 0;
}

li::marker {
  color: var(--color-text-faint);
}

/* --------------------------------------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------------------------------------- */

.hero {
  padding: 56px 0 12px;
}

.hero__top {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 6px;
}

.hero__icon {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--color-border-strong), 0 0 36px rgba(180, 210, 255, 0.5);
}

.hero h1 {
  font-size: clamp(34px, 5vw, 50px);
  margin: 8px 0 16px;
  text-shadow: 0 0 30px rgba(180, 210, 255, 0.35);
}

.hero__sub {
  font-size: 19px;
  color: var(--color-text-muted);
  max-width: 620px;
  margin-bottom: 28px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--color-border-strong);
  color: var(--color-text-muted);
  background: var(--color-bg-subtle);
}

.badge--red {
  border-color: rgba(255, 92, 92, 0.5);
  color: #ff9090;
}

/* --------------------------------------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.btn:hover {
  text-decoration: none;
}

.btn--primary,
.btn--primary:hover {
  background: #fff;
  color: var(--blue-900);
  box-shadow: var(--glow);
}

.btn--primary:hover {
  background: #eaf1ff;
  box-shadow: 0 0 26px rgba(180, 210, 255, 0.7);
}

.btn--ghost,
.btn--ghost:hover {
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.btn--ghost {
  background: var(--color-bg-subtle);
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* --------------------------------------------------------------------------------------------------------
   Steps (verification flow)
   -------------------------------------------------------------------------------------------------------- */

.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 24px 0 0;
}

.steps > li {
  position: relative;
  counter-increment: step;
  padding: 0 0 22px 52px;
  margin: 0;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-900);
  border: 1px solid var(--color-border-strong);
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  box-shadow: var(--glow);
}

.steps > li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 34px;
  bottom: 6px;
  width: 2px;
  background: var(--color-border);
}

/* Only the step's leading title is a block; inline <strong> inside the body keeps flowing. */
.steps > li > strong:first-child {
  display: block;
  font-size: 16px;
  margin-bottom: 2px;
  color: #fff;
}

.steps p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 15px;
}

/* --------------------------------------------------------------------------------------------------------
   Command reference
   -------------------------------------------------------------------------------------------------------- */

.cmd {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 18px 0;
  background: var(--color-surface);
}

.cmd__head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 14px 18px;
  background: var(--color-bg-subtle);
  border-bottom: 1px solid var(--color-border);
}

.cmd__name {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}

.cmd__perm {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  border: 1px solid var(--color-border-strong);
  border-radius: 999px;
  padding: 2px 9px;
}

.cmd__perm--admin {
  color: #ffd9a8;
  border-color: rgba(255, 190, 120, 0.45);
}

.cmd__perm--staff {
  color: #e3c9ff;
  border-color: rgba(200, 160, 255, 0.45);
}

.cmd__body {
  padding: 16px 18px;
}

.cmd__body > p:last-child {
  margin-bottom: 0;
}

.cmd__opts {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.cmd__opts li {
  display: grid;
  grid-template-columns: minmax(120px, max-content) 1fr;
  gap: 14px;
  font-size: 14px;
  padding: 6px 0;
  border-top: 1px dashed var(--color-border);
}

.cmd__opts li:first-child {
  border-top: none;
}

.cmd__opts code {
  color: #e7eeff;
}

.cmd__opts span {
  color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------------------------------------
   Callout
   -------------------------------------------------------------------------------------------------------- */

.note {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-bg-subtle);
  margin: 20px 0;
  font-size: 15px;
}

.note img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--color-border), 0 0 12px rgba(180, 210, 255, 0.4);
}

.note p {
  margin: 0;
}

.note--accent {
  border-color: var(--color-border-strong);
  background: var(--color-accent-soft);
}

/* --------------------------------------------------------------------------------------------------------
   Feature grid (overview)
   -------------------------------------------------------------------------------------------------------- */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 24px 0;
}

.feature {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  background: var(--color-surface);
}

.feature h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.feature p {
  margin: 0;
  font-size: 14.5px;
  color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------------------------------------
   Table
   -------------------------------------------------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin: 18px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

th,
td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

th {
  font-weight: 600;
  background: var(--color-bg-subtle);
  color: var(--color-text-muted);
  font-size: 13px;
}

tr:last-child td {
  border-bottom: none;
}

td code {
  white-space: nowrap;
}

/* --------------------------------------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--color-border);
  margin-top: 40px;
}

.footer__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 32px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  color: var(--color-text-faint);
  font-size: 14px;
}

.footer a {
  color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------------------------------------- */

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .topbar__links {
    display: none;
  }

  /* Reclaim space on small screens: drop the tag and the effects label text. */
  .topbar__tag {
    display: none;
  }

  .topbar {
    gap: 10px;
    padding: 0 14px;
  }

  .fx-toggle span {
    display: none;
  }

  .sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    bottom: 0;
    width: 280px;
    background: var(--blue-850);
    z-index: 35;
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    box-shadow: 2px 0 22px rgba(0, 0, 0, 0.45);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .content {
    padding: 0 20px 90px;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .hero__top {
    gap: 16px;
  }

  .hero__icon {
    width: 68px;
    height: 68px;
  }

  .scrim {
    display: block;
    position: fixed;
    inset: 64px 0 0 0;
    background: rgba(4, 12, 30, 0.55);
    z-index: 30;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
  }

  .scrim.is-open {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .scrim {
    transition: none;
  }
}
