/* =========================================================================
   Spatial Pipeline Engineering — design system
   Light, elegant, professional. Climate / satellite / carbon palette.
   ========================================================================= */

:root {
  /* Palette */
  --c-bg: #f4f7f5;
  --c-surface: #ffffff;
  --c-surface-2: #eef3f0;
  --c-primary: #0f6e63;
  --c-primary-700: #0d5a47;
  --c-primary-300: #2bb673;
  --c-secondary: #11839e;
  --c-secondary-700: #0c6076;
  --c-accent: #f3a712;
  --c-accent-700: #c9820a;
  --c-text: #16302a;
  --c-muted: #5a6b64;
  --c-border: #dce6e1;
  --c-code-bg: #f3f7f4;
  --c-code-border: #e0ebe5;
  --c-inline-bg: #e7f1ec;
  --c-inline-text: #0d5a47;

  /* Typography */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Code", "JetBrains Mono",
    Menlo, Consolas, "Liberation Mono", monospace;

  /* Layout */
  --maxw: 1440px;
  --header-h: 66px;
  --radius: 14px;
  --radius-sm: 9px;
  --gap: clamp(1rem, 2.5vw, 2rem);

  /* Effects */
  --shadow-sm: 0 1px 2px rgba(13, 90, 71, 0.06), 0 2px 8px rgba(13, 90, 71, 0.05);
  --shadow-md: 0 6px 18px rgba(13, 90, 71, 0.10), 0 2px 6px rgba(13, 90, 71, 0.06);
  --shadow-lg: 0 18px 40px rgba(13, 90, 71, 0.16);
  --ring: 0 0 0 3px rgba(17, 131, 158, 0.30);
  --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ------------------------------- Reset ---------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
* {
  margin: 0;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  font-family: var(--font-sans);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.65;
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.075rem);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img,
svg {
  display: block;
  max-width: 100%;
}
a {
  color: var(--c-secondary-700);
  text-decoration: none;
  transition: color var(--transition), background var(--transition);
}
a:hover {
  color: var(--c-primary);
}
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: 4px;
}

/* Account for the sticky header on in-page anchor jumps. */
:target {
  scroll-margin-top: calc(var(--header-h) + 14px);
}
h1[id],
h2[id],
h3[id],
h4[id],
h5[id],
h6[id] {
  scroll-margin-top: calc(var(--header-h) + 14px);
}

/* ----------------------------- Containers ------------------------------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.75rem);
}
.site-main {
  flex: 1 0 auto;
  width: 100%;
}

/* =============================== Header ================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--c-border);
}
.site-header__inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  color: var(--c-primary-700);
  letter-spacing: -0.01em;
}
.brand:hover {
  color: var(--c-primary);
}
.brand__logo {
  width: 38px;
  height: 38px;
  flex: none;
  filter: drop-shadow(0 1px 2px rgba(13, 90, 71, 0.25));
  transition: transform var(--transition);
}
.brand:hover .brand__logo {
  transform: rotate(-6deg) scale(1.05);
}
.brand__name {
  font-size: 1.06rem;
  line-height: 1.1;
}
.brand__name small {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--c-muted);
  letter-spacing: 0.02em;
}

/* Primary nav */
.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--c-text);
  white-space: nowrap;
  border: 1px solid transparent;
}
.nav__link .icon {
  width: 18px;
  height: 18px;
  flex: none;
}
.nav__link:hover {
  background: var(--c-surface-2);
  color: var(--c-primary-700);
}
.nav__link[aria-current="page"] {
  background: linear-gradient(120deg, rgba(17, 131, 158, 0.14), rgba(43, 182, 115, 0.16));
  color: var(--c-primary-700);
  border-color: var(--c-border);
}
.nav__link[aria-current="page"] .icon {
  filter: none;
}

/* Mobile toggle */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  background: var(--c-surface);
  cursor: pointer;
  color: var(--c-primary-700);
}
.nav-toggle:hover {
  background: var(--c-surface-2);
}

@media (max-width: 860px) {
  .nav-toggle {
    display: inline-flex;
  }
  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0.75rem clamp(1rem, 4vw, 2.75rem) 1.1rem;
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    box-shadow: var(--shadow-md);
    transform: translateY(-130%);
    transition: transform var(--transition);
    visibility: hidden;
  }
  .nav.is-open {
    transform: translateY(0);
    visibility: visible;
  }
  .nav__link {
    font-size: 1.02rem;
    padding: 0.7rem 0.85rem;
  }
}

/* =============================== Footer ================================= */
.site-footer {
  flex-shrink: 0;
  margin-top: 3.5rem;
  background: linear-gradient(180deg, var(--c-primary-700), #0a4537);
  color: #d9efe6;
}
.site-footer a {
  color: #d9efe6;
}
.site-footer a:hover {
  color: #ffffff;
}
.site-footer__inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2rem;
  padding-block: 2.5rem 1.25rem;
}
.site-footer__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.6rem;
}
.site-footer__brand img {
  width: 34px;
  height: 34px;
}
.site-footer__tag {
  color: #b6d8cc;
  max-width: 46ch;
  font-size: 0.95rem;
}
.footer-nav h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ec9bb;
  margin-bottom: 0.7rem;
}
.footer-nav ul {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}
.footer-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}
.footer-nav .icon {
  width: 16px;
  height: 16px;
  opacity: 0.9;
}
.site-footer__bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-block: 1rem 1.4rem;
  font-size: 0.85rem;
  color: #a9cdc0;
}
@media (max-width: 680px) {
  .site-footer__inner {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* =============================== Buttons ================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  font-weight: 650;
  font-size: 1rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition),
    background var(--transition);
}
.btn .icon {
  width: 20px;
  height: 20px;
  flex: none;
}
.btn--primary {
  background: linear-gradient(120deg, var(--c-secondary), var(--c-primary));
  color: #fff;
  box-shadow: var(--shadow-md);
}
.btn--primary:hover {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.btn--ghost {
  background: var(--c-surface);
  color: var(--c-primary-700);
  border-color: var(--c-border);
}
.btn--ghost:hover {
  color: var(--c-primary-700);
  background: var(--c-surface-2);
  transform: translateY(-2px);
}

/* =============================== Home ================================== */
.hero {
  position: relative;
  text-align: center;
  padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(1.5rem, 4vw, 3rem);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
      60% 55% at 50% 0%,
      rgba(17, 131, 158, 0.12),
      transparent 70%
    ),
    radial-gradient(50% 50% at 85% 30%, rgba(43, 182, 115, 0.12), transparent 70%);
  z-index: -1;
}
.hero__logo {
  width: clamp(110px, 18vw, 168px);
  height: clamp(110px, 18vw, 168px);
  margin: 0 auto 1.5rem;
  filter: drop-shadow(0 12px 26px rgba(13, 90, 71, 0.30));
  animation: floaty 7s ease-in-out infinite;
}
@keyframes floaty {
  50% {
    transform: translateY(-9px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .hero__logo {
    animation: none;
  }
  html {
    scroll-behavior: auto;
  }
}
.hero h1 {
  font-size: clamp(2rem, 1.2rem + 3vw, 3.6rem);
  line-height: 1.07;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, var(--c-secondary-700), var(--c-primary), var(--c-primary-300));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  max-width: 24ch;
  margin-inline: auto;
}
.hero__lead {
  margin: 1.2rem auto 0;
  max-width: 74ch;
  font-size: clamp(1.08rem, 1rem + 0.5vw, 1.3rem);
  color: var(--c-muted);
}
.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  justify-content: center;
  margin-top: 1.9rem;
}

.section {
  padding-block: clamp(1.75rem, 4vw, 3rem);
}
.section__head {
  max-width: 70ch;
  margin-bottom: 1.6rem;
}
.section__head h2 {
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2.1rem);
  letter-spacing: -0.01em;
  color: var(--c-primary-700);
}
.section__head p {
  margin-top: 0.5rem;
  color: var(--c-muted);
}
/* Intro band fills the container width: a single readable column on mobile,
   balanced feature columns on desktop (never a cramped narrow column). */
.prose-intro {
  display: grid;
  gap: 1.1rem 2.75rem;
  font-size: 1.08rem;
}
@media (min-width: 1000px) {
  .prose-intro {
    grid-template-columns: repeat(3, 1fr);
    align-items: start;
  }
}

/* Card grid for categories / articles */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition),
    border-color var(--transition);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--c-primary-300);
}
.card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(17, 131, 158, 0.16), rgba(43, 182, 115, 0.2));
  color: var(--c-primary-700);
  margin-bottom: 0.3rem;
}
.card__icon .icon {
  width: 28px;
  height: 28px;
}
.card h3 {
  font-size: 1.18rem;
  line-height: 1.25;
}
.card h3 a {
  color: var(--c-primary-700);
}
.card h3 a:hover {
  color: var(--c-secondary);
}
.card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
}
.card p {
  color: var(--c-muted);
  font-size: 0.97rem;
}
.card__more {
  margin-top: auto;
  font-weight: 650;
  color: var(--c-secondary-700);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.card__more .icon {
  width: 18px;
  height: 18px;
  transition: transform var(--transition);
}
.card:hover .card__more .icon {
  transform: translateX(3px);
}

/* Rich category cards contain their own links, so no full-card overlay. */
.card--rich h3 a::after {
  content: none;
}
.topic-links {
  list-style: none;
  padding: 0;
  margin: 0.3rem 0 0.4rem;
  display: grid;
  gap: 0.15rem;
  border-top: 1px solid var(--c-border);
  padding-top: 0.7rem;
}
.topic-links a {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.4rem;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 550;
  color: var(--c-text);
  line-height: 1.3;
}
.topic-links a:hover {
  background: var(--c-surface-2);
  color: var(--c-primary-700);
}
.topic-links .icon {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--c-primary-300);
}

/* =========================== Content page ============================== */
.page-shell {
  padding-block: 1.5rem 1rem;
}

/* Breadcrumbs */
.breadcrumbs {
  font-size: 0.9rem;
  color: var(--c-muted);
  margin-bottom: 1.25rem;
}
.breadcrumbs ol {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
}
.breadcrumbs li {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.breadcrumbs li:not(:last-child)::after {
  content: "›";
  color: var(--c-border);
  font-weight: 700;
}
.breadcrumbs a {
  color: var(--c-muted);
  font-weight: 600;
}
.breadcrumbs a:hover {
  color: var(--c-primary);
}
.breadcrumbs [aria-current="page"] {
  color: var(--c-primary-700);
  font-weight: 600;
}

/* Article layout: prose + related sidebar on wide screens */
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: clamp(1.5rem, 4vw, 3.25rem);
  align-items: start;
}
@media (max-width: 1024px) {
  .article-layout {
    grid-template-columns: 1fr;
  }
}

/* Prose — fills its column width on desktop, never a cramped column */
.prose {
  min-width: 0;
}
.prose > * + * {
  margin-top: 1.15rem;
}
.prose h1 {
  font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.75rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, var(--c-secondary-700), var(--c-primary-300));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 0.4rem;
}
.prose h2 {
  font-size: clamp(1.4rem, 1.15rem + 0.9vw, 1.85rem);
  letter-spacing: -0.01em;
  color: var(--c-primary-700);
  margin-top: 2.4rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--c-surface-2);
}
.prose h3 {
  font-size: 1.3rem;
  color: var(--c-secondary-700);
  margin-top: 1.9rem;
}
.prose h4 {
  font-size: 1.1rem;
  color: var(--c-primary-700);
  margin-top: 1.5rem;
}
.prose p,
.prose li {
  color: #233a33;
}
.prose ul,
.prose ol {
  padding-left: 1.4rem;
  display: grid;
  gap: 0.5rem;
}
.prose li {
  padding-left: 0.25rem;
}
.prose strong {
  color: var(--c-primary-700);
}
.prose blockquote {
  border-left: 4px solid var(--c-primary-300);
  background: var(--c-surface-2);
  padding: 0.8rem 1.1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: #2c4a41;
}

/* Prose links */
.prose a {
  color: var(--c-secondary-700);
  font-weight: 550;
  text-decoration: underline;
  text-decoration-color: rgba(17, 131, 158, 0.35);
  text-underline-offset: 2px;
  text-decoration-thickness: 1.5px;
}
.prose a:hover {
  color: var(--c-primary);
  text-decoration-color: var(--c-primary-300);
}

/* Header anchor link */
.header-anchor {
  margin-left: 0.4rem;
  font-weight: 600;
  color: var(--c-primary-300);
  opacity: 0;
  text-decoration: none;
  transition: opacity var(--transition);
}
h1:hover > .header-anchor,
h2:hover > .header-anchor,
h3:hover > .header-anchor,
h4:hover > .header-anchor,
h5:hover > .header-anchor {
  opacity: 1;
}

/* Inline code — subtle, borderless, blends with text */
.prose :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--c-inline-bg);
  color: var(--c-inline-text);
  padding: 0.12em 0.42em;
  border-radius: 6px;
  white-space: break-spaces;
}

/* Tables — styled + horizontal scroll on small screens */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
}
.prose table {
  border-collapse: collapse;
  width: 100%;
  min-width: 480px;
  font-size: 0.95rem;
}
.prose thead {
  background: linear-gradient(120deg, var(--c-primary-700), var(--c-primary));
  color: #fff;
}
.prose th,
.prose td {
  text-align: left;
  padding: 0.7rem 0.95rem;
  border-bottom: 1px solid var(--c-border);
  vertical-align: top;
}
.prose th {
  font-weight: 650;
  white-space: nowrap;
}
.prose tbody tr:nth-child(even) {
  background: var(--c-surface-2);
}
.prose tbody tr:hover {
  background: rgba(43, 182, 115, 0.08);
}

/* Task lists — real checkboxes, no bullet, line-through when checked */
.prose ul.contains-task-list {
  list-style: none;
  padding-left: 0.2rem;
}
.task-list-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding-left: 0 !important;
}
.task-list-item-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 1.15em;
  height: 1.15em;
  margin-top: 0.28em;
  border: 2px solid var(--c-primary-300);
  border-radius: 5px;
  background: var(--c-surface);
  cursor: pointer;
  flex: none;
  transition: background var(--transition), border-color var(--transition);
}
.task-list-item-checkbox:hover {
  border-color: var(--c-primary);
}
.task-list-item-checkbox:checked {
  background: var(--c-primary);
  border-color: var(--c-primary);
}
.task-list-item-checkbox:checked::after {
  content: "✓";
  display: block;
  color: #fff;
  font-size: 0.85em;
  line-height: 1;
  text-align: center;
  margin-top: 0.05em;
}
.task-list-item label {
  cursor: pointer;
}
.task-list-item:has(.task-list-item-checkbox:checked) label,
.task-list-item.is-checked label {
  text-decoration: line-through;
  color: var(--c-muted);
}

/* =============================== Code ================================== */
.prose pre[class*="language-"],
.prose pre {
  position: relative;
  background: var(--c-code-bg);
  border: 1px solid var(--c-code-border);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.1rem;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.6;
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
}
.prose pre code {
  font-family: var(--font-mono);
  background: none;
  padding: 0;
  color: #243b33;
  white-space: pre;
}

/* Copy button (injected by app.js) */
.code-block {
  position: relative;
}
.copy-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 650;
  font-family: var(--font-sans);
  color: var(--c-primary-700);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 0.32rem 0.55rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition),
    transform var(--transition);
}
.code-block:hover .copy-btn,
.copy-btn:focus-visible {
  opacity: 1;
}
.copy-btn:hover {
  background: #fff;
  transform: translateY(-1px);
}
.copy-btn .icon {
  width: 14px;
  height: 14px;
}
.copy-btn.is-copied {
  color: #fff;
  background: var(--c-primary);
  border-color: var(--c-primary);
  opacity: 1;
}

/* Prism light theme tuned to the palette */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: #6f8079;
  font-style: italic;
}
.token.punctuation {
  color: #5a6b64;
}
.token.keyword,
.token.boolean,
.token.atrule {
  color: #b3540e;
  font-weight: 600;
}
.token.string,
.token.char,
.token.attr-value,
.token.inserted {
  color: #0c6076;
}
.token.function,
.token.class-name {
  color: #8a4fb0;
}
.token.number,
.token.constant,
.token.symbol {
  color: #c9820a;
}
.token.operator,
.token.entity,
.token.url {
  color: #0d5a47;
}
.token.builtin,
.token.tag,
.token.selector,
.token.property {
  color: #0f6e63;
}
.token.regex,
.token.important,
.token.variable {
  color: #b3540e;
}
.token.deleted {
  color: #b00020;
}

/* Math (KaTeX) */
.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.4rem 0.2rem;
}

/* Mermaid — natural-size diagrams, centered, with horizontal scroll when wide */
.mermaid {
  overflow-x: auto;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.4rem 1.25rem;
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
}
.mermaid svg {
  display: block;
  margin-inline: auto;
  height: auto;
}
.mermaid:not([data-processed]) {
  min-height: 3rem;
  color: transparent;
}
/* Optional caption under a diagram: <p class="figure-caption">…</p> */
.figure-caption {
  margin-top: 0.6rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--c-muted);
  font-style: italic;
}

/* FAQ accordions (generated from FAQ sections by app.js) */
.faq-accordion {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}
.faq-item {
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.faq-item > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.95rem 1.1rem;
  font-weight: 650;
  color: var(--c-primary-700);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.faq-item > summary::-webkit-details-marker {
  display: none;
}
.faq-item > summary::after {
  content: "+";
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--c-primary-300);
  transition: transform var(--transition);
}
.faq-item[open] > summary::after {
  transform: rotate(45deg);
}
.faq-item__body {
  padding: 0 1.1rem 1.1rem;
  color: #233a33;
}
.faq-item__body > * + * {
  margin-top: 0.8rem;
}

/* ============================ Related nav ============================== */
.related {
  position: sticky;
  top: calc(var(--header-h) + 1.25rem);
  align-self: start;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.related h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-muted);
  margin-bottom: 0.85rem;
}
.related + .related {
  margin-top: 1.25rem;
}
.related ul {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.2rem;
}
.related a {
  display: block;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  font-weight: 550;
  color: var(--c-text);
  font-size: 0.94rem;
  line-height: 1.35;
}
.related a:hover {
  background: var(--c-surface-2);
  color: var(--c-primary-700);
}
.related a[aria-current="page"] {
  background: linear-gradient(120deg, rgba(17, 131, 158, 0.12), rgba(43, 182, 115, 0.14));
  color: var(--c-primary-700);
  font-weight: 650;
}

/* On-this-page TOC (built client-side, reuses .related card styling) */
.toc a {
  border-left: 2px solid transparent;
  border-radius: 0 8px 8px 0;
}
.toc a.is-active {
  background: linear-gradient(120deg, rgba(17, 131, 158, 0.12), rgba(43, 182, 115, 0.14));
  color: var(--c-primary-700);
  font-weight: 650;
  border-left-color: var(--c-primary-300);
}
.related__parent {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 650;
  color: var(--c-secondary-700);
  margin-bottom: 0.5rem;
}

@media (max-width: 1024px) {
  .related {
    position: static;
  }
}

/* Prev/next + child links shown under prose on narrow screens or as footer nav */
.subnav {
  margin-top: 2.5rem;
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.icon {
  display: inline-block;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Visually hidden but accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  background: var(--c-primary);
  color: #fff;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  z-index: 100;
  transition: top var(--transition);
}
.skip-link:focus {
  top: 0.5rem;
  color: #fff;
}
