/* =========================================================
   KUBORA docs — page-specific styles.

   Layers on top of style.css. Everything here is scoped under
   `.docs-page` on <body> so shared components (nav, aurora,
   footer) stay identical. Docs are text-heavy; the visual job
   of this sheet is:
     1. Two-column shell with sticky sidebar
     2. Readable long-form typography
     3. Code block styling (re-used from landing's editor)
     4. Tables, callouts, keyword chips

   Nothing reaches across to modify landing-only styles; swap
   this file out and the index page is unchanged.
   ========================================================= */

/* -------------------  Brand suffix in nav  ------------------- */

.brand-sub {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--accent);
  margin-left: 6px;
  opacity: 0.85;
}
.nav-links a[aria-current="page"] {
  color: var(--text);
}
.nav-links a[aria-current="page"]::after {
  transform: scaleX(1);
}

/* -------------------  Shell  ------------------- */

.docs-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 32px 60px;
  gap: 40px;
  position: relative;
  z-index: 2;
}

/* -------------------  Sidebar  -------------------
   Sticky, independent scroll. On mobile it collapses to a
   horizontal scrolling strip at the top so docs still fit. */

.docs-side {
  position: sticky;
  top: 92px;
  align-self: start;
  height: calc(100vh - 112px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(179, 110, 255, 0.4) transparent;
  padding-right: 8px;
}
.docs-side::-webkit-scrollbar { width: 6px; }
.docs-side::-webkit-scrollbar-thumb {
  background: rgba(179, 110, 255, 0.35);
  border-radius: 3px;
}

.docs-side-inner {
  padding: 20px 18px 28px;
  border: 1px solid var(--glass-stroke);
  border-radius: 10px;
  background: rgba(10, 11, 20, 0.55);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.docs-side-head { margin-bottom: 18px; }
.docs-side-title {
  font-size: 18px;
  font-weight: 700;
  margin: 10px 0 0;
  letter-spacing: -0.01em;
}
.eyebrow.small { font-size: 10px; padding: 4px 10px; margin-bottom: 10px; }

.docs-nav { display: flex; flex-direction: column; gap: 18px; }
.docs-nav-group { display: flex; flex-direction: column; gap: 4px; }
.docs-nav-head {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.docs-nav a {
  display: block;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13.5px;
  color: var(--text-dim);
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
  border-left: 2px solid transparent;
}
.docs-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-left-color: var(--accent);
  transform: translateX(2px);
}
.docs-nav a code {
  background: transparent;
  padding: 0;
  font-size: 0.92em;
  color: inherit;
}

/* -------------------  Main content  ------------------- */

.docs-main {
  min-width: 0; /* prevents grid blowout when long code lines appear */
  max-width: 860px;
}

/* Hero card — short intro to the page. Subtle gradient panel so
   it feels like the docs have a proper cover, not a bare h1. */
.docs-hero {
  padding: 40px 32px;
  border-radius: 12px;
  background: linear-gradient(135deg,
    rgba(179, 110, 255, 0.12),
    rgba(76, 141, 255, 0.06) 50%,
    rgba(255, 110, 209, 0.08));
  border: 1px solid var(--glass-stroke-strong);
  margin-bottom: 48px;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.docs-hero .eyebrow { margin-bottom: 18px; }
.docs-hero h1 {
  font-size: clamp(32px, 4.5vw, 54px);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0 0 16px;
}
.docs-hero-lede {
  color: var(--text-dim);
  font-size: 16px;
  max-width: 640px;
  margin: 0 0 28px;
}
.docs-hero-stats {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  padding-top: 20px;
  border-top: 1px solid var(--glass-stroke);
}
.docs-hero-stats > div {
  display: flex;
  flex-direction: column;
}
.stat-num-s {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, #fff, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.docs-hero-stats span:not(.stat-num-s) {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  text-transform: uppercase;
}

/* Sections. Give each one enough vertical room to read as its
   own chapter; scroll anchors land under the sticky nav. */
.docs-sec {
  margin-bottom: 48px;
  scroll-margin-top: 96px;
}
.docs-sec h2 {
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  padding-bottom: 8px;
}
.docs-sec h2::after {
  right: 70%;
  bottom: 0;
  height: 2px;
}
.docs-sec h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 32px 0 12px;
  letter-spacing: -0.01em;
}
.docs-sec p {
  color: var(--text-dim);
  margin: 0 0 14px;
  line-height: 1.72;
  font-size: 15.5px;
}
.docs-sec p a,
.docs-sec li a,
.callout a {
  color: var(--accent);
  border-bottom: 1px dotted rgba(179, 110, 255, 0.45);
  transition: color 0.18s ease, border-color 0.18s ease;
}
.docs-sec p a:hover,
.docs-sec li a:hover,
.callout a:hover {
  color: #d9b6ff;
  border-bottom-color: #d9b6ff;
}
.docs-sec ol,
.docs-sec ul:not(.kv-list):not(.kw-grid) {
  color: var(--text-dim);
  padding-left: 22px;
  line-height: 1.75;
}
.docs-sec ol li,
.docs-sec ul:not(.kv-list):not(.kw-grid) li {
  margin-bottom: 6px;
  font-size: 15px;
}
.docs-sec strong { color: var(--text); }

/* kbd styling so shortcuts read as real keys. */
kbd {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-stroke-strong);
  border-bottom-width: 2px;
  color: #d7d9ff;
  line-height: 1;
  display: inline-block;
  margin: 0 1px;
}

/* -------------------  Callout  ------------------- */

.callout {
  margin: 24px 0;
  padding: 16px 20px;
  border-radius: 8px;
  border: 1px solid rgba(179, 110, 255, 0.35);
  background:
    linear-gradient(180deg, rgba(179, 110, 255, 0.10), rgba(179, 110, 255, 0.02));
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.65;
  position: relative;
  padding-left: 42px;
}
.callout::before {
  content: "◆";
  position: absolute;
  left: 18px;
  top: 16px;
  color: var(--accent);
  font-size: 12px;
}

/* -------------------  Code blocks  -------------------
   Re-uses the token classes from the landing editor so one
   palette covers the whole site. */

pre.kcode {
  margin: 16px 0 22px;
  padding: 18px 20px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(15, 18, 32, 0.95), rgba(10, 11, 20, 0.95));
  border: 1px solid var(--glass-stroke-strong);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.65;
  color: #d7d9ff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
pre.kcode code { display: block; }
pre.kcode .k  { color: #b36eff; font-weight: 600; }
pre.kcode .f  { color: #4c8dff; }
pre.kcode .e  { color: #ff6ed1; }
pre.kcode .s  { color: #4dd27a; }
pre.kcode .n  { color: #ffd580; }
pre.kcode .c  { color: #606789; font-style: italic; }
pre.kcode .pp { color: #e8bfff; }
pre.kcode .kb { color: #ffa8d7; font-weight: 600; }  /* JSON bools / nil */

/* Inline code inside docs already styled by landing CSS. */

/* -------------------  Tables  ------------------- */

.kv-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 18px 0 26px;
  font-size: 14px;
  border: 1px solid var(--glass-stroke);
  border-radius: 8px;
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.kv-table th,
.kv-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--glass-stroke);
}
.kv-table thead th {
  background: rgba(179, 110, 255, 0.08);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
}
.kv-table tbody tr:last-child td { border-bottom: none; }
.kv-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}
.kv-table td { color: var(--text-dim); }
.kv-table td code { font-size: 0.85em; }

/* -------------------  Key/value list (bulleted property list) ------------------- */

.kv-list {
  list-style: none;
  padding: 0;
  margin: 14px 0 22px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
}
.kv-list li {
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--glass);
  border: 1px solid var(--glass-stroke);
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.5;
}
.kv-list li strong {
  color: var(--accent);
  font-weight: 600;
  font-family: var(--mono);
  font-size: 0.92em;
}
.kv-list li code {
  font-size: 0.86em;
}

/* -------------------  Panel grid (Studio tour) ------------------- */

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin: 20px 0 28px;
}
.panel-card {
  padding: 18px 18px;
  border-radius: 8px;
  background: var(--glass);
  border: 1px solid var(--glass-stroke);
  transition: border-color 0.22s ease, background 0.22s ease;
}
.panel-card:hover {
  border-color: rgba(179, 110, 255, 0.4);
  background: var(--glass-strong);
}
.panel-card-head {
  display: block;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
  color: var(--text);
}
.panel-card p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.55;
}

/* -------------------  Keyword chip grid  ------------------- */

.kw-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 20px;
  padding: 0;
  list-style: none;
}
.kw {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  background: rgba(179, 110, 255, 0.10);
  border: 1px solid rgba(179, 110, 255, 0.3);
  padding: 5px 11px;
  border-radius: 4px;
  letter-spacing: 0.02em;
  transition: background 0.18s ease, transform 0.18s ease;
}
.kw:hover {
  background: rgba(179, 110, 255, 0.22);
  transform: translateY(-1px);
}


/* ==============  JSON Game section  ==============
   Distinct visual language so the reader understands this is a
   flagship feature, not a footnote. Uses accent-purple + a hint of
   cyan/magenta callouts for the two Studio buttons. */

.lead {
  font-size: 17px;
  line-height: 1.62;
  color: var(--text);
  margin: 12px 0 22px;
}

.badge-new {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 2px 6px 3px;
  margin-right: 8px;
  border-radius: 3px;
  background: linear-gradient(135deg, rgba(76, 141, 255, 0.40), rgba(255, 110, 209, 0.40));
  color: #fff;
  border: 1px solid rgba(255, 110, 209, 0.55);
  vertical-align: middle;
}

/* Variant of the default callout tinted more toward the landing's
   accent so "why this matters" callouts pop. */
.callout.accent {
  border: 1px solid rgba(179, 110, 255, 0.55);
  background:
    linear-gradient(180deg, rgba(179, 110, 255, 0.18), rgba(76, 141, 255, 0.06));
}

/* ---- API table ---- */

.api-table {
  display: grid;
  grid-template-columns: 18% 18% 14% 1fr;
  gap: 0;
  margin: 14px 0 22px;
  border: 1px solid var(--glass-stroke);
  border-radius: 8px;
  overflow: hidden;
  font-size: 13.5px;
}
.api-row {
  display: contents;
}
.api-row > span {
  padding: 10px 14px;
  border-bottom: 1px solid var(--glass-stroke);
  background: rgba(15, 18, 32, 0.4);
  color: var(--text);
}
.api-row.api-head > span {
  background: rgba(179, 110, 255, 0.14);
  color: #fff;
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.api-row:last-child > span {
  border-bottom: none;
}
.api-row > span code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: rgba(179, 110, 255, 0.10);
  color: #e8bfff;
  padding: 2px 5px;
  border-radius: 3px;
}

/* ---- Feature cards (JSON dropdown menu items in Studio) ---- */

.feat-grid {
  display: grid;
  /* Auto-fit as many 220px columns as the row will take. With 3 cards we
     get 3-across on desktop; with 4 cards (Import / Append / Export /
     Copy AI Prompt) we still get 4 across on desktop and collapse
     gracefully through 2 → 1 at narrower widths (see media queries). */
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 14px 0 22px;
}
.feat-card {
  padding: 18px 20px;
  border-radius: 10px;
  border: 1px solid var(--glass-stroke);
  background: linear-gradient(180deg, rgba(15, 18, 32, 0.55), rgba(10, 11, 20, 0.55));
}
.feat-card h4 {
  margin: 0 0 8px;
  font-size: 15.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}
.feat-card p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: rgba(220, 222, 240, 0.85);
}
.feat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 6px;
  background: rgba(64, 220, 255, 0.15);
  color: #6fe0ff;
  border: 1px solid rgba(64, 220, 255, 0.45);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
}
.feat-icon.magenta {
  background: rgba(255, 110, 209, 0.14);
  color: #ff9ad7;
  border-color: rgba(255, 110, 209, 0.55);
}
.feat-icon.lime {
  background: rgba(150, 255, 140, 0.14);
  color: #b7ff9a;
  border-color: rgba(150, 255, 140, 0.55);
}

/* ---- Prompt box — the copy-me block the reader can paste to an LLM ---- */

.prompt-box {
  margin: 18px 0 18px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(76, 141, 255, 0.45);
  background: linear-gradient(180deg, rgba(15, 18, 32, 0.95), rgba(10, 11, 20, 0.95));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.prompt-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(76, 141, 255, 0.12);
  border-bottom: 1px solid rgba(76, 141, 255, 0.35);
}
.prompt-label {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: #d6e4ff;
  text-transform: uppercase;
}
.prompt-copy {
  appearance: none;
  border: 1px solid rgba(76, 141, 255, 0.55);
  background: rgba(76, 141, 255, 0.18);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  font-family: var(--sans);
}
.prompt-copy:hover {
  background: rgba(76, 141, 255, 0.32);
  transform: translateY(-1px);
}
.prompt-copy.ok {
  background: rgba(80, 210, 110, 0.25);
  border-color: rgba(80, 210, 110, 0.55);
}
.prompt-body {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.62;
  color: #cfd3ee;
  white-space: pre;
  max-height: 520px;
  overflow-y: auto;
}
.prompt-body code {
  font-family: var(--mono);
  color: inherit;
  background: transparent;
  padding: 0;
}

@media (max-width: 980px) {
  .feat-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .feat-grid { grid-template-columns: 1fr; }
  .api-table { grid-template-columns: 30% 24% 1fr; }
  .api-row > span:nth-child(3) { display: none; }  /* hide Default col on narrow */
  .api-row.api-head > span:nth-child(3) { display: none; }
}

/* -------------------  End card  ------------------- */

.docs-end {
  margin: 72px 0 12px;
  padding: 48px 32px;
  border-radius: 12px;
  text-align: center;
  background:
    radial-gradient(600px circle at 50% 0%, rgba(179, 110, 255, 0.18), transparent 60%),
    linear-gradient(135deg, rgba(76, 141, 255, 0.08), rgba(255, 110, 209, 0.08));
  border: 1px solid rgba(179, 110, 255, 0.35);
  box-shadow: 0 20px 60px rgba(179, 110, 255, 0.2);
}
.docs-end h2 {
  font-size: clamp(26px, 3.5vw, 40px);
  margin: 0 0 10px;
}
.docs-end h2::after { display: none; }
.docs-end p {
  color: var(--text-dim);
  font-size: 16px;
  margin: 0 0 24px;
}

/* -------------------  Responsive  ------------------- */

@media (max-width: 960px) {
  .docs-shell {
    grid-template-columns: 1fr;
    padding: 20px 20px 40px;
    gap: 20px;
  }
  .docs-side {
    position: static;
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .docs-side-inner { padding: 16px 18px; }
  .docs-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
  }
  .docs-hero { padding: 28px 22px; }
  .docs-main { max-width: none; }
}

@media (max-width: 560px) {
  pre.kcode { font-size: 12.5px; padding: 14px 16px; }
  .docs-sec h2 { font-size: 24px; }
  .docs-sec h3 { font-size: 17px; }
  .kv-table { font-size: 13px; }
  .kv-table th, .kv-table td { padding: 8px 10px; }
}

/* Feature matrix / rig-conversion table. Same rhythm as .kv-table but
   stands on its own so we can tune row heights independently if the
   Place Settings matrix grows. */
.docs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0 10px;
  font-size: 13.5px;
  background: rgba(14, 12, 28, 0.55);
  border: 1px solid rgba(120, 100, 200, 0.18);
  border-radius: 8px;
  overflow: hidden;
}
.docs-table thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #c2b8f0;
  background: rgba(80, 60, 180, 0.20);
  border-bottom: 1px solid rgba(120, 100, 200, 0.22);
}
.docs-table tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid rgba(120, 100, 200, 0.10);
  color: #d9d5ee;
  vertical-align: top;
}
.docs-table tbody tr:last-child td { border-bottom: 0; }
.docs-table tbody tr:hover td { background: rgba(120, 100, 200, 0.08); }
.docs-table code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  background: rgba(120, 100, 200, 0.16);
  padding: 1px 6px;
  border-radius: 4px;
  color: #e5dfff;
}
@media (max-width: 720px) {
  .docs-table { font-size: 12.5px; }
  .docs-table thead th, .docs-table tbody td { padding: 8px 10px; }
}
