/* Spirit Vale Overlay documentation site — dark theme. */

:root {
  color-scheme: dark;

  --bg: #0b0e14;
  --bg-raised: #121722;
  --bg-inset: #0e131c;
  --border: #232b3a;
  --border-strong: #33405a;

  --text: #dfe5f0;
  --text-muted: #98a3b8;
  --heading: #f3f6fb;

  --accent: #7aa2ff;
  --accent-strong: #9db8ff;
  --accent-ink: #0b0e14;

  --focus: #ffcc66;

  --radius: 10px;
  --wrap: 54rem;

  --font-sans: ui-sans-serif, system-ui, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "Consolas", "SFMono-Regular",
    Menlo, monospace;
}

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

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--accent-strong);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--bg-raised);
  color: var(--heading);
  padding: 0.6rem 1rem;
  z-index: 20;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

/* Header ------------------------------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 14, 20, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-block: 0.75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--heading);
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-mark {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--accent), #b489ff);
  flex: none;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.94rem;
  padding-block: 0.15rem;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover {
  color: var(--heading);
}

.site-nav a[aria-current="page"] {
  color: var(--heading);
  border-bottom-color: var(--accent);
}

/* Marks the links that leave the site (they also open in a new tab). */
.nav-external::after {
  content: "\2197";
  margin-left: 0.15em;
  font-size: 0.85em;
  opacity: 0.7;
}

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

.hero {
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(
      70rem 26rem at 50% -10rem,
      rgba(122, 162, 255, 0.16),
      transparent 70%
    ),
    var(--bg-inset);
  padding-block: 3.25rem 2.75rem;
  text-align: center;
}

.eyebrow {
  margin: 0 0 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.9rem, 5.5vw, 2.9rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--heading);
}

.lede {
  margin: 0 auto 1.75rem;
  max-width: 42rem;
  color: var(--text-muted);
  font-size: 1.06rem;
}

/* Download control -------------------------------------------------------- */

.download {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  margin-block: 1.5rem;
}

.hero .download {
  margin-block: 0;
}

.download-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem 0.75rem;
}

.btn {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover {
  background: var(--accent-strong);
  color: var(--accent-ink);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--heading);
}

.download-status {
  margin: 0;
  min-height: 1.4em;
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 34rem;
}

.download[data-state="fallback"] .download-status {
  color: #e8c07a;
}

/* Page content ------------------------------------------------------------ */

.page {
  flex: 1 0 auto;
  padding-block: 2.5rem 3.5rem;
}

.page-title {
  margin: 0 0 1.5rem;
  font-size: clamp(1.7rem, 4.5vw, 2.3rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--heading);
}

.prose > :first-child {
  margin-top: 0;
}

.prose h2 {
  margin: 2.75rem 0 0.85rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 1.45rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--heading);
}

.prose h3 {
  margin: 2rem 0 0.6rem;
  font-size: 1.14rem;
  color: var(--heading);
}

.prose h4 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1rem;
  color: var(--heading);
}

.prose p,
.prose ul,
.prose ol {
  margin: 0 0 1.05rem;
}

.prose ul,
.prose ol {
  padding-left: 1.35rem;
}

.prose li + li {
  margin-top: 0.35rem;
}

.prose li > ul,
.prose li > ol {
  margin: 0.35rem 0 0.35rem;
}

.prose strong {
  color: var(--heading);
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5rem auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-inset);
}

.prose blockquote {
  margin: 1.25rem 0;
  padding: 0.1rem 1.1rem;
  border-left: 3px solid var(--border-strong);
  color: var(--text-muted);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1em 0.35em;
  overflow-wrap: anywhere;
}

.prose pre {
  margin: 0 0 1.25rem;
  padding: 0.9rem 1rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.prose pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 0.86rem;
  line-height: 1.55;
  overflow-wrap: normal;
}

.prose hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.25rem;
  display: block;
  overflow-x: auto;
}

.prose th,
.prose td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.7rem;
  text-align: left;
}

.prose th {
  background: var(--bg-raised);
  color: var(--heading);
}

/* Search (Pagefind) ---------------------------------------------------- */

.site-search {
  position: relative;
  width: min(15rem, 100%);
  margin-left: auto;

  --pagefind-ui-scale: 0.8;
  --pagefind-ui-primary: var(--accent);
  --pagefind-ui-text: var(--text);
  --pagefind-ui-background: var(--bg-inset);
  --pagefind-ui-border: var(--border);
  --pagefind-ui-tag: var(--bg-raised);
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: var(--radius);
  --pagefind-ui-font: var(--font-sans);
}

.site-search .pagefind-ui__form {
  margin: 0;
}

/* Keep the results out of the document flow so the sticky header
   doesn't grow while searching. */
.site-search .pagefind-ui__drawer {
  position: absolute;
  right: 0;
  left: 0;
  margin-top: 0.4rem;
  padding: 0.5rem 0.75rem;
  max-height: min(70vh, 32rem);
  overflow-y: auto;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.site-search .pagefind-ui__drawer:not(.pagefind-ui__hidden) {
  z-index: 30;
}

.site-search .pagefind-ui__result {
  border-top: 1px solid var(--border);
}

.site-search .pagefind-ui__result-link {
  color: var(--heading);
}

/* Guide section --------------------------------------------------------- */

.guide-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.guide-nav a {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.guide-nav a:hover {
  color: var(--heading);
}

.guide-nav a[aria-current="page"] {
  color: var(--heading);
  border-bottom-color: var(--accent);
}

.guide-cards {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}

.guide-cards li {
  margin: 0;
}

.guide-cards a {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  height: 100%;
  padding: 0.9rem 1rem;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-muted);
}

.guide-cards a:hover {
  border-color: var(--border-strong);
}

.guide-cards strong {
  color: var(--heading);
}

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

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-inset);
  padding-block: 1.75rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.footer-inner p {
  margin: 0 0 0.6rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.2rem;
  margin-bottom: 0;
}

/* Narrow screens ---------------------------------------------------------- */

@media (max-width: 34rem) {
  .header-inner {
    justify-content: center;
  }

  .site-nav ul {
    justify-content: center;
  }

  .site-search {
    width: 100%;
    margin-left: 0;
  }

  .hero {
    padding-block: 2.5rem 2rem;
  }

  .download-actions {
    width: 100%;
    flex-direction: column;
  }

  .btn {
    width: 100%;
    text-align: center;
  }
}
