/* ========================================
   Evipedia — Clean, minimal typography
   Wikipedia-inspired evidence review site
   ======================================== */

/* Reset & base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --text: #202122;
  --text-strong: #000000;
  --text-light: #54595d;
  --bg: #ffffff;
  --bg-muted: #f8f9fa;
  --code-bg: #eceef1;
  --border: #a2a9b1;
  --border-light: #e0e0e0;
  --link: #2563eb;
  --link-visited: #2563eb;
  --link-hover: #3b82f6;
  --accent: #1a73e8;
  --accent-text: #ffffff;
  --accent-active: #1d4ed8;
  --placeholder: #aaaaaa;
  --row-hover: #fafbfc;
  --error: #e00000;
  --new: #e8710a;
  --max-width: 800px;
  /* Coupled gap between page title and the subline directly below it.
     The subline's negative margin-top cancels the title's margin-bottom,
     so they MUST stay equal — that's why this is a single variable. */
  --title-bottom-gap: 0.5rem;
  --subline-bottom-gap: 1.5rem;
  /* Line-height applied to the subline on both ER and QRS pages, so the
     subline's box height (and therefore the at-a-glance / next-content
     position) matches across page types. */
  --subline-line-height: 1.75;
  /* Top and bottom margin of the QRS .sheet. Set to 0 here so the
     integrated QRS sits flush below the site header / above the site
     footer (both of which have their own spacing). Standalone QRS has
     neither, so its CSS uses positive fallback values to keep the
     content off the viewport edges. */
  --sheet-top-margin: 0;
  --sheet-bottom-margin: 0;
  --font-serif: Georgia, 'Times New Roman', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

[data-theme="dark"] {
  --text: #e6e6e6;
  --text-strong: #ffffff;
  --text-light: #9ca3af;
  --bg: #15171a;
  --bg-muted: #1d2024;
  --code-bg: #24282e;
  --border: #3a3f45;
  --border-light: #2a2e33;
  --link: #6ea8fe;
  --link-visited: #6ea8fe;
  --link-hover: #93c0ff;
  --accent: #6ea8fe;
  --accent-text: #0c0e10;
  --accent-active: #5a96e8;
  --placeholder: #6b7178;
  --row-hover: #21252b;
  --error: #ff6b6b;
  --new: #ff9f43;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* Container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Homepage uses a wider layout than the content/reading pages */
body.home {
  --max-width: 960px;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border-light);
  padding: 0.6rem 0;
  margin-bottom: 2.5rem;
}

.site-header-home {
  border-bottom: none;
}

.search-hero {
  margin-bottom: 2.5rem;
}

.site-header .container {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  position: relative;
}

.site-name-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.site-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 400;
  color: var(--text-strong);
  text-decoration: none;
  letter-spacing: -0.01em;
  display: inline;
}

.site-logo {
  height: 1.8rem;
  width: auto;
}

/* Environment tags next to the title. `.site-tag` (orange) is the env badge
   ("dev"), rendered only when `site_tag` is set in _config.yml — live leaves it
   unset. `.site-local` (pink) is added on any non-production (local `jekyll
   serve`) build, so the local preview is distinct from the deployed site. */
.site-tag {
  display: inline-block;
  margin-left: 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;               /* tight box so the text centers in the pill */
  letter-spacing: 0.02em;
  color: #fff;
  background: #e8710a;           /* orange — unmistakably not live */
  padding: 0.18rem 0.4rem 0.16rem;
  border-radius: 4px;
  vertical-align: middle;
  position: relative;
  top: -5px;                     /* lift it to sit optically centered on the title */
}
.site-tag.site-local {
  background: #e64980;           /* pink — this is a LOCAL jekyll build */
}

.site-header:not(.site-header-home) .site-name-group {
  position: relative;
  top: -2px;
}

.site-header:not(.site-header-home) .container {
  padding-right: clamp(1.5rem, calc(4rem - (100vw - var(--max-width)) / 2), 4rem);
}

.site-title:visited {
  color: var(--text-strong);
}

.site-title:hover {
  color: var(--text-strong);
}

.site-version {
  font-size: 0.65rem;
  color: var(--text-light);
  margin-left: 0.15rem;
}

.site-header-home .site-version {
  font-size: 0.875rem;
}

.site-tagline {
  font-size: 0.875rem;
  color: var(--text-light);
  align-self: flex-start;
  margin-top: 0.85rem;
}

.suggest-link {
  color: var(--text-light);
}

.suggest-link:visited {
  color: var(--text-light);
}

.suggest-link:hover {
  color: var(--text);
}

/* Homepage hero header */
.site-header-home {
  padding: 3rem 0 1rem;
  margin-bottom: 1rem;
}

.site-header-home .container {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
}

.site-header-home .site-title {
  font-size: 3.5rem;
}

.site-header-home .site-name-group {
  margin-top: 3rem;
}

.site-header-home .site-tagline {
  font-size: 1.1rem;
  align-self: center;
  margin-top: 0;
}

.site-header-home .container {
  position: relative;
}

.home-about-link {
  position: absolute;
  top: -1.5rem;
  right: clamp(0px, calc(4rem - (100vw - var(--max-width)) / 2), 4rem);
  font-size: 0.875rem;
}

.home-suggest-link {
  position: absolute;
  top: -1.5rem;
  left: 1.5rem;
  font-size: 0.875rem;
}

.home-link-sep {
  color: var(--text-strong);
}



.home-dev-links {
  position: absolute;
  top: -1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.875rem;
  opacity: 0;
  transition: opacity 0.3s;
}

.site-header-home:hover .home-dev-links {
  opacity: 1;
}

.home-dev-links a {
  margin-right: 1rem;
}

/* Mobile pull-down nav (hamburger) — hidden on desktop, swapped in for the
   absolutely-positioned home-about-link/home-suggest-link/home-dev-links
   groups below 700px, where five nav links plus the BETA badge no longer
   fit without wrapping into the centered title. */
.mobile-nav-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 100;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  background: var(--bg-muted);
  border: 1px solid var(--border-light);
  border-radius: 50%;
  padding: 0;
  color: var(--text-light);
  cursor: pointer;
}

.mobile-nav-toggle:hover {
  color: var(--text);
}

.mobile-nav-menu {
  display: none;
}

.mobile-nav-menu a {
  margin-right: 1rem;
}

@media (max-width: 700px) {
  .home-about-link,
  .home-suggest-link,
  .home-dev-links {
    display: none;
  }

  .mobile-nav-toggle {
    display: flex;
  }

  .mobile-nav-menu {
    display: none;
    flex-direction: column;
    position: fixed;
    top: calc(1rem + 36px + 0.5rem);
    left: 1rem;
    z-index: 100;
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    padding: 0.5rem 0;
    min-width: 180px;
    text-align: left;
  }

  .mobile-nav-menu.open {
    display: flex;
  }

  .mobile-nav-menu a {
    margin-right: 0;
    padding: 0.5rem 1rem;
  }

  .mobile-nav-menu a:hover {
    background: var(--bg-muted);
  }
}

/* Search */
.search-box {
  width: 100%;
  max-width: 400px;
  margin-top: 0.75rem;
}

.search-box-inline {
  margin: 0 auto;
  padding-bottom: 3.5rem;
  text-align: center;
  position: relative;
}

.search-box-inline::after {
  display: none;
}

.search-input-wrapper {
  position: relative;
  width: 100%;
}

.entry-count {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--placeholder);
  font-size: 0.95rem;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  font-size: 0.95rem;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--placeholder);
  pointer-events: none;
}

.search-box input:focus {
  border-color: var(--link);
}

.search-box input::placeholder {
  color: var(--placeholder);
}

.search-results {
  list-style: none;
  padding: 0;
  margin-bottom: 2rem;
}

.search-results li {
  padding: 0.5rem 0;
}

.search-results a {
  font-size: 1.1rem;
  font-weight: 500;
}

.search-no-results {
  color: var(--text-light);
  font-style: italic;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  max-width: 500px;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--link);
}

.form-group input[readonly] {
  background: var(--bg-muted);
  color: var(--text-light);
}

.form-group textarea {
  resize: vertical;
}

.form-submit {
  padding: 0.5rem 1.5rem;
  font-size: 0.95rem;
  font-family: var(--font-sans);
  background: var(--link);
  color: var(--accent-text);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.form-submit:hover {
  background: var(--link-hover);
}

/* Suggest pages two-column layout */
.suggest-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.suggest-main {
  flex: 1;
  min-width: 0;
}

.suggest-hint {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-muted);
  border: 1px solid var(--border-light);
  border-top: 3px solid var(--link);
  border-radius: 4px;
  padding: 1rem 1.1rem;
  font-size: inherit;
  line-height: 1.6;
  color: var(--text-light);
  margin-top: 0;
}

.suggest-hint p { margin-bottom: 0.6rem; }
.suggest-hint ul { padding-left: 1.2rem; margin-bottom: 0.6rem; }
.suggest-hint li { margin-bottom: 0.25rem; }
.suggest-hint strong { color: var(--text); }

@media (max-width: 640px) {
  .suggest-layout { flex-direction: column; }
  .suggest-hint { width: 100%; margin-top: 1.5rem; }
}

/* Workflow */
.workflow-list {
  list-style: none;
  padding: 0;
}

.workflow-list li {
  padding: 0.35rem 0;
}

.workflow-list a {
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.workflow-empty {
  color: var(--text-light);
  font-style: italic;
}

.workflow-filename {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

.frontmatter-block {
  background: var(--bg-muted);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin-bottom: 2rem;
  font-size: 0.875rem;
}

.frontmatter-table {
  width: auto;
  border: none;
  margin: 0;
}

.frontmatter-table td {
  border: none;
  padding: 0.2rem 0.75rem 0.2rem 0;
  vertical-align: top;
}

.frontmatter-table .fm-key {
  font-weight: 600;
  color: var(--text-light);
  white-space: nowrap;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-light);
  padding: 1.5rem 0;
  margin-top: 1rem;
  color: var(--text-light);
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  color: var(--text-light);
  text-decoration: none;
}

.footer-links a:visited {
  color: var(--text-light);
}

.footer-links a:hover {
  text-decoration: underline;
}

@media (max-width: 700px) {
  .footer-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
  }

  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1rem;
  }
}

/* Links */
a {
  color: var(--link);
  text-decoration: none;
}

a:visited {
  color: var(--link-visited);
}

a:hover {
  text-decoration: underline;
  color: var(--link-hover);
}

/* Typography */
h1 {
  font-family: var(--font-sans);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin-bottom: var(--title-bottom-gap);
}

h2 {
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

h3 {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.4;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1.25rem;
  margin-bottom: 0.4rem;
}

p {
  margin-bottom: 1rem;
}

/* Lists */
ul, ol {
  margin-bottom: 1rem;
  padding-left: 1.75rem;
}

li {
  margin-bottom: 0.35rem;
}

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

/* Bold & emphasis */
strong {
  font-weight: 600;
}

/* Blockquotes */
blockquote {
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  border-left: 3px solid var(--border);
  color: var(--text-light);
  background: var(--bg-muted);
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* Code */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-muted);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

pre code {
  background: none;
  padding: 0;
}

/* Copy button on fenced code blocks (added by _includes/code-copy.html) */
.code-block {
  position: relative;
}

.code-copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  color: var(--text-light);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.code-copy-btn:hover {
  color: var(--text-strong);
  background: var(--bg-muted);
}

.code-copy-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.code-copy-btn svg {
  width: 1rem;
  height: 1rem;
  display: block;
}

.code-copy-btn .icon-check {
  display: none;
}

.code-copy-btn.copied {
  color: #1a7f37;
  border-color: #1a7f37;
}

.code-copy-btn.copied .icon-copy {
  display: none;
}

.code-copy-btn.copied .icon-check {
  display: block;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.925rem;
}

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

th {
  background: var(--bg-muted);
  font-weight: 600;
}

tr:hover {
  background: var(--row-hover);
}

/* Horizontal rule */
hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 2rem 0;
}

/* ========================================
   Table of Contents
   ======================================== */
.toc {
  background: var(--bg-muted);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  max-width: 400px;
}

.toc h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  padding: 0;
  border: none;
}

.toc ol {
  margin: 0;
  padding-left: 1.5rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

.toc li {
  margin-bottom: 0.15rem;
}

.toc a {
  color: var(--link);
}

.toc a:visited {
  color: var(--link);
}

/* ========================================
   Review article
   ======================================== */
.review-date {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 0.25rem;
}

.review-body h1 + p,
.review-body h1 + section + p {
  font-size: 0.8rem;
  line-height: var(--subline-line-height);
  color: var(--text-light);
  margin-top: calc(var(--title-bottom-gap) * -1);
  margin-bottom: var(--subline-bottom-gap);
}

.review-body {
  line-height: 1.75;
}

.review-nav {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.9rem;
}

/* ========================================
   Index page — review list
   (Renamed from .page-title/.page-subtitle to avoid colliding with the
   QRS, which uses those generic names for its card header. No page
   currently consumes these rules; kept for future use.)
   ======================================== */
.index-title {
  font-family: var(--font-sans);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin-bottom: 0.25rem;
}

.index-subtitle {
  color: var(--text-light);
  font-size: 1.05rem;
  margin-bottom: 2.5rem;
}

.letter-directory {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  letter-spacing: 0.05em;
}

.letter-directory a {
  text-decoration: none;
}

.letter-directory a:hover {
  text-decoration: underline;
}

.cat-nav {
  margin-top: -3rem;
  margin-bottom: 4rem;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  line-height: 1.7;
  display: grid;
  grid-template-rows: repeat(6, auto);
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0.25rem 1.5rem;
}

.cat-nav a {
  text-decoration: none;
  color: var(--text-light);
  white-space: nowrap;
  text-align: center;
}

@media (max-width: 640px) {
  /* Keep the top->bottom flow on mobile too: 2 columns, 11 rows for 21 items
     (spacers are hidden on mobile so they don't create blank gaps). */
  .cat-nav {
    grid-template-rows: repeat(11, auto);
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
  }
  .cat-nav .cat-spacer {
    display: none;
  }
}

.cat-nav a:hover {
  color: var(--text-strong);
  text-decoration: underline;
}

/* Active category pill — set on the matching cloud link on a category
   promotion landing page (e.g. /skin). --cat-color is supplied inline from
   _data/categories.yml. */
.cat-nav a.cat-active,
.cat-nav a.cat-active:hover {
  color: #fff;
  background: var(--cat-color, var(--text-strong));
  border-radius: 999px;
  padding: 0.05rem 0.65rem;
  text-decoration: none;
}

/* Dev preview only: when the unreleased peptide + psychedelics categories are
   shown, the cloud has 22 entries + 1 spacer = 23 cells. Switch to 6 rows so
   the column-major flow keeps 4 columns (vs. an awkward 5th column with
   repeat(5)), landing Peptides below Medications and Psychedelics below
   Toxins & Detox. Placed after the base rules so it wins for equal specificity. */
.cat-nav-preview {
  grid-template-rows: repeat(6, auto);
}

@media (max-width: 640px) {
  .cat-nav-preview {
    grid-template-rows: repeat(12, auto);
  }
}

/* Spacer cell occupies a grid slot without rendering anything. */
.cat-nav .cat-spacer {
  visibility: hidden;
}

/* No separators: justified spacing between names is the separator, so there's
   no glyph left dangling at the end of a wrapped line. */

.category-heading {
  text-align: left;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  color: var(--text-light);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 0.95rem;
}

.review-letter {
  margin-top: 0.75rem;
  margin-bottom: 0.15rem;
  color: var(--text-light);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 0.8rem;
}

.review-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: 2rem;
}

@media (max-width: 640px) {
  .review-list {
    grid-template-columns: 1fr;
  }
}

.review-list li {
  padding: 0.1rem 0;
}

.review-list a {
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
}

.review-list a:hover {
  text-decoration: underline;
}

/* Dev preview only: ep_visible:false ERs are listed but greyed. In production
   they are filtered out entirely, so this class never appears there. */
.review-list a.hidden-review { color: var(--text-light); opacity: 0.55; }

/* "NEW:" badge prefixed to brand-new reviews (ep_new:true) — orange, keeps the
   review name in its normal link colour. */
.review-new { color: var(--new); font-weight: 700; }

.review-meta {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* Inline callout for a plain content page (e.g. /plugin) — same muted-box
   language as .suggest-hint, but full-width and block-level instead of a
   fixed-width sidebar. */
.hint-box {
  background: var(--bg-muted);
  border: 1px solid var(--border-light);
  border-top: 3px solid var(--link);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

.hint-box p:last-child { margin-bottom: 0; }
.hint-box ol,
.hint-box ul { padding-left: 1.2rem; margin-bottom: 0.6rem; }
.hint-box li { margin-bottom: 0.25rem; }
.hint-box strong { color: var(--text); }

/* ========================================
   Theme toggle
   ======================================== */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-muted);
  color: var(--text-light);
  border: 1px solid var(--border-light);
  border-radius: 50%;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  padding: 0;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border);
}

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

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

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 640px) {
  html {
    font-size: 15px;
  }

  .site-header .container {
    gap: 0.5rem;
  }

  h1 {
    font-size: 1.6rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  .toc {
    max-width: 100%;
  }

  .home-suggest-link > a[href$="/suggest"] {
    font-size: 0;
  }

  .home-suggest-link > a[href$="/suggest"]::before {
    content: "Suggest";
    font-size: 0.875rem;
  }
}

/* ------------------------------------------------------------------ */
/* Rouge syntax highlighting — light: igorpro, dark: base16.monokai.dark */
/* Regenerate with:                                                    */
/*   bundle exec rougify style igorpro --scope '.highlight'            */
/*   bundle exec rougify style base16.monokai.dark --scope '[data-theme="dark"] .highlight' */
/* The top-level .highlight background is neutralized below so the      */
/* code box surface (var(--code-bg)) + border show through.            */
/* ------------------------------------------------------------------ */
.highlight table td { padding: 5px; }
.highlight table pre { margin: 0; }
.highlight, .highlight .w {
  color: #444444;
}
.highlight .cp {
  color: #CC00A3;
}
.highlight .cs {
  color: #CC00A3;
}
.highlight .c, .highlight .ch, .highlight .cd, .highlight .cm, .highlight .cpf, .highlight .c1 {
  color: #FF0000;
}
.highlight .ge {
  font-style: italic;
}
.highlight .ges {
  font-weight: bold;
  font-style: italic;
}
.highlight .gs {
  font-weight: bold;
}
.highlight .kc {
  color: #C34E00;
}
.highlight .kd {
  color: #0000FF;
}
.highlight .kr {
  color: #007575;
}
.highlight .k, .highlight .kn, .highlight .kp, .highlight .kt, .highlight .kv {
  color: #0000FF;
}
.highlight .s, .highlight .sb, .highlight .sc, .highlight .dl, .highlight .sd, .highlight .s2, .highlight .se, .highlight .sh, .highlight .si, .highlight .sx, .highlight .sr, .highlight .s1, .highlight .ss {
  color: #009C00;
}
.highlight .sa {
  color: #0000FF;
}
.highlight .nb, .highlight .bp {
  color: #C34E00;
}
[data-theme="dark"] .highlight table td { padding: 5px; }
[data-theme="dark"] .highlight table pre { margin: 0; }
[data-theme="dark"] .highlight, [data-theme="dark"] .highlight .w {
  color: #f8f8f2;
  background-color: #272822;
}
[data-theme="dark"] .highlight .err {
  color: #272822;
  background-color: #f92672;
}
[data-theme="dark"] .highlight .c, [data-theme="dark"] .highlight .ch, [data-theme="dark"] .highlight .cd, [data-theme="dark"] .highlight .cm, [data-theme="dark"] .highlight .cpf, [data-theme="dark"] .highlight .c1, [data-theme="dark"] .highlight .cs {
  color: #75715e;
}
[data-theme="dark"] .highlight .cp {
  color: #f4bf75;
}
[data-theme="dark"] .highlight .nt {
  color: #f4bf75;
}
[data-theme="dark"] .highlight .o, [data-theme="dark"] .highlight .ow {
  color: #f8f8f2;
}
[data-theme="dark"] .highlight .p, [data-theme="dark"] .highlight .pi {
  color: #f8f8f2;
}
[data-theme="dark"] .highlight .gi {
  color: #a6e22e;
}
[data-theme="dark"] .highlight .gd {
  color: #f92672;
}
[data-theme="dark"] .highlight .gh {
  color: #66d9ef;
  background-color: #272822;
  font-weight: bold;
}
[data-theme="dark"] .highlight .ge {
  font-style: italic;
}
[data-theme="dark"] .highlight .ges {
  font-weight: bold;
  font-style: italic;
}
[data-theme="dark"] .highlight .gs {
  font-weight: bold;
}
[data-theme="dark"] .highlight .k, [data-theme="dark"] .highlight .kn, [data-theme="dark"] .highlight .kp, [data-theme="dark"] .highlight .kr, [data-theme="dark"] .highlight .kv {
  color: #ae81ff;
}
[data-theme="dark"] .highlight .kc {
  color: #fd971f;
}
[data-theme="dark"] .highlight .kt {
  color: #fd971f;
}
[data-theme="dark"] .highlight .kd {
  color: #fd971f;
}
[data-theme="dark"] .highlight .s, [data-theme="dark"] .highlight .sb, [data-theme="dark"] .highlight .sc, [data-theme="dark"] .highlight .dl, [data-theme="dark"] .highlight .sd, [data-theme="dark"] .highlight .s2, [data-theme="dark"] .highlight .sh, [data-theme="dark"] .highlight .sx, [data-theme="dark"] .highlight .s1 {
  color: #a6e22e;
}
[data-theme="dark"] .highlight .sa {
  color: #ae81ff;
}
[data-theme="dark"] .highlight .sr {
  color: #a1efe4;
}
[data-theme="dark"] .highlight .si {
  color: #cc6633;
}
[data-theme="dark"] .highlight .se {
  color: #cc6633;
}
[data-theme="dark"] .highlight .nn {
  color: #f4bf75;
}
[data-theme="dark"] .highlight .nc {
  color: #f4bf75;
}
[data-theme="dark"] .highlight .no {
  color: #f4bf75;
}
[data-theme="dark"] .highlight .na {
  color: #66d9ef;
}
[data-theme="dark"] .highlight .m, [data-theme="dark"] .highlight .mb, [data-theme="dark"] .highlight .mf, [data-theme="dark"] .highlight .mh, [data-theme="dark"] .highlight .mi, [data-theme="dark"] .highlight .il, [data-theme="dark"] .highlight .mo, [data-theme="dark"] .highlight .mx {
  color: #a6e22e;
}
[data-theme="dark"] .highlight .ss {
  color: #a6e22e;
}
/* keep code blocks on the site's code surface, not the theme's own bg */
.highlight, .highlight .w,
[data-theme="dark"] .highlight, [data-theme="dark"] .highlight .w {
  background: transparent;
}

/* Browser-extension install tiles (pages/extension.md) */
.ext-tiles {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}
.ext-tile {
  flex: 1 1 0;
  min-width: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1.5rem 1rem;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--bg-muted);
  text-decoration: none;
  color: var(--text);
  text-align: center;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.ext-tile:link,
.ext-tile:visited,
.ext-tile:hover,
.ext-tile:active {
  color: var(--text);
  text-decoration: none;
}
.ext-tile:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}
.ext-tile img {
  width: 64px;
  height: 64px;
  display: block;
}
.ext-tile .ext-name {
  font-weight: 600;
  font-size: 1.05rem;
}
.ext-tile .ext-cta {
  font-size: 0.85rem;
  color: var(--accent);
}
