/* =========================================================================
   Python for Drone Photogrammetry & Orthomosaic Pipelines
   Light, elegant, professional theme — geospatial teal with accent colors.
   ========================================================================= */

:root {
  /* Palette */
  --bg: #f5f9fb;
  --surface: #ffffff;
  --surface-2: #eef4f7;
  --surface-3: #e3eef3;
  --text: #16323d;
  --text-soft: #3c5560;
  --muted: #5f7682;
  --border: #d6e3ea;
  --border-strong: #bcd0da;

  --primary: #0e7490;
  --primary-600: #0a5a72;
  --primary-700: #084658;
  --primary-050: #e4f5f9;
  --primary-100: #c7e9f1;

  --accent-violet: #7c3aed;
  --accent-green: #15803d;
  --accent-gold: #d97706;
  --accent: var(--primary);

  /* Code */
  --code-bg: #f1f7f9;
  --code-border: #d9e7ec;
  --inline-bg: #e7f1f5;
  --inline-text: #0a5a72;

  /* Layout */
  --header-h: 66px;
  --container: 1480px;
  --content-max: 1320px;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(16, 51, 64, 0.06), 0 1px 3px rgba(16, 51, 64, 0.05);
  --shadow-md: 0 4px 16px rgba(16, 51, 64, 0.08), 0 2px 6px rgba(16, 51, 64, 0.05);
  --shadow-lg: 0 18px 50px rgba(11, 90, 114, 0.16);

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Fira Code", "Cascadia Code", ui-monospace, Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.075rem);
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 100% -10%, rgba(14, 116, 144, 0.07), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, rgba(124, 58, 237, 0.05), transparent 55%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: var(--primary-600); text-decoration: none; }

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  z-index: 200;
  background: var(--primary);
  color: #fff;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-sm);
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 0.5rem; }

/* ------------------------------------------------------------------ Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2rem);
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin-right: auto;
  color: var(--text);
}
.brand-logo { display: block; transition: transform 0.4s var(--ease); }
.brand:hover .brand-logo { transform: rotate(-8deg) scale(1.06); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 750; letter-spacing: -0.01em; font-size: 1.04rem; }
.brand-sub { font-size: 0.74rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }

.primary-nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  color: var(--text-soft);
  font-weight: 600;
  font-size: 0.94rem;
  border: 1px solid transparent;
  transition: color 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.nav-icon { display: inline-flex; width: 19px; height: 19px; color: var(--accent, var(--primary)); }
.nav-icon svg { width: 100%; height: 100%; }
.nav-link:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.nav-link.is-active {
  color: var(--primary-700);
  background: var(--primary-050);
  border-color: var(--primary-100);
}
.nav-link.is-active .nav-icon { color: var(--accent, var(--primary)); }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  cursor: pointer;
}
.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 20px;
  margin: 0 auto;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* -------------------------------------------------------------- Main / page */
.site-main { flex: 1 0 auto; width: 100%; }

/* --------------------------------------------------------------------- Hero */
.hero {
  max-width: var(--container);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 5rem) clamp(1rem, 3vw, 2rem) clamp(1.5rem, 3vw, 2.5rem);
  text-align: center;
}
.hero-inner { max-width: 980px; margin: 0 auto; }
.hero-logo { display: block; margin: 0 auto 1.5rem; }
.hero-logo img {
  width: clamp(120px, 18vw, 168px);
  height: auto;
  filter: drop-shadow(0 14px 30px rgba(11, 90, 114, 0.28));
  transition: transform 0.5s var(--ease);
}
.hero-logo img:hover { transform: translateY(-6px) scale(1.03); }
.hero-title {
  font-size: clamp(2rem, 1.3rem + 3.2vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  font-weight: 800;
  background: linear-gradient(120deg, var(--primary-700), var(--primary) 45%, var(--accent-violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-title-amp { color: var(--accent-gold); -webkit-text-fill-color: var(--accent-gold); }
.hero-lede {
  font-size: clamp(1.1rem, 1rem + 0.6vw, 1.4rem);
  color: var(--text);
  font-weight: 500;
  max-width: 56ch;
  margin: 0 auto 1.25rem;
}
.hero-text { color: var(--text-soft); max-width: 70ch; margin: 0 auto 1rem; }

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.85rem;
  margin-top: 2rem;
}
.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-weight: 650;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}
.cta-icon {
  display: inline-flex;
  width: 26px;
  height: 26px;
  padding: 4px;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 4px 10px color-mix(in srgb, var(--accent) 40%, transparent);
}
.cta-icon svg { width: 100%; height: 100%; }
.cta-arrow { color: var(--accent); transition: transform 0.25s var(--ease); }
.cta-button:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.cta-button:hover .cta-arrow { transform: translateX(4px); }

/* --------------------------------------------------------- Home: sections */
.home-sections {
  max-width: var(--container);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 3vw, 2rem) clamp(3rem, 6vw, 5rem);
}
.section-head { text-align: center; margin-bottom: 2.25rem; }
.section-head h2 {
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem);
  margin: 0 0 0.5rem;
  letter-spacing: -0.015em;
}
.section-head p { color: var(--muted); margin: 0; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr));
  gap: 1.4rem;
}
.section-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem 1.5rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}
.section-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 35%, transparent));
}
.section-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}
.section-card-head { display: flex; align-items: flex-start; gap: 0.8rem; margin-bottom: 0.75rem; }
.section-card-icon {
  flex: none;
  display: inline-flex;
  width: 46px;
  height: 46px;
  padding: 10px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #000));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent);
}
.section-card-icon svg { width: 100%; height: 100%; }
.section-card-head h3 { margin: 0; font-size: 1.18rem; line-height: 1.3; letter-spacing: -0.01em; }
.section-card-head h3 a { color: var(--text); }
.section-card-head h3 a:hover { color: var(--accent); }
.section-card-blurb { color: var(--text-soft); font-size: 0.96rem; margin: 0 0 1rem; }
.section-card-links { list-style: none; margin: 0 0 1.1rem; padding: 0; display: grid; gap: 0.35rem; }
.section-card-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.15rem 0;
}
.section-card-links a::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
  opacity: 0.6;
  transition: transform 0.2s var(--ease), opacity 0.2s var(--ease);
}
.section-card-links a:hover { color: var(--accent); }
.section-card-links a:hover::before { transform: scale(1.6); opacity: 1; }
.section-card-more {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  color: var(--accent);
}
.section-card-more span { transition: transform 0.25s var(--ease); }
.section-card-more:hover span { transform: translateX(4px); }

/* ----------------------------------------------------- Content page layout */
.content-layout {
  max-width: var(--container);
  margin: 0 auto;
  padding: clamp(1.25rem, 3vw, 2.25rem) clamp(1rem, 3vw, 2rem) 3rem;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 230px;
  gap: clamp(1.5rem, 3vw, 3rem);
  align-items: start;
}

.content-sidebar,
.content-toc {
  position: sticky;
  top: calc(var(--header-h) + 1.25rem);
  align-self: start;
  max-height: calc(100vh - var(--header-h) - 2.5rem);
  overflow-y: auto;
  font-size: 0.92rem;
}
.sidebar-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.85rem;
  font-weight: 750;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
}
.sidebar-heading-icon { display: inline-flex; width: 20px; height: 20px; }
.sidebar-heading-icon svg { width: 100%; height: 100%; }
.sidebar-root {
  display: block;
  font-weight: 650;
  color: var(--text);
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  margin-bottom: 0.35rem;
}
.sidebar-root:hover { background: var(--surface-2); }
.sidebar-root.is-current { background: var(--primary-050); color: var(--primary-700); }

.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-left: 0.7rem; padding-left: 0.6rem; border-left: 1px solid var(--border); }
.tree-item > a {
  display: block;
  padding: 0.32rem 0.6rem;
  border-radius: 8px;
  color: var(--text-soft);
  font-weight: 500;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.tree-item > a:hover { background: var(--surface-2); color: var(--text); }
.tree-item.is-current > a {
  background: var(--primary-050);
  color: var(--primary-700);
  font-weight: 700;
}

/* ----------------------------------------------------------- TOC (on page) */
.content-toc { font-size: 0.86rem; }
.toc-heading {
  margin: 0 0 0.6rem;
  font-weight: 750;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc a {
  display: block;
  padding: 0.22rem 0.7rem;
  color: var(--muted);
  border-left: 2px solid var(--border);
  line-height: 1.35;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.toc a.lvl-3 { padding-left: 1.4rem; font-size: 0.95em; }
.toc a:hover { color: var(--primary); }
.toc a.is-active { color: var(--primary-700); border-color: var(--primary); font-weight: 650; }

/* ------------------------------------------------------------- Breadcrumbs */
.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin: 0 0 1.25rem;
  padding: 0;
  font-size: 0.86rem;
}
.breadcrumbs li { display: inline-flex; align-items: center; gap: 0.3rem; }
.breadcrumbs li:not(:first-child)::before {
  content: "›";
  color: var(--muted);
  font-weight: 700;
}
.breadcrumbs a { color: var(--muted); font-weight: 500; }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs span[aria-current] { color: var(--text); font-weight: 650; }

/* ----------------------------------------------------------------- Article */
.article { min-width: 0; }
.article-body { max-width: var(--content-max); }

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4 {
  scroll-margin-top: calc(var(--header-h) + 1.25rem);
  line-height: 1.22;
  letter-spacing: -0.018em;
  position: relative;
}
.article-body h1 {
  font-size: clamp(1.85rem, 1.3rem + 2.2vw, 2.7rem);
  margin: 0 0 1.25rem;
  font-weight: 800;
  background: linear-gradient(115deg, var(--primary-700), var(--accent, var(--primary)) 60%, var(--accent-violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.article-body h2 {
  font-size: clamp(1.4rem, 1.1rem + 1.1vw, 1.85rem);
  margin: 2.4rem 0 0.9rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--surface-3);
  font-weight: 750;
  color: var(--primary-700);
}
.article-body h3 {
  font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.45rem);
  margin: 1.9rem 0 0.7rem;
  font-weight: 700;
  color: var(--text);
}
.article-body h4 {
  font-size: 1.12rem;
  margin: 1.5rem 0 0.6rem;
  font-weight: 700;
  color: var(--text-soft);
}
.article-body p { margin: 0 0 1.15rem; }
.article-body ul,
.article-body ol { margin: 0 0 1.2rem; padding-left: 1.4rem; }
.article-body li { margin: 0.3rem 0; }
.article-body li::marker { color: var(--primary); }

.article-body strong { color: var(--text); font-weight: 700; }

.article-body blockquote {
  margin: 1.5rem 0;
  padding: 0.9rem 1.25rem;
  border-left: 4px solid var(--primary);
  background: var(--primary-050);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-soft);
}
.article-body blockquote p:last-child { margin-bottom: 0; }

.article-body hr { border: none; border-top: 1px solid var(--border); margin: 2.25rem 0; }

/* Heading anchors */
.heading-anchor {
  position: absolute;
  left: -1.2em;
  padding-right: 0.4em;
  color: var(--border-strong);
  opacity: 0;
  text-decoration: none;
  transition: opacity 0.18s var(--ease), color 0.18s var(--ease);
}
.article-body h2:hover .heading-anchor,
.article-body h3:hover .heading-anchor,
.article-body h4:hover .heading-anchor { opacity: 1; color: var(--primary); }

/* --------------------------------------------------------------- In-content links */
.article-body a:not(.related-card) {
  color: var(--primary-600);
  font-weight: 550;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--primary) 35%, transparent);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1.5px;
  transition: color 0.18s var(--ease), text-decoration-color 0.18s var(--ease), background 0.18s var(--ease);
  border-radius: 3px;
}
.article-body a:not(.related-card):hover {
  color: var(--accent-violet);
  text-decoration-color: var(--accent-violet);
  background: color-mix(in srgb, var(--accent-violet) 8%, transparent);
}

/* --------------------------------------------------------------- Inline code */
.article-body :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--inline-bg);
  color: var(--inline-text);
  padding: 0.12em 0.42em;
  border-radius: 6px;
  border: none;
  white-space: break-spaces;
}

/* --------------------------------------------------------------- Code blocks */
.code-block {
  position: relative;
  margin: 1.5rem 0;
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  background: var(--code-bg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.code-block::before {
  content: attr(data-lang);
  position: absolute;
  top: 0;
  left: 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  padding: 0.3rem 0.75rem;
  border-bottom-right-radius: var(--radius-sm);
  border-right: 1px solid var(--code-border);
  border-bottom: 1px solid var(--code-border);
}
.code-block pre {
  margin: 0;
  padding: 2.35rem 1.25rem 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.65;
  tab-size: 4;
  background: transparent;
  color: #1f3d49;
}
.code-block code { font-family: inherit; background: none; padding: 0; }

.copy-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.6rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font: 600 0.74rem/1 var(--font-sans);
  color: var(--primary-700);
  background: var(--surface);
  border: 1px solid var(--code-border);
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease);
}
.code-block:hover .copy-btn,
.copy-btn:focus-visible { opacity: 1; transform: translateY(0); }
.copy-btn:hover { background: var(--primary-050); }
.copy-btn.is-copied { color: #fff; background: var(--accent-green); border-color: var(--accent-green); }

/* Prism light syntax tokens (tuned to the palette) */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #6a8794; font-style: italic; }
.token.punctuation { color: #4a6573; }
.token.namespace { opacity: 0.7; }
.token.property, .token.tag, .token.constant, .token.symbol, .token.deleted { color: #b5305f; }
.token.boolean, .token.number { color: #b25700; }
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin, .token.inserted { color: #0a7d6b; }
.token.operator, .token.entity, .token.url { color: #4a6573; }
.token.atrule, .token.attr-value, .token.keyword { color: #2563eb; }
.token.function, .token.class-name { color: #7c3aed; }
.token.regex, .token.important, .token.variable { color: #b25700; }
.token.important, .token.bold { font-weight: 700; }
.token.italic { font-style: italic; }

/* --------------------------------------------------------------- Tables */
.table-wrap {
  margin: 1.5rem 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
}
.table-wrap table {
  border-collapse: collapse;
  width: 100%;
  min-width: 520px;
  font-size: 0.93rem;
  background: var(--surface);
}
.table-wrap th,
.table-wrap td {
  padding: 0.7rem 1rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.table-wrap thead th {
  background: var(--primary-050);
  color: var(--primary-700);
  font-weight: 700;
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.table-wrap tbody tr { transition: background 0.15s var(--ease); }
.table-wrap tbody tr:nth-child(even) { background: var(--surface-2); }
.table-wrap tbody tr:hover { background: var(--primary-050); }
.table-wrap td code { white-space: nowrap; }

/* --------------------------------------------------------- Task list / checkboxes */
.article-body ul.contains-task-list,
.article-body .contains-task-list { list-style: none; padding-left: 0.2rem; }
.article-body li.task-list-item { display: flex; align-items: flex-start; gap: 0.6rem; margin: 0.5rem 0; }
.article-body li.task-list-item::marker { content: ""; }
.article-body li.task-list-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 1.2em;
  height: 1.2em;
  margin-top: 0.18em;
  border: 2px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  display: grid;
  place-content: center;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease);
}
.article-body li.task-list-item input[type="checkbox"]::before {
  content: "";
  width: 0.66em;
  height: 0.66em;
  transform: scale(0);
  transform-origin: center;
  transition: transform 0.15s var(--ease);
  box-shadow: inset 1em 1em #fff;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
.article-body li.task-list-item input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}
.article-body li.task-list-item input[type="checkbox"]:checked::before { transform: scale(1); }
.article-body li.task-list-item input[type="checkbox"]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 30%, transparent);
  outline-offset: 2px;
}
.article-body li.task-list-item label { cursor: pointer; }
.article-body li.task-list-item:has(input:checked) { color: var(--muted); }
.article-body li.task-list-item:has(input:checked) label { text-decoration: line-through; }

/* --------------------------------------------------------------- FAQ accordions */
.faq-accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin: 0.75rem 0;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.faq-accordion + .faq-accordion { margin-top: 0.6rem; }
.faq-accordion > summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.2rem;
  font-weight: 650;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: background 0.18s var(--ease);
}
.faq-accordion > summary::-webkit-details-marker { display: none; }
.faq-accordion > summary:hover { background: var(--surface-2); }
.faq-accordion > summary::after {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--primary);
  border-bottom: 2px solid var(--primary);
  transform: rotate(45deg);
  transition: transform 0.25s var(--ease);
}
.faq-accordion[open] > summary::after { transform: rotate(-135deg); }
.faq-accordion[open] > summary { background: var(--primary-050); color: var(--primary-700); }
.faq-body { padding: 0.4rem 1.2rem 1.1rem; color: var(--text-soft); }
.faq-body > :first-child { margin-top: 0; }
.faq-body > :last-child { margin-bottom: 0; }

/* --------------------------------------------------------------- Mermaid */
.mermaid {
  margin: 1.75rem 0 0.5rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}
.mermaid svg { max-width: 100%; height: auto; }
.mermaid:not([data-processed]) { color: transparent; min-height: 2rem; }

/* Figure caption: the italic line placed directly after a diagram */
.article-body .mermaid + p {
  max-width: 72ch;
  margin: 0 auto 1.75rem;
  text-align: center;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--muted);
}
.article-body .mermaid + p em { font-style: italic; }

/* --------------------------------------------------------------- KaTeX */
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 0.4rem 0; }
.article-body .katex { font-size: 1.05em; }
.article-body .katex-display > .katex { font-size: 1.15em; }

/* --------------------------------------------------------------- Related */
.related { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.related-group + .related-group { margin-top: 2rem; }
.related-heading {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 1rem;
  border: none;
  padding: 0;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 1rem;
}
.related-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}
.related-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--accent, var(--primary)) 40%, var(--border));
}
.related-title { font-weight: 700; color: var(--text); line-height: 1.3; }
.related-card:hover .related-title { color: var(--accent, var(--primary)); }
.related-summary { font-size: 0.86rem; color: var(--muted); line-height: 1.5; }

/* --------------------------------------------------------------- Footer */
.site-footer {
  flex-shrink: 0;
  margin-top: auto;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border-top: 1px solid var(--border);
}
.footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 2.5rem clamp(1rem, 3vw, 2rem) 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
}
.footer-brand { display: flex; align-items: center; gap: 0.8rem; max-width: 360px; }
.footer-name { margin: 0; font-weight: 750; }
.footer-tag { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.9rem; }
.footer-heading {
  margin: 0 0 0.7rem;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 750;
}
.footer-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.footer-nav a { color: var(--text-soft); font-weight: 500; }
.footer-nav a:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 0.18em; }
.footer-bottom {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.footer-bottom p { margin: 0; }

/* --------------------------------------------------------------- Responsive */
@media (max-width: 1080px) {
  .content-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .content-toc { display: none; }
}

@media (max-width: 820px) {
  :root { --header-h: 60px; }
  .nav-toggle { display: flex; }
  .primary-nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s var(--ease);
  }
  .primary-nav.is-open { max-height: 70vh; }
  .primary-nav ul { flex-direction: column; align-items: stretch; gap: 0.25rem; padding: 0.85rem clamp(1rem, 3vw, 2rem); }
  .nav-link { justify-content: flex-start; padding: 0.75rem 0.9rem; border-radius: 11px; }

  .content-layout { grid-template-columns: minmax(0, 1fr); }
  .content-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    margin-bottom: 0.5rem;
  }
}

@media (min-width: 1600px) {
  :root { --container: 1640px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
