:root {
  color-scheme: dark;
  --bg-page: #0a0a0a;
  --bg-surface: #141414;
  --bg-raised: #1d1d1d;
  --bg-code: #080808;
  --text-primary: #e8e8e8;
  --text-secondary: #ababab;
  --text-muted: #7d7d7d;
  --accent: #2ecc71;
  --accent-hover: #46d886;
  --accent-dark: #239b56;
  --accent-contrast: #07120b;
  --border: #303030;
  --border-strong: #484848;
  --warning: #d7a84c;
  --danger: #d96868;
  --syntax-tag: #7ee787;
  --syntax-attribute: #79c0ff;
  --syntax-string: #a5d6ff;
  --syntax-keyword: #d2a8ff;
  --syntax-comment: #8b949e;
  --syntax-number: #ffa657;
  --syntax-variable: #ffa657;
  --syntax-punctuation: #8b949e;
  --font-body: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Menlo, Consolas, monospace;
  --site-width: 72rem;
  --reading-width: 74ch;
  --radius: 0.375rem;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg-page: #f7f8f7;
  --bg-surface: #fff;
  --bg-raised: #ecefeb;
  --bg-code: #f1f3f1;
  --text-primary: #202320;
  --text-secondary: #4d534e;
  --text-muted: #6c746e;
  --accent: #197a43;
  --accent-hover: #126437;
  --accent-dark: #176b3d;
  --accent-contrast: #fff;
  --border: #d6dbd7;
  --border-strong: #aeb7b0;
  --warning: #8a6118;
  --danger: #a43f3f;
  --syntax-tag: #116329;
  --syntax-attribute: #0550ae;
  --syntax-string: #0a3069;
  --syntax-keyword: #8250df;
  --syntax-comment: #606872;
  --syntax-number: #953800;
  --syntax-variable: #8a5d00;
  --syntax-punctuation: #57606a;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg-page: #f7f8f7;
    --bg-surface: #fff;
    --bg-raised: #ecefeb;
    --bg-code: #f1f3f1;
    --text-primary: #202320;
    --text-secondary: #4d534e;
    --text-muted: #6c746e;
    --accent: #197a43;
    --accent-hover: #126437;
    --accent-dark: #176b3d;
    --accent-contrast: #fff;
    --border: #d6dbd7;
    --border-strong: #aeb7b0;
    --warning: #8a6118;
    --danger: #a43f3f;
    --syntax-tag: #116329;
    --syntax-attribute: #0550ae;
    --syntax-string: #0a3069;
    --syntax-keyword: #8250df;
    --syntax-comment: #606872;
    --syntax-number: #953800;
    --syntax-variable: #8a5d00;
    --syntax-punctuation: #57606a;
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text-secondary);
  background: var(--bg-page);
  font: 1rem/1.65 var(--font-body);
}

img,
svg {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

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

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

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 20;
  padding: 0.55rem 0.8rem;
  color: var(--accent-contrast);
  font-weight: 700;
  background: var(--accent);
  border-radius: var(--radius);
  transform: translateY(-180%);
}

.skip-link:focus {
  color: var(--accent-contrast);
  transform: translateY(0);
}

.site-header {
  height: 4.375rem;
  background: var(--bg-page);
  border-bottom: 1px solid var(--border);
}

.primary-nav {
  width: 100%;
  height: 100%;
}

.site-header__inner,
.site-footer__inner,
.page-shell {
  width: min(100% - 2rem, var(--site-width));
  margin-inline: auto;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.site-logo {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
}

.site-logo img {
  display: block;
  width: 11rem;
  height: auto;
}

.site-logo__light {
  display: none !important;
}

:root[data-theme="light"] .site-logo__dark {
  display: none;
}

:root[data-theme="light"] .site-logo__light {
  display: block !important;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .site-logo__dark {
    display: none;
  }

  :root:not([data-theme="dark"]) .site-logo__light {
    display: block !important;
  }
}

.primary-nav ul {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
}

.primary-nav li {
  margin: 0 0 0 1.5625rem;
}

.primary-nav a {
  position: relative;
  display: block;
  padding: 0.5rem 0;
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 400;
  letter-spacing: 0.025em;
  text-decoration: none;
}

.primary-nav a::after {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  content: "";
}

.primary-nav a:hover {
  color: var(--accent-hover);
}

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

.theme-toggle {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  margin-left: 1.25rem;
  padding: 0;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--accent);
  background: var(--bg-raised);
  border-color: var(--accent);
}

.theme-toggle::before {
  font: 1.15rem/1 var(--font-body);
  content: "◐";
}

.theme-toggle[data-theme-current="light"]::before {
  content: "☀";
}

.theme-toggle[data-theme-current="dark"]::before {
  content: "☾";
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.primary-nav a:hover::after,
.primary-nav a[aria-current="page"]::after {
  width: 100%;
}

.page-shell {
  padding-block: clamp(2.5rem, 6vw, 5rem);
}

.hero {
  background:
    radial-gradient(circle at 80% 15%, rgb(46 204 113 / 12%), transparent 28rem),
    var(--bg-page);
  border-bottom: 1px solid var(--border);
}

.hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(22rem, 0.9fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
  width: min(100% - 2rem, var(--site-width));
  min-height: 35rem;
  margin-inline: auto;
  padding-block: clamp(3.5rem, 8vw, 7rem);
}

.hero h1 {
  max-width: 13ch;
  font-size: clamp(2.75rem, 7vw, 5rem);
}

.hero__lede {
  max-width: 57ch;
  font-size: 1.15rem;
}

.hero__example {
  min-width: 0;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 1.5rem 5rem rgb(0 0 0 / 35%);
}

.hero__example pre {
  margin: 0;
  overflow-x: hidden;
  border: 0;
  border-radius: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.code-label {
  margin: 0;
  padding: 0.65rem 1rem;
  color: var(--text-muted);
  font: 0.78rem var(--font-mono);
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  margin-bottom: 0.65rem;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.home-content > section + section {
  margin-top: clamp(4rem, 9vw, 7rem);
}

.feature-grid,
.route-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.feature-card,
.route-card {
  padding: 1.4rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.feature-card h3 {
  margin-top: 0;
}

.feature-card p {
  margin-bottom: 0;
}

.split-section,
.release-note {
  display: grid;
  grid-template-columns: minmax(15rem, 0.75fr) minmax(0, 1.25fr);
  gap: clamp(2rem, 7vw, 6rem);
  padding-block: 2.5rem;
  border-block: 1px solid var(--border);
}

.split-section h2,
.release-note h2 {
  margin-top: 0;
}

.check-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  position: relative;
  padding-left: 1.75rem;
}

.check-list li::before {
  position: absolute;
  left: 0;
  color: var(--accent);
  content: "✓";
}

.route-card {
  display: flex;
  flex-direction: column;
  color: var(--text-primary);
  text-decoration: none;
}

.route-card:hover {
  background: var(--bg-raised);
  border-color: var(--accent-dark);
}

.route-card span {
  margin-bottom: 2rem;
  color: var(--accent);
  font: 0.8rem var(--font-mono);
}

.route-card small {
  margin-top: 0.35rem;
  color: var(--text-muted);
}

.anchor-target {
  display: block;
  height: 0;
}

.page-shell--reading {
  max-width: var(--reading-width);
}

.page-content {
  min-width: 0;
}

.docs-layout {
  display: grid;
  grid-template-columns: minmax(12.5rem, 15rem) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}

.docs-nav {
  position: sticky;
  top: 1.25rem;
  padding-right: 1.25rem;
  border-right: 1px solid var(--border);
}

.docs-nav h2 {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.docs-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.docs-nav li + li {
  margin-top: 0.2rem;
}

.docs-nav a {
  display: block;
  padding: 0.45rem 0.65rem;
  color: var(--text-secondary);
  font-size: 0.93rem;
  text-decoration: none;
  border-left: 3px solid transparent;
}

.docs-nav a:hover {
  color: var(--text-primary);
  background: rgb(255 255 255 / 4%);
}

.docs-nav a[aria-current="page"] {
  color: var(--text-primary);
  background: rgb(46 204 113 / 8%);
  border-left-color: var(--accent);
}

h1,
h2,
h3,
h4 {
  color: var(--text-primary);
  line-height: 1.25;
  text-wrap: balance;
}

h1 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 5vw, 2.75rem);
  letter-spacing: -0.025em;
}

h2 {
  margin: 2.75rem 0 0.75rem;
  font-size: 1.6rem;
}

h3 {
  margin: 2rem 0 0.6rem;
  font-size: 1.25rem;
}

h4 {
  margin: 1.6rem 0 0.5rem;
  font-size: 1.05rem;
}

p,
ul,
ol,
dl,
pre,
table {
  margin-block: 0 1.25rem;
}

ul,
ol {
  padding-left: 1.5rem;
}

.page-content li + li {
  margin-top: 0.3rem;
}

li > ul,
li > ol {
  margin-top: 0.35rem;
  margin-bottom: 0.35rem;
}

dt {
  color: var(--text-primary);
  font-weight: 700;
}

dd {
  margin: 0 0 1rem;
}

figure {
  margin: 1.75rem 0;
}

figure img {
  display: block;
  margin-inline: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.image-on-white {
  padding: 0.75rem;
  background: #fff;
}

figcaption {
  margin-top: 0.6rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
}

.on-this-page {
  margin: 2rem 0;
  padding: 1rem 1.2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.documentation-directory {
  margin: 2.5rem 0;
}

.documentation-directory > h2 {
  margin-bottom: 0.5rem;
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.link-card {
  padding: 1.1rem 1.2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.link-card h3 {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
}

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

.on-this-page h2 {
  margin: 0 0 0.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.on-this-page ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.on-this-page li,
.on-this-page li + li {
  margin: 0;
}

.lede {
  max-width: 60ch;
  color: var(--text-secondary);
  font-size: 1.15rem;
}

code,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

:not(pre) > code,
.codefrag {
  overflow-wrap: anywhere;
  padding: 0.12em 0.32em;
  color: var(--text-primary);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
}

pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 1rem;
  color: var(--text-primary);
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  line-height: 1.55;
  tab-size: 4;
}

pre code {
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
}

.syntax-tag {
  color: var(--syntax-tag);
}

.syntax-attribute {
  color: var(--syntax-attribute);
}

.syntax-string {
  color: var(--syntax-string);
}

.syntax-keyword {
  color: var(--syntax-keyword);
  font-weight: 600;
}

.syntax-comment {
  color: var(--syntax-comment);
  font-style: italic;
}

.syntax-number {
  color: var(--syntax-number);
}

.syntax-variable {
  color: var(--syntax-variable);
}

.syntax-punctuation {
  color: var(--syntax-punctuation);
}

.note,
.warning {
  margin-block: 1.5rem;
  padding: 1rem 1.1rem;
  border-left: 3px solid;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.note {
  background: rgb(46 204 113 / 8%);
  border-color: var(--accent);
}

.warning {
  background: rgb(215 168 76 / 9%);
  border-color: var(--warning);
}

.note > :last-child,
.warning > :last-child {
  margin-bottom: 0;
}

.table-scroll {
  max-width: 100%;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Driver matrices fit the docs column; no framed scroll cage. */
.table-scroll:has(.drivers-matrix) {
  border: 0;
  border-radius: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text-secondary);
  background: var(--bg-surface);
  font-size: 0.94rem;
}

.table-scroll table {
  margin: 0;
}

/* Share width across columns; break long class names only at package dots. */
.drivers-matrix {
  table-layout: fixed;
  width: 100%;
}

.drivers-matrix .col-driver-name {
  width: 28%;
}

.drivers-matrix .col-native-driver {
  width: 26%;
}

.drivers-matrix td code {
  overflow-wrap: normal;
  word-break: normal;
}

caption {
  padding: 0.75rem;
  color: var(--text-primary);
  font-weight: 700;
  text-align: left;
  background: var(--bg-raised);
}

th,
td {
  padding: 0.7rem 0.8rem;
  text-align: left;
  vertical-align: top;
  border: 1px solid var(--border);
}

th {
  color: var(--text-primary);
  background: var(--bg-raised);
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-block: 1.5rem;
}

.button {
  display: inline-block;
  padding: 0.65rem 1rem;
  color: var(--accent-contrast);
  font-weight: 700;
  text-decoration: none;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}

.button:hover {
  color: var(--accent-contrast);
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.button--secondary {
  color: var(--text-primary);
  background: transparent;
  border-color: var(--border-strong);
}

.button--secondary:hover {
  color: var(--accent-hover);
  background: var(--bg-raised);
  border-color: var(--accent);
}

.site-footer {
  color: var(--text-muted);
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-block: 1.5rem;
  font-size: 0.88rem;
}

.site-footer p,
.site-footer ul {
  margin: 0;
}

.site-footer__credit {
  white-space: nowrap;
}

.site-footer .pvrlabs-wordmark {
  font-weight: 700;
  text-decoration: none;
}

.pvrlabs-wordmark__accent {
  color: var(--accent);
}

.pvrlabs-wordmark__light {
  margin-inline-start: 0.1em;
  color: var(--text-primary);
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  padding: 0;
  list-style: none;
}

.site-footer a {
  color: var(--text-secondary);
}

.site-footer a:hover {
  color: var(--accent-hover);
}

@media (max-width: 56rem) {
  .site-header {
    height: auto;
  }

  .site-header__inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.6rem;
    padding-block: 0.85rem;
  }

  .site-logo img {
    width: 10rem;
  }

  .primary-nav ul {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.15rem 1rem;
  }

  .primary-nav li {
    margin: 0;
  }

  .theme-toggle {
    margin-left: 0;
  }

  .docs-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .hero__inner,
  .feature-grid,
  .route-grid,
  .link-grid,
  .split-section,
  .release-note {
    grid-template-columns: 1fr;
  }

  .hero__inner {
    min-height: 0;
  }

  .docs-nav {
    position: static;
    padding: 0 0 1.25rem;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
}

@media print {
  :root {
    color-scheme: light;
    --bg-page: #fff;
    --bg-surface: #fff;
    --bg-raised: #fff;
    --bg-code: #fff;
    --text-primary: #111;
    --text-secondary: #222;
    --text-muted: #555;
    --border: #bbb;
    --border-strong: #888;
  }

  body {
    color: #222;
    background: #fff;
  }

  .skip-link,
  .primary-nav,
  .docs-nav,
  .site-footer {
    display: none;
  }

  .site-header {
    background: none;
    border: 0;
  }

  .site-header__inner,
  .page-shell {
    width: 100%;
  }

  h1,
  h2,
  h3,
  h4,
  a {
    color: #111;
  }

  :not(pre) > code,
  .codefrag,
  pre,
  table,
  caption,
  th,
  td,
  tbody tr:nth-child(even),
  .note,
  .warning {
    color: #111;
    background: #fff;
    border-color: #bbb;
  }

  .table-scroll {
    background: #fff;
    border-color: #bbb;
  }

  .note {
    border-left-color: #555;
  }

  .warning {
    border-left-color: #777;
  }
}
