:root {
  --bg: #ffffff;
  --bg-alt: #f6f7f9;
  --sidebar-bg: #f6f7f9;
  --navbar-bg: #ffffff;
  --text: #1c1e21;
  --text-muted: #4a4f57;
  --border: #e3e5e8;
  --accent: #1a8870;
  --accent-bg: #e6f6f2;
  --code-bg: #f0f1f3;
  --table-header: #f0f1f3;
  --menu-hover: rgba(0, 0, 0, 0.05);
  --button-bg: #25c2a0;
  --button-text: #1c1e21;
}

:root[data-theme="dark"] {
  --bg: #1b1b1d;
  --bg-alt: #242526;
  --sidebar-bg: #1b1b1d;
  --navbar-bg: #1b1b1d;
  --text: #e3e3e3;
  --text-muted: #b0b3b8;
  --border: #3b3d40;
  --accent: #25c2a0;
  --accent-bg: #163b34;
  --code-bg: #2a2a2c;
  --table-header: #2a2a2c;
  --menu-hover: rgba(255, 255, 255, 0.05);
  --button-text: #fafafa;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1b1d;
    --bg-alt: #242526;
    --sidebar-bg: #1b1b1d;
    --navbar-bg: #1b1b1d;
    --text: #e3e3e3;
    --text-muted: #b0b3b8;
    --border: #3b3d40;
    --accent: #25c2a0;
    --accent-bg: #163b34;
    --code-bg: #2a2a2c;
    --table-header: #2a2a2c;
    --menu-hover: rgba(255, 255, 255, 0.05);
    --button-text: #fafafa;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

/* Navbar */
header.navbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--navbar-bg);
  border-bottom: 1px solid var(--border);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 78px;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-word {
  /* equal air above and below inside the 78px bar - measured, not guessed */
  position: relative;
  top: 1px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1;
}
.navbar-logo {
  /* Aligned by the ink, not the box. The script's tall loops pull its bounding box
     upwards while the body of the lettering reads ~14px lower, so matching boxes leaves
     the logo looking high. Measured at this render size: script body centre row 23,
     word cap centre row 37. `top` is used rather than margin so the bar does not grow;
     the descenders still finish inside it. */
  position: relative;
  top: 8px;
  height: 60px;
  width: auto;
  display: block;
}

/* Both logo files are the user's own artwork, shipped unmodified. logo-dark.png
   is the DARK-INK version and therefore belongs on the WHITE pages; logo.png is
   the light-ink version for the dark pages. */
.navbar-brand .logo-dark { display: none; }
.navbar-brand .logo-light { display: block; }

:root[data-theme="dark"] .navbar-brand .logo-light { display: none; }
:root[data-theme="dark"] .navbar-brand .logo-dark { display: block; }

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



.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Theme toggle */
.theme-toggle {
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.theme-toggle:hover {
  background: var(--bg-alt);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { display: block; }

:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }

/* Layout: sidebar + content. The sidebar is flush against the left edge of
   the viewport, full-width; only the reading content inside <main> is
   centered to a comfortable line length. */
.layout {
  display: flex;
  width: 100%;
}

nav.sidebar {
  width: 230px;
  flex-shrink: 0;
  padding: 28px 16px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 61px;
  height: calc(100vh - 61px);
  overflow-y: auto;
  align-self: flex-start;
}

nav.sidebar .sidebar-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0 10px 8px;
}

nav.sidebar a {
  display: block;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
}

nav.sidebar a:hover {
  background: var(--menu-hover);
}

nav.sidebar a[aria-current="page"] {
  background: var(--menu-hover);
  color: var(--accent);
  font-weight: 600;
}

main {
  flex: 1;
  min-width: 0;
  padding: 40px 48px 100px;
  display: flex;
  justify-content: flex-start;
}

.doc-content {
  width: 100%;
  max-width: 760px;
}

.doc-content figure {
  margin: 1.5em 0;
}

.screenshot-gallery {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.screenshot-gallery figure {
  margin: 1.5em 0 0;
  flex: 1;
  min-width: 0;
}

.screenshot-gallery img {
  width: 100%;
  height: auto;
  display: block;
}

@media (max-width: 700px) {
  .screenshot-gallery { flex-wrap: wrap; }
  .screenshot-gallery figure { flex: 1 1 100%; }
}

figcaption {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 6px;
}

h1 { font-size: 2rem; margin-top: 0; }
h2 { font-size: 1.4rem; margin-top: 2.2em; border-top: 1px solid var(--border); padding-top: 0.9em; }

/* Jumping to an in-page anchor must not hide the heading behind the sticky
   navbar (60px + its 1px border = 61px, the same offset the sidebar uses).
   The extra 16px leaves the heading's own top rule visible rather than flush
   against the navbar. */
[id] { scroll-margin-top: 77px; }

p, li { color: var(--text); }

.tagline {
  color: var(--text-muted);
  margin-top: -0.6em;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.95rem;
}

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

th {
  background: var(--table-header);
  white-space: nowrap;
}

.menu-table td:nth-child(2) {
  white-space: nowrap;
}

code {
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

.doc-content a:not(.button) {
  color: var(--accent);
}

.doc-content a:not(.button):hover {
  text-decoration: underline;
}

.callout {
  background: var(--accent-bg);
  border-left: 4px solid var(--accent);
  padding: 14px 18px;
  border-radius: 6px;
  margin: 1.5em 0;
}

.button {
  display: inline-block;
  background: var(--button-bg);
  color: var(--button-text);
  padding: 10px 20px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
}

.button:hover { opacity: 0.9; }

footer.site-footer {
  padding: 24px 48px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 700px) {
  .layout { flex-direction: column; }
  nav.sidebar { width: auto; height: auto; position: static; border-right: none; border-bottom: 1px solid var(--border); }
  main { padding: 28px 20px 60px; }
}
