/* Docs pages (site/docs/, generated by scripts/build-site-docs.mjs), the license page, and the hand-made guides
   (hosting.html, github.html). Loaded after site.css and uses its colours. */

.nav-links a[aria-current="page"] { color: var(--text); border-color: rgba(124,111,255,0.4); }

/* ── Docs layout: a menu with this page's contents on the left, the page on the right ── */
.docs-layout {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 56px;
}
.docs-layout main.doc.docs-main { max-width: 80ch; margin: 0; padding: 56px 0 96px; min-width: 0; }

.docs-side {
  position: sticky;
  top: 69px;
  align-self: start;
  max-height: calc(100vh - 69px);
  overflow-y: auto;
  padding: 40px 8px 40px 0;
  font-size: 0.88rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(124,111,255,0.25) transparent;
}
.side-nav ul { list-style: none; }
.side-home { display: inline-block; color: var(--muted); text-decoration: none; margin-bottom: 18px; font-size: 0.84rem; }
.side-home:hover { color: var(--text); }
.side-group { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #a89fff; margin: 18px 0 6px; }
.side-nav a { display: block; color: var(--soft); text-decoration: none; padding: 5px 10px; border-radius: 7px; line-height: 1.4; }
.side-nav a:hover { color: var(--text); background: rgba(124,111,255,0.07); }
.side-nav a[aria-current="page"] { color: var(--text); background: rgba(124,111,255,0.12); font-weight: 600; }
.side-toc { margin: 4px 0 8px 10px; padding-left: 8px; border-left: 1px solid var(--border); }
.side-toc a { padding: 3px 8px; font-size: 0.82rem; color: var(--muted); }
.side-toc .l3 a { padding-left: 20px; font-size: 0.78rem; }
.side-nav a:focus-visible, .doc-card:focus-visible, .path-card:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }

/* On narrow screens the menu folds into "On this page" at the top */
.mobile-toc { display: none; }
.doc details.mobile-toc { margin-bottom: 28px; }
.toc-list { list-style: none; padding: 0 0 8px !important; margin: 0 !important; }
.toc-list li { margin: 2px 0; }
.toc-list a { color: var(--soft); text-decoration: none; }

/* ── Markdown content ── */
.md h2 .anchor, .md h3 .anchor, .md h4 .anchor {
  margin-left: 8px;
  color: var(--muted);
  text-decoration: none;
  opacity: 0;
  font-weight: 400;
  transition: opacity 0.15s;
}
.md h2:hover .anchor, .md h3:hover .anchor, .md h4:hover .anchor { opacity: 1; }
.md h4 { font-size: 0.98rem; font-weight: 700; color: var(--text); margin: 22px 0 6px; scroll-margin-top: 90px; }
.md h2:first-child { margin-top: 8px; }
.md li > ul, .md li > ol { margin: 4px 0 4px; }
.md li > p { margin-bottom: 6px; }
.md em { color: var(--text); }
.md hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }
.md img { max-width: 100%; height: auto; border-radius: 10px; }

.md blockquote {
  margin: 0 0 20px;
  padding: 14px 18px;
  background: rgba(124,111,255,0.06);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  color: var(--soft);
}
.md blockquote > :last-child { margin-bottom: 0; }

.code {
  position: relative;
  margin: 0 0 18px;
  background: #0d0d19;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.code-lang {
  padding: 7px 14px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: rgba(124,111,255,0.04);
}
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: rgba(124,111,255,0.3) transparent; }
.doc .code code {
  background: none;
  border: none;
  padding: 0;
  border-radius: 0;
  font-size: 0.84rem;
  line-height: 1.6;
  white-space: pre;
  overflow-wrap: normal;
  color: #d6d6ee;
}
.doc li .code { margin-top: 8px; }

.doc table code { white-space: normal; }
.doc td { min-width: 9ch; }

.doc-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.86rem;
}
.doc .doc-foot a { color: var(--muted); text-decoration: none; }
.doc .doc-foot a:hover { color: var(--text); }

.license-meta { font-size: 0.92rem; color: var(--muted); margin-bottom: 24px; }
.license-meta p { margin-bottom: 4px; }

/* ── Docs index ── */
main.doc.docs-index { max-width: 1000px; }
.doc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 8px; }
.doc a.doc-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  color: var(--soft);
  font-size: 0.9rem;
  line-height: 1.55;
  overflow-wrap: normal;
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
}
.doc a.doc-card strong { color: var(--text); font-size: 1rem; }
.doc a.doc-card:hover { border-color: rgba(124,111,255,0.45); background: var(--surface2); transform: translateY(-2px); }

/* ── Hand-made guides (hosting.html, github.html) ── */
main.guide {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 64px 24px 96px;
  line-height: 1.65;
  color: var(--soft);
}
.guide .doc-kicker { margin-bottom: 18px; }
.guide-hero { text-align: center; max-width: 760px; margin: 0 auto 48px; }
.guide-hero h1 {
  font-size: clamp(2.1rem, 6.5vw, 3.4rem);
  font-weight: 900;
  line-height: 1.07;
  letter-spacing: -0.035em;
  color: var(--text);
  margin-bottom: 16px;
}
.grad {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.guide-hero p { font-size: 1.12rem; color: var(--soft); }
.guide-hero .note { margin-top: 14px; font-size: 0.9rem; color: var(--muted); }

.guide h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 10px;
  scroll-margin-top: 90px;
}
.guide h3 { font-size: 1.08rem; font-weight: 700; color: var(--text); margin-bottom: 6px; scroll-margin-top: 90px; }
.guide p { margin-bottom: 12px; }
.guide strong { color: var(--text); font-weight: 600; }
.guide a:not(.btn):not(.path-card):not(.gh-card) { color: var(--accent2); text-decoration: underline; text-decoration-color: rgba(0,207,255,0.35); text-underline-offset: 3px; }
.guide a:not(.btn):not(.path-card):not(.gh-card):hover { text-decoration-color: var(--accent2); }
.guide code, .guide kbd { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.86em; background: var(--surface2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; color: var(--text); overflow-wrap: anywhere; }
.guide .path { color: var(--text); font-weight: 600; }
.section-intro { color: var(--muted); max-width: 680px; margin-bottom: 28px; }
.guide-section { padding-top: 72px; }

/* Three paths */
.paths { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
a.path-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 26px 24px 22px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--soft);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
a.path-card:hover { transform: translateY(-3px); border-color: rgba(124,111,255,0.5); box-shadow: 0 12px 40px rgba(0,0,0,0.35), 0 0 30px rgba(124,111,255,0.12); }
.path-card.featured { border-color: rgba(124,111,255,0.45); background: linear-gradient(180deg, rgba(124,111,255,0.1), rgba(124,111,255,0.02) 60%), var(--surface); }
.path-icon {
  width: 46px; height: 46px; border-radius: 13px;
  display: grid; place-items: center;
  background: rgba(124,111,255,0.14); color: #a89fff;
}
.path-icon.cyan { background: rgba(0,207,255,0.12); color: var(--accent2); }
.path-icon.green { background: rgba(74,222,128,0.12); color: var(--green); }
.path-card h3 { font-size: 1.15rem; margin: 0; }
.path-card p { font-size: 0.93rem; margin: 0; flex: 1; }
.path-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 0.72rem; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); background: rgba(255,255,255,0.02);
}
.tag.green { color: var(--green); border-color: rgba(74,222,128,0.3); }
.tag.cyan { color: var(--accent2); border-color: rgba(0,207,255,0.3); }
.path-go { font-size: 0.88rem; font-weight: 600; color: var(--accent2); }
.badge {
  position: absolute; top: 18px; right: 18px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2));
  padding: 4px 9px; border-radius: 999px;
}

/* A path in detail: steps beside a screenshot */
.path-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 40px; align-items: start; }
.path-detail.flip > .shots { order: -1; }
.guide ol.steps { margin: 18px 0 0; }
.guide ol.steps > li { color: var(--soft); font-size: 0.95rem; }
.guide ol.steps > li > strong:first-child { display: block; margin-bottom: 2px; }
.shots { display: grid; gap: 16px; }
figure.shot {
  margin: 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(124,111,255,0.25);
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(0,0,0,0.45), 0 0 40px rgba(124,111,255,0.08);
}
figure.shot img { display: block; width: 100%; height: auto; }
figure.shot figcaption { padding: 10px 14px; font-size: 0.82rem; color: var(--muted); border-top: 1px solid var(--border); }
.shots.pair { grid-template-columns: 1fr 1fr; }
figure.shot.phone { max-width: 330px; justify-self: center; }

.callout {
  margin-top: 22px;
  padding: 18px 20px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.callout > :last-child { margin-bottom: 0; }
.callout-title { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.callout.ai { border-color: rgba(0,207,255,0.3); background: linear-gradient(135deg, rgba(0,207,255,0.06), rgba(124,111,255,0.05)); }
.callout.ok { border-color: rgba(74,222,128,0.3); background: rgba(74,222,128,0.05); }

/* CGNAT box */
.cgnat {
  border-radius: 22px;
  padding: 34px 32px;
  background: linear-gradient(160deg, rgba(124,111,255,0.12), rgba(0,207,255,0.05) 55%, transparent), var(--surface);
  border: 1px solid rgba(124,111,255,0.3);
}
.cgnat-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 36px; align-items: start; }
.options { list-style: none; counter-reset: opt; display: grid; gap: 10px; margin-top: 18px; }
.options li {
  counter-increment: opt;
  position: relative;
  padding: 12px 14px 12px 50px;
  background: rgba(11,11,20,0.55);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.93rem;
}
.options li::before {
  content: counter(opt);
  position: absolute; left: 14px; top: 12px;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.78rem; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}
.options li strong { display: block; }

/* FAQ */
.faq { display: grid; gap: 10px; max-width: 820px; }
.guide details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 0 18px; }
.guide details[open] { padding-bottom: 8px; }
.guide summary {
  cursor: pointer; list-style: none; padding: 15px 0; font-weight: 600; color: var(--text);
  display: flex; justify-content: space-between; gap: 12px;
}
.guide summary::-webkit-details-marker { display: none; }
.guide summary::after { content: '+'; color: var(--accent); font-weight: 700; flex-shrink: 0; }
.guide details[open] summary::after { content: '\2212'; }
.guide details p, .guide details ul { font-size: 0.94rem; }
.guide details ul { padding-left: 1.3em; margin-bottom: 12px; }
.guide summary:focus-visible, .guide a:focus-visible { outline: 2px solid var(--accent2); outline-offset: 3px; border-radius: 6px; }

.reference {
  margin-top: 64px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px 24px;
  padding: 26px 28px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.reference p { margin: 0; max-width: 620px; }

/* What's on GitHub */
.gh-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.gh-card {
  min-width: 0;
  display: flex; flex-direction: column; gap: 10px;
  padding: 26px 24px 22px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.gh-card.wide { grid-column: span 2; }
.gh-card.full { grid-column: 1 / -1; }
.gh-card h2 { font-size: 1.2rem; letter-spacing: -0.015em; margin: 0; }
.gh-card p { font-size: 0.93rem; margin: 0; }
.gh-card ul { font-size: 0.9rem; padding-left: 1.2em; margin: 0; }
.gh-card li { margin: 4px 0; }
.gh-card li::marker { color: var(--accent); }
.who { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: #a89fff; }
.gh-card .spacer { flex: 1; }
.gh-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.gh-card pre {
  margin: 0; padding: 12px 14px; border-radius: 10px; background: #0d0d19; border: 1px solid var(--border);
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.8rem; line-height: 1.6; color: #d6d6ee;
  overflow-x: auto; white-space: pre;
}
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches span { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.12); }
.sw-1 { background: #7c6fff; } .sw-2 { background: #cba6f7; } .sw-3 { background: #bd93f9; } .sw-4 { background: #7aa2f7; }
.sw-5 { background: #88c0d0; } .sw-6 { background: #61afef; } .sw-7 { background: #268bd2; } .sw-8 { background: #5865f2; }
.sw-9 { background: #ff007f; } .sw-10 { background: #39ff14; } .sw-11 { background: #ff3333; }

@media (max-width: 1000px) {
  .docs-layout { display: block; padding: 0 16px; }
  .docs-side { display: none; }
  .docs-layout main.doc.docs-main { padding: 40px 0 72px; }
  .mobile-toc { display: block; }
  .paths, .gh-grid { grid-template-columns: minmax(0, 1fr); }
  .gh-card.wide, .gh-card.full { grid-column: auto; }
  .path-detail, .cgnat-grid { grid-template-columns: 1fr; gap: 28px; }
  .path-detail.flip > .shots { order: 0; }
}

@media (max-width: 600px) {
  main.guide { padding: 44px 16px 72px; }
  .guide-section { padding-top: 56px; }
  .cgnat { padding: 24px 18px; border-radius: 18px; }
  .shots.pair { grid-template-columns: 1fr; }
  .reference { padding: 22px 20px; }
  .doc td, .doc th { padding: 9px 11px; }
}

@media (prefers-reduced-motion: reduce) {
  a.path-card, .doc a.doc-card { transition: none; }
  a.path-card:hover, .doc a.doc-card:hover { transform: none; }
}

.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; }
