/* ============================================================================
   Confetti Docs — visual theme matching the jester logo.
   Skews heavier on black + red than the configurator; purple is detail accent.
============================================================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap");

:root {
  /* Surfaces — darker than the configurator (more black, less purple haze) */
  --bg:          #050008;
  --bg-2:        #0A0410;
  --panel:       #110512;
  --panel-2:     #1A0818;
  --panel-3:     #221026;
  --code-bg:     #1A0612;
  --border:      rgba(232, 58, 76, 0.10);
  --border-2:    rgba(232, 58, 76, 0.22);
  --border-strong: rgba(232, 58, 76, 0.45);

  /* Text */
  --text:    #F8F4FA;
  --muted:   rgba(248, 244, 250, 0.62);
  --whisper: rgba(248, 244, 250, 0.32);

  /* Accents — red primary, purple as detail */
  --accent:    #E83A4C;          /* logo crimson, primary */
  --accent-2:  #FF4E6F;          /* magenta highlight */
  --purple:    #7B3AE8;          /* purple detail accent */
  --purple-2:  #9D6BFF;

  /* Glow */
  --glow-red:    rgba(232, 58, 76, 0.45);
  --glow-mag:    rgba(255, 78, 111, 0.50);
  --glow-purple: rgba(123, 58, 232, 0.30);

  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "ss01", "cv11";
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background:
    /* Diamond confetti pattern, very subtle */
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'><g fill='%23E83A4C' fill-opacity='0.05'><path d='M22 32 l4 4 -4 4 -4 -4z'/><path d='M100 22 l3 3 -3 3 -3 -3z'/><path d='M75 85 l5 5 -5 5 -5 -5z'/><path d='M35 110 l3 3 -3 3 -3 -3z'/></g><g fill='%237B3AE8' fill-opacity='0.035'><path d='M115 75 l4 4 -4 4 -4 -4z'/><path d='M50 60 l3 3 -3 3 -3 -3z'/></g></svg>"),
    radial-gradient(circle at 15% 12%, rgba(232, 58, 76, 0.16), transparent 42%),
    radial-gradient(circle at 85% 88%, rgba(123, 58, 232, 0.10), transparent 50%),
    var(--bg);
  background-attachment: fixed;
}

/* ----------------------------------------------------------------------------
   Gate screens (shown before the docs content is unlocked)
   ---------------------------------------------------------------------------- */

.gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 30%, rgba(232, 58, 76, 0.18), transparent 55%),
    radial-gradient(circle at 50% 100%, rgba(123, 58, 232, 0.12), transparent 60%),
    var(--bg);
  z-index: 100;
}
/* CRITICAL: without this, `display: grid` above wins over the browser's
   default `[hidden] { display: none }` rule, and ALL three gate divs render
   stacked on top of each other. The DOM-last one (gate-expired) ends up
   visually on top because they all have the same z-index, so the user sees
   "Link expired" regardless of what JS sets on the other gates. */
.gate[hidden] {
  display: none !important;
}

.gate-card {
  text-align: center;
  max-width: 460px;
  padding: 36px 32px;
  background:
    linear-gradient(180deg, rgba(232, 58, 76, 0.06), transparent 30%),
    var(--panel);
  border: 1px solid var(--border-2);
  border-radius: 22px;
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.55),
    0 0 60px var(--glow-red),
    0 0 0 1px rgba(255, 255, 255, 0.02) inset;
}

.gate-logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  margin: 0 auto 22px;
  display: block;
  box-shadow:
    0 0 40px var(--glow-red),
    0 0 0 1px var(--border-2) inset;
}

.gate-title {
  font-size: 28px;
  font-weight: 900;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #FFE3EA 0%, var(--accent-2) 60%, var(--purple-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.gate-msg {
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.65;
  margin: 0;
}
.gate-msg b { color: var(--text); }
.gate-msg code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--accent-2);
}

/* Pulsing dot during the verifying step — gives a visible "working" cue */
.gate-pulse {
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  margin: 0 auto 16px;
  box-shadow: 0 0 0 0 var(--glow-mag);
  animation: gate-pulse 1.4s ease-out infinite;
}
@keyframes gate-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(255, 78, 111, 0.55); }
  70%  { box-shadow: 0 0 0 18px rgba(255, 78, 111, 0);    }
  100% { box-shadow: 0 0 0 0   rgba(255, 78, 111, 0);     }
}

/* When a gate is showing, the docs app is hidden (set inline by JS too) */
.docs-app[hidden] { display: none !important; }

/* ----------------------------------------------------------------------------
   Mobile top bar
   ---------------------------------------------------------------------------- */

.mobile-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 14px 18px;
  background: rgba(5, 0, 8, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  align-items: center;
  gap: 14px;
}
.menu-toggle {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 9px 11px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--accent-2);
  border-radius: 999px;
}

/* ----------------------------------------------------------------------------
   Brand block
   ---------------------------------------------------------------------------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 0 22px var(--glow-red), 0 0 0 1px var(--border-2) inset;
}
.brand-name {
  display: block;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.01em;
  background: linear-gradient(135deg, #FFE3EA 0%, var(--accent-2) 55%, var(--purple-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.brand-tag {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--whisper);
  margin-top: 2px;
}

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

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background:
    linear-gradient(180deg, rgba(232, 58, 76, 0.05), transparent 30%),
    var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 28px 22px;
  overflow-y: auto;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 999px; }

.brand--sidebar {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.brand--sidebar div { display: flex; flex-direction: column; }

.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.nav-link {
  display: block;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background 160ms ease, color 160ms ease, padding-left 160ms ease;
}
.nav-link:hover {
  color: var(--text);
  background: rgba(232, 58, 76, 0.06);
}
.nav-link.is-active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(232, 58, 76, 0.18), rgba(232, 58, 76, 0.04));
  padding-left: 18px;
  position: relative;
}
.nav-link.is-active::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 6px;
  height: 6px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--glow-red);
}

/* ----------------------------------------------------------------------------
   Main content
   ---------------------------------------------------------------------------- */

.content {
  margin-left: 280px;
  padding: 60px 80px 120px;
  max-width: 920px;
}

.section {
  padding: 56px 0;
  border-bottom: 1px solid var(--border);
}
.section:last-of-type { border-bottom: 0; }
.section--compact { padding: 40px 0; }
.section--hero {
  padding: 80px 0 56px;
  text-align: left;
}

.hero-logo {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  margin-bottom: 28px;
  box-shadow:
    0 0 48px var(--glow-red),
    0 0 0 1px var(--border-2) inset;
}
.section--hero h1 {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 900;
  margin: 0 0 18px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.section--hero .accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-2), var(--purple-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.lede {
  font-size: 18px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 620px;
  margin: 0 0 32px;
}

.hero-pills { display: flex; gap: 12px; flex-wrap: wrap; }
.pill {
  display: inline-flex;
  align-items: center;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 220ms ease;
}
.pill:hover { transform: translateY(-1px); }
.pill--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1A0612;
  box-shadow: 0 14px 32px var(--glow-mag);
}
.pill--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-2);
}
.pill--ghost:hover { border-color: var(--border-strong); background: rgba(232,58,76,0.05); }

.kicker {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 12px;
  padding-left: 16px;
  position: relative;
}
.kicker::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 6px;
  height: 6px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--glow-red);
}

h2 {
  font-size: clamp(28px, 3.5vw, 38px);
  font-weight: 900;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
  line-height: 1.15;
}
h3 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 8px;
}

p { line-height: 1.65; margin: 0 0 14px; }
p.muted { color: var(--muted); margin-bottom: 28px; }
.muted-sm { color: var(--whisper); font-size: 13px; margin-top: 6px; }

code {
  font-family: ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, monospace;
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.88em;
  color: var(--accent-2);
}

/* ----------------------------------------------------------------------------
   Numbered steps
   ---------------------------------------------------------------------------- */

.numbered-steps {
  list-style: none;
  padding: 0;
  margin: 28px 0 0;
  display: grid;
  gap: 14px;
}
.numbered-steps > li {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 18px;
  padding: 20px 22px;
  background:
    linear-gradient(180deg, rgba(232, 58, 76, 0.04), transparent 50%),
    var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  position: relative;
}
.numbered-steps > li::before {
  content: "";
  position: absolute;
  top: 0;
  left: 28px;
  right: 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-2), transparent);
  opacity: 0.4;
}
.step-num {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1A0612;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 16px;
  box-shadow: 0 6px 18px var(--glow-mag);
  flex-shrink: 0;
}
.step-body h3 { margin-bottom: 6px; }
.step-body p { margin: 0; color: var(--text); }
.step-body p + p { margin-top: 6px; }

/* Inline numbered steps inside command cards */
.inline-steps {
  margin: 8px 0;
  padding-left: 22px;
  color: var(--muted);
}
.inline-steps li { padding: 2px 0; }

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

.callout {
  margin-top: 28px;
  padding: 18px 22px;
  border-left: 3px solid var(--accent);
  background:
    linear-gradient(90deg, rgba(232, 58, 76, 0.10), rgba(232, 58, 76, 0.02) 60%),
    var(--panel-2);
  border-radius: 0 12px 12px 0;
  color: var(--text);
  line-height: 1.6;
}
.callout strong {
  color: var(--accent-2);
  display: block;
  margin-bottom: 4px;
  font-weight: 800;
}
.callout--warn {
  border-left-color: var(--purple-2);
  background:
    linear-gradient(90deg, rgba(123, 58, 232, 0.12), rgba(123, 58, 232, 0.02) 60%),
    var(--panel-2);
}
.callout--warn strong { color: var(--purple-2); }
.callout em { color: var(--text); font-style: italic; }

/* ----------------------------------------------------------------------------
   Command grid
   ---------------------------------------------------------------------------- */

.command-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.cmd {
  padding: 22px 24px;
  background:
    linear-gradient(180deg, rgba(232, 58, 76, 0.04), transparent 30%),
    var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  position: relative;
  transition: border-color 220ms ease, transform 160ms ease;
}
.cmd:hover {
  border-color: var(--border-2);
  transform: translateY(-1px);
}
.cmd h3 {
  font-size: 17px;
  margin-bottom: 10px;
}
.cmd h3 code {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--accent-2);
  font-size: 1em;
}
.cmd p { margin-bottom: 8px; color: var(--text); }
.cmd ul {
  margin: 8px 0;
  padding-left: 22px;
  color: var(--muted);
}
.cmd ul li { padding: 2px 0; }
.cmd ul li strong { color: var(--text); }

/* ----------------------------------------------------------------------------
   Configurator section
   ---------------------------------------------------------------------------- */

.cfg-section {
  margin-top: 28px;
  padding: 24px 26px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.cfg-section h3 {
  font-size: 18px;
  color: var(--accent-2);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.cfg-list {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 12px 24px;
}
.cfg-list dt {
  font-weight: 800;
  font-size: 14px;
  color: var(--text);
  padding-top: 2px;
}
.cfg-list dd {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

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

.footer {
  margin-top: 80px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

/* ----------------------------------------------------------------------------
   Mobile / narrow
   ---------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .mobile-bar { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
    width: 84%;
    max-width: 320px;
  }
  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.55);
  }
  .content {
    margin-left: 0;
    padding: 32px 22px 80px;
  }
  .cfg-list { grid-template-columns: 1fr; gap: 4px 0; }
  .cfg-list dt { margin-top: 12px; }
  .cfg-list dd { margin-bottom: 8px; }
  .numbered-steps > li { grid-template-columns: 38px 1fr; padding: 16px 18px; }
  .step-num { width: 30px; height: 30px; font-size: 14px; }
}

/* ----------------------------------------------------------------------------
   Reduced motion
   ---------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
