/* RipperMoonKit docs — Onyx theme (black / white / scarlet, subtle Tahoe cues).
   Matches the marketing site: glass chrome, hairlines, large radii, scarlet accent. */

:root {
  color-scheme: light dark;
  --bg:        oklch(0.99 0 0);
  --bg-deep:   oklch(0.96 0 0);
  --surface:   oklch(1 0 0);
  --surface-2: oklch(0.97 0 0);
  --chrome:    oklch(0.995 0 0 / 0.78);
  --hairline:  oklch(0 0 0 / 0.08);
  --hairline-2:oklch(0 0 0 / 0.14);
  --text:      oklch(0.15 0 0);
  --text-dim:  oklch(0.42 0 0);
  --text-mute: oklch(0.60 0 0);
  --accent:    oklch(0.48 0.22 27);
  --accent-2:  oklch(0.40 0.18 22);
  --accent-ink:oklch(0.99 0 0);
  --glow:      oklch(0.48 0.22 27 / 0.16);
  --logo-shadow: none;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg:        oklch(0.14 0 0);
    --bg-deep:   oklch(0.10 0 0);
    --surface:   oklch(0.18 0 0);
    --surface-2: oklch(0.22 0 0);
    --chrome:    oklch(0.16 0 0 / 0.78);
    --hairline:  oklch(1 0 0 / 0.07);
    --hairline-2:oklch(1 0 0 / 0.13);
    --text:      oklch(0.98 0 0);
    --text-dim:  oklch(0.72 0 0);
    --text-mute: oklch(0.55 0 0);
    --accent:    oklch(0.60 0.22 27);
    --accent-2:  oklch(0.50 0.18 22);
    --glow:      oklch(0.60 0.22 27 / 0.22);
    --logo-shadow: drop-shadow(0 0 10px oklch(0.60 0.22 27 / 0.35));
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15.5px/1.62 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* Faint accent washes behind the chrome. */
body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(160px);
  pointer-events: none;
  z-index: 0;
}
body::before {
  width: 780px; height: 780px;
  background: radial-gradient(circle, var(--accent), transparent 55%);
  opacity: 0.09; top: -400px; left: 45%;
}
body::after {
  width: 560px; height: 560px;
  background: radial-gradient(circle, var(--accent-2), transparent 55%);
  opacity: 0.07; top: 260px; left: -260px;
}

a { color: inherit; }

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 0.5px solid var(--hairline);
  background: var(--chrome);
  -webkit-backdrop-filter: blur(28px) saturate(1.7);
  backdrop-filter: blur(28px) saturate(1.7);
}

.topbar-inner {
  width: min(1180px, calc(100% - 48px));
  min-height: 58px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.3px;
  color: var(--text);
}

.brand img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: var(--logo-shadow);
}

.topnav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  min-width: 0;
}

.topnav a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 11px;
  border: 0.5px solid transparent;
  border-radius: 8px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 540;
  letter-spacing: -0.1px;
}

.topnav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

/* The download link reads as the primary action. */
.topnav a[href*="/releases/latest/download/"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  border-radius: 999px;
  padding: 0 14px;
  font-weight: 590;
  box-shadow: 0 4px 14px -4px var(--glow);
}
.topnav a[href*="/releases/latest/download/"]:hover {
  color: var(--accent-ink);
  transform: translateY(-1px);
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
.page {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 44px;
  align-items: start;
}

/* ── Doc tree ────────────────────────────────────────────────────────────── */
.doc-tree {
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 110px);
  overflow: auto;
  margin-top: 26px;
  padding: 14px;
  border: 0.5px solid var(--hairline);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 0 var(--hairline-2);
}

.doc-tree details {
  border-radius: 11px;
}

.doc-tree details + details {
  margin-top: 4px;
}

.doc-tree summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 31px;
  padding: 0 8px;
  border-radius: 9px;
  color: var(--text-mute);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 660;
  letter-spacing: 0.07em;
  list-style: none;
  text-transform: uppercase;
  user-select: none;
}

.doc-tree summary::-webkit-details-marker {
  display: none;
}

.doc-tree summary::before {
  content: "›";
  display: inline-grid;
  place-items: center;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  color: var(--accent);
  font-size: 14px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 0.14s ease;
}

.doc-tree details[open] summary::before {
  transform: rotate(90deg);
}

.doc-tree summary:hover {
  color: var(--text);
  background: var(--surface-2);
}

.doc-tree a {
  display: block;
  padding: 6px 10px;
  margin: 1px 0 1px 20px;
  border-radius: 9px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 540;
}

.doc-tree a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.doc-tree a[aria-current="page"] {
  color: var(--accent-ink);
  background: var(--accent);
  font-weight: 580;
}

/* Doc-nav toggle: hidden on desktop — the tree is always open there.
   On small screens it becomes a tap-to-open menu (see media query below). */
.doc-tree-switch {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  opacity: 0;
}

.doc-tree-toggle {
  display: none;
}

/* ── Content ─────────────────────────────────────────────────────────────── */
.content {
  min-width: 0;
  padding: 50px 0 80px;
}

.hero {
  padding-bottom: 26px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 660;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2, h3 {
  color: var(--text);
  line-height: 1.07;
}

h1 {
  margin: 0 0 16px;
  font-size: clamp(2.3rem, 6vw, 4rem);
  font-weight: 760;
  letter-spacing: -1.6px;
}

h2 {
  margin: 46px 0 14px;
  padding-top: 28px;
  border-top: 0.5px solid var(--hairline);
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  font-weight: 720;
  letter-spacing: -0.6px;
}

h3 {
  margin: 26px 0 8px;
  font-size: 1.16rem;
  font-weight: 660;
  letter-spacing: -0.2px;
}

p {
  max-width: 760px;
  margin: 0 0 18px;
  color: var(--text-dim);
}

.lead {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--text-dim);
}

ul, ol {
  max-width: 760px;
  margin: 0 0 22px;
  padding-left: 1.2em;
  color: var(--text-dim);
}

li + li { margin-top: 7px; }

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

/* Inline prose links — scoped to article content so chrome links keep their
   own color (the :not() specificity would otherwise win over .topnav a). */
.content p a,
.content li a,
.content .lead a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.88em;
  padding: 0.12em 0.38em;
  border-radius: 6px;
  background: var(--surface-2);
  border: 0.5px solid var(--hairline);
}

pre {
  max-width: 860px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  margin: 16px 0 24px;
  padding: 14px 16px;
  border: 0.5px solid var(--hairline-2);
  border-radius: 12px;
  background: var(--bg-deep);
}

pre code {
  color: var(--text);
  padding: 0;
  border: none;
  background: none;
  font-size: 0.82rem;
  line-height: 1.6;
}

figure {
  margin: 24px 0;
}

figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 0.5px solid var(--hairline-2);
  border-radius: 16px;
  background: var(--bg-deep);
}

figcaption {
  margin-top: 10px;
  color: var(--text-mute);
  font-size: 0.9rem;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 24px 0;
}

.card {
  display: block;
  min-height: 112px;
  padding: 20px;
  border: 0.5px solid var(--hairline);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 0 var(--hairline-2);
  color: inherit;
  text-decoration: none;
  transition: transform .14s, border-color .14s;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--hairline-2);
}

.card h3 {
  margin-top: 0;
}

.card p {
  margin-bottom: 0;
  font-size: 0.92rem;
}

.doc-directory {
  margin: 20px 0 32px;
}

.doc-directory h2 {
  margin-top: 22px;
}

.doc-directory details {
  max-width: 860px;
  border-top: 0.5px solid var(--hairline);
}

.doc-directory details:last-child {
  border-bottom: 0.5px solid var(--hairline);
}

.doc-directory summary {
  display: flex;
  align-items: center;
  min-height: 46px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.96rem;
  font-weight: 660;
  list-style: none;
  user-select: none;
}

.doc-directory summary::-webkit-details-marker {
  display: none;
}

.doc-directory summary::before {
  content: "›";
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  border: 0.5px solid var(--hairline);
  border-radius: 50%;
  color: var(--accent);
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 0.14s ease;
}

.doc-directory details[open] summary::before {
  transform: rotate(90deg);
}

.doc-directory a {
  display: grid;
  grid-template-columns: minmax(150px, 0.36fr) minmax(0, 1fr);
  gap: 14px;
  padding: 10px 0 10px 28px;
  color: inherit;
  text-decoration: none;
}

.doc-directory a:hover span {
  color: var(--accent);
}

.doc-directory span {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
}

.doc-directory small {
  color: var(--text-dim);
  font-size: 0.86rem;
  line-height: 1.45;
}

.game-list {
  display: grid;
  gap: 14px;
  margin: 24px 0;
}

.game-entry {
  padding: 18px 20px;
  border: 0.5px solid var(--hairline);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 0 var(--hairline-2);
}

.game-entry h3 {
  margin-top: 0;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border: 0.5px solid var(--hairline);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 0.74rem;
  font-weight: 620;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.tag.good {
  color: oklch(0.50 0.12 155);
}

.tag.warn {
  color: oklch(0.62 0.13 70);
}

.note-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 4px;
}

.note-grid div {
  padding: 12px;
  border: 0.5px solid var(--hairline);
  border-radius: 12px;
  background: var(--bg-deep);
}

.note-grid strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text);
  font-size: 0.82rem;
}

.note-grid p {
  margin: 0;
  font-size: 0.88rem;
}

/* ── Footer links ────────────────────────────────────────────────────────── */
.next-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 34px;
  padding-top: 24px;
  border-top: 0.5px solid var(--hairline);
}

.button-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 16px;
  border: 0.5px solid var(--hairline-2);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 590;
  letter-spacing: -0.05px;
  transition: transform .12s;
}

.button-link:hover {
  transform: translateY(-1px);
}

.button-link.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  box-shadow: 0 4px 14px -4px var(--glow);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 880px) {
  .topbar-inner {
    width: min(100% - 32px, 1180px);
    min-height: auto;
    padding: 12px 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .topnav {
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding-bottom: 3px;
    scrollbar-width: thin;
  }

  .topnav a {
    flex: 0 0 auto;
  }

  .page {
    width: min(100% - 32px, 1180px);
    display: block;
  }

  .doc-tree {
    position: sticky;
    top: 82px;
    z-index: 10;
    display: grid;
    gap: 4px;
    max-height: none;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 18px;
    padding: 10px;
    scrollbar-width: thin;
  }

  .doc-tree-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 11px;
    color: var(--text);
    background: var(--surface-2);
    font-size: 0.78rem;
    font-weight: 650;
    cursor: pointer;
  }

  .doc-tree-toggle::after {
    content: "›";
    color: var(--accent);
    font-size: 18px;
    transform: rotate(90deg);
    transition: transform 0.14s ease;
  }

  .doc-tree-switch:not(:checked) ~ details {
    display: none;
  }

  .doc-tree-switch:not(:checked) + .doc-tree-toggle::after {
    transform: rotate(0deg);
  }

  .doc-tree:has(.doc-tree-switch:checked) {
    max-height: min(62vh, 520px);
  }

  .doc-tree details {
    min-width: 0;
  }

  .doc-tree a {
    margin-left: 20px;
  }

  .content {
    padding-top: 28px;
  }

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

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

  .doc-directory a {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

@media (max-width: 560px) {
  .topbar-inner,
  .page {
    width: min(100% - 22px, 1180px);
  }

  .brand span {
    max-width: 52vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .content {
    padding-bottom: 56px;
  }

  .hero {
    padding-bottom: 16px;
  }

  h1 {
    font-size: clamp(2rem, 13vw, 3rem);
    letter-spacing: -1px;
  }

  h2 {
    margin-top: 34px;
    padding-top: 22px;
  }

  figure img {
    border-radius: 12px;
  }

  .cards {
    gap: 10px;
  }

  .card,
  .game-entry {
    border-radius: 14px;
    padding: 16px;
  }

  .next-links {
    align-items: stretch;
    flex-direction: column;
  }

  .button-link {
    justify-content: center;
    width: 100%;
  }
}
