:root {
  /* Light Theme (Default) */
  --bg: #ffffff;
  --text: #1f2328;
  --accent: #0969da;
  --code-bg: #f6f8fa;
  --border: #d0d7de;
  --tagline: #57606a;
  --header-text: #1f2328;
  --btn-bg: #ffffff;
  --btn-border: #d0d7de;
  --btn-hover-bg: #f3f4f6;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark Theme */
    --bg: #0d1117;
    --text: #c9d1d9;
    --accent: #58a6ff;
    --code-bg: #161b22;
    --border: #30363d;
    --tagline: #8b949e;
    --header-text: #ffffff;
    --btn-bg: #21262d;
    --btn-border: #30363d;
    --btn-hover-bg: #30363d;
  }
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
    sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
}
.container {
  max-width: 800px;
  width: 100%;
}
header {
  margin-bottom: 4rem;
  text-align: center;
}
h1 {
  font-size: 3.5rem;
  color: var(--header-text);
  margin-bottom: 0.5rem;
  letter-spacing: -2px;
}
h1 a {
  color: inherit;
  text-decoration: none;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
footer {
  margin-top: 5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.9rem;
  color: var(--tagline);
}

/* Wordmark image (theme-aware SVG: adapts to prefers-color-scheme on its own). */
.logo {
  display: block;
  height: 8rem;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
}

/* Subpage tweaks: tighter header spacing (logo stays the same size as on
   the home page for visual consistency). */
.subpage header {
  margin-bottom: 3rem;
}

.tagline {
  font-size: 1.25rem;
  color: var(--tagline);
}

/* Top navigation: shown on every page below the logo. Replaces the
   per-subpage "← Back to home" pattern and surfaces Docs prominently. */
.topnav {
  margin-top: 1.25rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  font-size: 0.95rem;
}
.topnav a {
  color: var(--text);
}
.topnav a:hover {
  color: var(--accent);
}
.topnav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}

/* Install tabs (GitHub-style underline). CSS-only tabs via hidden radio
   inputs: the `:checked` state of one radio drives both the active label
   styling and which pane is visible (using `~` sibling combinators). This
   avoids `display: contents` on <details>, which misbehaves inside CSS
   grid on mobile Chromium and pushed the install-box into the wrong cell. */
.install-tabs {
  margin-bottom: 1.25rem;
}
/* Visually hide the radios but keep them focusable for keyboard users. */
.install-tab-radio {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
  white-space: nowrap;
}
.install-tab-labels {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.install-tab-labels > label {
  cursor: pointer;
  padding: 0.6rem 1.1rem;
  font-weight: 500;
  color: var(--tagline);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;        /* overlap the row's bottom border */
  user-select: none;
  transition: color 0.15s;
}
.install-tab-labels > label:hover {
  color: var(--text);
}
.install-tab-pane {
  display: none;
  padding-top: 1rem;
}
#ip-linux:checked ~ .install-tab-labels > label[for="ip-linux"],
#ip-macos:checked ~ .install-tab-labels > label[for="ip-macos"],
#ip-windows:checked ~ .install-tab-labels > label[for="ip-windows"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
#ip-linux:checked ~ .install-tab-pane[data-platform="linux"],
#ip-macos:checked ~ .install-tab-pane[data-platform="macos"],
#ip-windows:checked ~ .install-tab-pane[data-platform="windows"] {
  display: block;
}
/* Keyboard focus: outline the label whose radio is focused. */
#ip-linux:focus-visible ~ .install-tab-labels > label[for="ip-linux"],
#ip-macos:focus-visible ~ .install-tab-labels > label[for="ip-macos"],
#ip-windows:focus-visible ~ .install-tab-labels > label[for="ip-windows"] {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.install-box-wrapper {
  position: relative;
  margin: 0 0 2rem 0;
}
/* Tighten the gap when an install-note follows the code block. */
.install-box-wrapper:has(+ .install-note) {
  margin-bottom: 0.5rem;
}
.install-box {
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 1.5rem;
  /* Leave room for the absolutely-positioned copy button in the top-right
     so it doesn't sit on top of the first line of code. */
  padding-right: 3.25rem;
  border-radius: 8px;
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  margin: 0;
  overflow-x: auto;
  white-space: pre;
  font-size: 0.9rem;
}
.copy-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: 6px;
  color: var(--tagline);
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.copy-btn:hover {
  background: var(--btn-hover-bg);
  color: var(--text);
}
.copy-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.comment {
  color: var(--tagline);
}
.cmd {
  color: var(--accent);
}

.install-note {
  font-size: 0.85rem;
  color: var(--tagline);
  text-align: center;
  margin-top: 0.5rem;
  margin-bottom: 2rem;
}
.features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 3rem;
}
@media (max-width: 600px) {
  body {
    padding: 1rem;
  }
  h1 {
    font-size: 2.5rem;
  }
  header {
    margin-bottom: 2.5rem;
  }
  .logo {
    height: 6rem;
  }
  .features {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  .install-box {
    padding: 1rem;
    padding-right: 2.75rem;
    font-size: 0.8rem;
  }
  .copy-btn {
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.35rem;
  }
  .install-tab-labels > label {
    padding: 0.55rem 0.8rem;
  }
}
.feature-card h3 {
  color: var(--header-text);
  margin-bottom: 0.5rem;
}
.feature-card p {
  font-size: 0.9rem;
}

/* Packages page table */
code {
  background: var(--code-bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.9em;
}
/* Code inside the install-box is already styled by .install-box itself
   (monospace + padding on the box); don't re-apply the pill background. */
.install-box code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}
.back {
  margin-bottom: 2rem;
  font-size: 0.95rem;
}
.pkg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin-top: 1rem;
}
.pkg-table th, .pkg-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.pkg-table th {
  font-weight: 600;
  color: var(--header-text);
}
.pkg-table th.os, .pkg-table td.os {
  text-align: center;
  width: 5.5rem;
}
.pkg-table td.os {
  color: var(--tagline);
}
.pkg-table td.version {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  color: var(--tagline);
  font-size: 0.9em;
}
.pkg-table td.license {
  color: var(--tagline);
  font-size: 0.9em;
}
.pkg-table td.yes {
  color: #2da44e;
  font-weight: 600;
}
.pkg-table tr:last-child td {
  border-bottom: none;
}
.pkg-note {
  font-size: 0.85rem;
  color: var(--tagline);
  margin-top: 1rem;
}
