:root {
  --ink: #0d1321;
  --deep: #1d2d44;
  --slate: #3e5c76;
  --denim: #748cab;
  --shell: #f0ebd8;
  --accent-cyan: #58b7cf;
  --accent-violet: #9c8aff;
  --surface: #ffffff;
  --border: #d7deeb;
  --shadow: 0 12px 32px rgba(13, 19, 33, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #f4f8fd;
  background-image: linear-gradient(180deg, #f9fbff 0%, #eff3fa 100%);
  color: var(--ink);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--deep);
}

.container {
  width: min(1280px, 94vw);
  margin: 0 auto;
}

main {
  flex: 1;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
  background: rgba(240, 235, 216, 0.9);
  border-bottom: 1px solid rgba(13, 19, 33, 0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  width: 100%;
  padding: 1rem clamp(1rem, 2.8vw, 2.25rem);
}

.logo {
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.nav-list {
  list-style: none;
  display: flex;
  gap: 0.8rem;
  margin: 0;
  padding: 0;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-list a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.48rem 0.76rem;
  border-radius: 999px;
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.nav-list a:hover {
  transform: translateY(-1px);
  background: rgba(61, 92, 118, 0.15);
  box-shadow: 0 4px 10px rgba(13, 19, 33, 0.08);
}

.nav-icon {
  width: 1.2rem;
  height: 1.2rem;
  display: inline-grid;
  place-items: center;
  color: #34506f;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.nav-label {
  line-height: 1.2;
}

.breadcrumbs {
  margin: 0 0 0.95rem;
}

.breadcrumbs-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  color: #3a5773;
  font-size: 0.9rem;
}

.article-shell .breadcrumbs-list {
  padding: 0.35rem 0.55rem;
  border: 1px solid rgba(116, 140, 171, 0.26);
  border-radius: 10px;
  background: rgba(245, 249, 255, 0.88);
}

.breadcrumbs-item {
  display: inline-flex;
  align-items: center;
}

.breadcrumbs-item:not(:last-child)::after {
  content: ">";
  margin-left: 0.45rem;
  color: #7a8fa7;
}

.breadcrumbs-item a {
  text-decoration: none;
  color: #355579;
  font-weight: 600;
}

.breadcrumbs-item a:hover {
  text-decoration: underline;
}

.breadcrumbs-item [aria-current="page"] {
  color: #2b435f;
  font-weight: 700;
}

.hero {
  margin-top: 3rem;
  margin-bottom: 2rem;
  background: radial-gradient(circle at top right, #748cab 0%, #3e5c76 42%, #1d2d44 100%);
  color: #f7fbff;
  border-radius: 28px;
  padding: clamp(1.6rem, 4vw, 3.25rem);
  box-shadow: var(--shadow);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  opacity: 0.88;
  margin: 0;
}

.hero h1 {
  margin: 0.8rem 0;
  line-height: 1.2;
  font-size: clamp(1.8rem, 4.4vw, 3rem);
}

.hero-copy {
  margin: 0;
  max-width: 72ch;
  color: #e4ebf7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  padding: 0.75rem 1.1rem;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button-primary {
  color: var(--ink);
  background: var(--shell);
  box-shadow: 0 8px 20px rgba(15, 18, 30, 0.22);
}

.button-ghost {
  color: #e6efff;
  border: 1px solid rgba(230, 239, 255, 0.5);
  background: rgba(255, 255, 255, 0.08);
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.4rem, 2.6vw, 2rem);
}

.section-heading p {
  margin: 0.4rem 0 0;
  color: var(--slate);
}

.cta-grid {
  margin-top: 1.2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.cta-card {
  display: block;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.15rem;
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(13, 19, 33, 0.05);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.cta-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.cta-card h3 {
  margin: 0.75rem 0 0.35rem;
  line-height: 1.25;
  font-size: 1.1rem;
}

.cta-card p {
  margin: 0;
  color: var(--slate);
}

.card-link {
  margin-top: 0.8rem;
  display: inline-block;
  font-weight: 700;
}

.icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
}

.icon-wrap svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.cta-card-blue .icon-wrap {
  background: rgba(62, 92, 118, 0.12);
  color: var(--deep);
}

.cta-card-cyan .icon-wrap {
  background: rgba(88, 183, 207, 0.16);
  color: #0d6f87;
}

.cta-card-violet .icon-wrap {
  background: rgba(156, 138, 255, 0.17);
  color: #5540d4;
}

.cta-card-sea .icon-wrap {
  background: rgba(13, 111, 135, 0.14);
  color: #0d6f87;
}

.cta-card-sea:hover {
  border-color: var(--accent-cyan);
}

.home-intro {
  margin: 1.5rem auto 0.5rem;
}

.home-intro p {
  max-width: 90ch;
  font-size: 1.08rem;
  line-height: 1.7;
  color: #2c3f57;
  margin: 0;
}

.topic-section {
  margin-top: 2.75rem;
  margin-bottom: 3rem;
}

.topic-directory {
  margin-top: 1.2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}

.topic-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.15rem 1.25rem 1.3rem;
  box-shadow: 0 4px 14px rgba(13, 19, 33, 0.05);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.topic-col:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--denim);
}

.topic-col h3 {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.topic-col h3 a {
  color: var(--slate);
  text-decoration: none;
}

.topic-col h3 a:hover {
  color: var(--deep);
}

.topic-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.topic-col li {
  border-top: 1px solid rgba(116, 140, 171, 0.18);
}

.topic-col li:first-child {
  border-top: 0;
}

.topic-col a {
  display: block;
  padding: 0.5rem 0;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.94rem;
  line-height: 1.35;
}

.topic-col li a:hover {
  color: var(--accent-cyan);
  filter: brightness(0.85);
}

.footer-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.1rem 1.6rem;
  padding-top: 1.8rem;
}

.footer-col ul {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.footer-col-head {
  font-size: 0.78rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #9fb6e4;
}

.footer-col li a {
  font-weight: 500;
  font-size: 0.88rem;
  line-height: 1.35;
}

.footer-nav a {
  color: #c7d7ff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}

.footer-nav a:hover {
  color: #f0ebd8;
  text-decoration: underline;
}

.cta-card-blue:hover {
  border-color: var(--denim);
}

.cta-card-cyan:hover {
  border-color: var(--accent-cyan);
}

.cta-card-violet:hover {
  border-color: var(--accent-violet);
}

.article-shell {
  margin-top: 2rem;
  margin-bottom: 3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: clamp(1rem, 3vw, 2rem);
  box-shadow: 0 10px 28px rgba(13, 19, 33, 0.06);
}

.article-shell h1,
.article-shell h2,
.article-shell h3 {
  color: var(--deep);
  line-height: 1.3;
}

.article-shell > h1 {
  font-size: clamp(2rem, 4vw, 2.9rem);
  margin-top: 0.25rem;
  margin-bottom: 1.2rem;
  letter-spacing: -0.01em;
  background: linear-gradient(120deg, #1d2d44 0%, #3e5c76 60%, #4f6d92 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-wrap: balance;
  position: relative;
  display: inline-block;
  filter: drop-shadow(0 8px 18px rgba(62, 92, 118, 0.2));
}

.article-shell > h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.25rem;
  width: min(230px, 100%);
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--denim) 0%, var(--accent-cyan) 55%, rgba(88, 183, 207, 0) 100%);
  transition: transform 220ms ease;
  transform-origin: left center;
}

.article-shell > h1:hover::after {
  transform: scaleX(1.05);
}

.article-shell h2,
.article-shell h3,
.article-shell h4 {
  position: relative;
  scroll-margin-top: 6rem;
}

.article-shell h2 {
  margin-top: 2rem;
  padding-bottom: 0.4rem;
}

.article-shell h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: min(180px, 38%);
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--denim) 0%, var(--accent-cyan) 70%, rgba(88, 183, 207, 0) 100%);
  transform-origin: left center;
  transition: transform 180ms ease;
}

.article-shell h2:hover::after {
  transform: scaleX(1.08);
}

.article-shell h3 {
  margin-top: 1.5rem;
  color: #2a4763;
}

.article-shell h4 {
  color: #365472;
}

.article-shell pre {
  background: linear-gradient(145deg, #f8fbff 0%, #eff4fb 100%);
  color: #1f3248;
  border: 1px solid rgba(116, 140, 171, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  border-radius: 12px;
  padding: 0.9rem;
  overflow-x: auto;
  position: relative;
}

.copy-code-button {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  border: 1px solid rgba(62, 92, 118, 0.35);
  background: rgba(255, 255, 255, 0.92);
  color: #24415e;
  border-radius: 999px;
  padding: 0.3rem 0.72rem;
  font-size: 0.78rem;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.copy-code-button:hover {
  transform: translateY(-1px);
  background: #ffffff;
  border-color: rgba(36, 65, 94, 0.45);
}

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

.copy-code-button.is-copied {
  background: rgba(88, 183, 207, 0.2);
  color: #0d6f87;
  border-color: rgba(88, 183, 207, 0.5);
}

.copy-code-button.is-error {
  background: rgba(156, 138, 255, 0.2);
  color: #553da5;
  border-color: rgba(156, 138, 255, 0.5);
}

.article-shell code {
  background: transparent;
  color: var(--ink);
  padding: 0;
  border-radius: 0;
  border: 0;
  font-family: inherit;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.article-shell pre code {
  color: #1f3248;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.article-shell pre .token.keyword,
.article-shell pre .token.atrule,
.article-shell pre .token.operator,
.article-shell pre .token.important {
  color: #355d9a;
}

.article-shell pre .token.string,
.article-shell pre .token.char,
.article-shell pre .token.attr-value,
.article-shell pre .token.regex {
  color: #0f7b6b;
}

.article-shell pre .token.number,
.article-shell pre .token.boolean,
.article-shell pre .token.constant {
  color: #a46016;
}

.article-shell pre .token.function,
.article-shell pre .token.class-name,
.article-shell pre .token.builtin {
  color: #6a4eb4;
}

.article-shell pre .token.comment,
.article-shell pre .token.prolog,
.article-shell pre .token.doctype,
.article-shell pre .token.cdata {
  color: #5b7690;
  font-style: italic;
}

.article-shell pre .token.punctuation {
  color: #48637d;
}

.article-shell pre .token.property,
.article-shell pre .token.parameter,
.article-shell pre .token.variable,
.article-shell pre .token.symbol {
  color: #7a3e83;
}

.article-shell .diagram {
  margin: 2rem 0;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(150deg, rgba(248, 251, 255, 0.92) 0%, rgba(238, 244, 253, 0.96) 100%);
  box-shadow: var(--shadow);
}

.article-shell .diagram svg {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
}

.article-shell .diagram svg text {
  font-family: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.article-shell .diagram figcaption {
  margin-top: 0.85rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--slate);
  text-align: center;
}

.article-shell .related {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.article-shell .faq-heading {
  margin-top: 2.25rem;
}

.article-shell .faq-item {
  margin: 0.95rem 0;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(116, 140, 171, 0.35);
  border-radius: 12px;
  background: linear-gradient(140deg, rgba(248, 251, 255, 0.9) 0%, rgba(240, 245, 253, 0.95) 100%);
}

.article-shell .faq-question {
  margin: 0;
  font-weight: 750;
  color: #1f3e5d;
}

.article-shell .faq-answer {
  margin: 0.45rem 0 0;
  color: #2d4b66;
}

.article-shell .checklist {
  list-style: none;
  margin-left: 0;
  padding-left: 0;
}

.article-shell .checklist-item {
  margin: 0.45rem 0;
}

.article-shell .checklist-label {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.55rem;
  cursor: pointer;
}

.article-shell .checklist-box {
  margin-top: 0.22rem;
  width: 1rem;
  height: 1rem;
  accent-color: #3e5c76;
  cursor: pointer;
}

.article-shell .checklist-text {
  color: inherit;
}

.article-shell .checklist-box:checked + .checklist-text {
  color: #4b657f;
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

.site-footer {
  margin-top: 2rem;
  background: #0e1625;
  color: #dce7fc;
}

.footer-inner {
  padding: 1.2rem 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-inner p {
  margin: 0.35rem 0;
}

.footer-inner a {
  color: #c7d7ff;
}

.footer-github {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  color: #c7d7ff;
  background: rgba(255, 255, 255, 0.04);
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
}

.footer-github:hover,
.footer-github:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  color: #f0ebd8;
  transform: translateY(-1px);
}

.footer-github:focus-visible {
  outline: 2px solid #748cab;
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.7rem;
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
  }

  .header-actions {
    width: 100%;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .nav-list {
    width: 100%;
    justify-content: flex-start;
    gap: 0.5rem;
  }

  .nav-list a {
    font-size: 0.88rem;
    padding: 0.42rem 0.62rem;
  }

  .breadcrumbs {
    margin-bottom: 0.75rem;
  }

  .breadcrumbs-list {
    font-size: 0.83rem;
  }
}


/* ==========================================================================
   Theme toggle control
   ========================================================================== */

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(29, 45, 68, 0.22);
  background: rgba(255, 255, 255, 0.55);
  color: #24415e;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease,
    transform 160ms ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.85);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}

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

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

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

/* ==========================================================================
   Dark theme
   ========================================================================== */

[data-theme="dark"] {
  --ink: #e7edf8;
  --deep: #cfe0f5;
  --slate: #a9bdd6;
  --denim: #8ba3c2;
  --shell: #1b2534;
  --accent-cyan: #6ec7de;
  --accent-violet: #b0a2ff;
  --surface: #141d2b;
  --border: #2b374a;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] body {
  background-color: #0b111b;
  background-image: linear-gradient(180deg, #0a1018 0%, #0e1622 100%);
}

[data-theme="dark"] .site-header {
  background: rgba(12, 19, 30, 0.88);
  border-bottom-color: rgba(220, 233, 255, 0.12);
}

[data-theme="dark"] .nav-icon {
  color: #9fb8d8;
}

[data-theme="dark"] .nav-list a:hover {
  background: rgba(159, 184, 216, 0.16);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .theme-toggle {
  border-color: rgba(220, 233, 255, 0.24);
  background: rgba(255, 255, 255, 0.07);
  color: #dbe7f8;
}

[data-theme="dark"] .theme-toggle:hover {
  background: rgba(255, 255, 255, 0.14);
}

[data-theme="dark"] .breadcrumbs-item:not(:last-child)::after {
  color: #8ea3bb;
}

[data-theme="dark"] .breadcrumbs-item a {
  color: #9cc4ef;
}

[data-theme="dark"] .breadcrumbs-item [aria-current="page"] {
  color: #cddcef;
}

[data-theme="dark"] .article-shell .breadcrumbs-list {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(180, 200, 226, 0.22);
  color: #b3c6dc;
}

[data-theme="dark"] .home-intro p {
  color: #b8c9de;
}

[data-theme="dark"] .article-shell h3 {
  color: #bdd3ea;
}

[data-theme="dark"] .article-shell h4 {
  color: #aac2da;
}

[data-theme="dark"] .article-shell pre {
  background: linear-gradient(145deg, #101a26 0%, #0d151f 100%);
  border-color: rgba(150, 175, 205, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: #dbe6f5;
}

[data-theme="dark"] .article-shell pre code {
  color: #dbe6f5;
}

[data-theme="dark"] .article-shell pre .token.keyword,
[data-theme="dark"] .article-shell pre .token.atrule,
[data-theme="dark"] .article-shell pre .token.operator,
[data-theme="dark"] .article-shell pre .token.important {
  color: #86b6f0;
}

[data-theme="dark"] .article-shell pre .token.string,
[data-theme="dark"] .article-shell pre .token.char,
[data-theme="dark"] .article-shell pre .token.attr-value,
[data-theme="dark"] .article-shell pre .token.regex {
  color: #64d1b4;
}

[data-theme="dark"] .article-shell pre .token.number,
[data-theme="dark"] .article-shell pre .token.boolean,
[data-theme="dark"] .article-shell pre .token.constant {
  color: #e0ab63;
}

[data-theme="dark"] .article-shell pre .token.function,
[data-theme="dark"] .article-shell pre .token.class-name,
[data-theme="dark"] .article-shell pre .token.builtin {
  color: #bda6f5;
}

[data-theme="dark"] .article-shell pre .token.comment,
[data-theme="dark"] .article-shell pre .token.prolog,
[data-theme="dark"] .article-shell pre .token.doctype,
[data-theme="dark"] .article-shell pre .token.cdata {
  color: #93aac2;
}

[data-theme="dark"] .article-shell pre .token.punctuation {
  color: #a7bdd4;
}

[data-theme="dark"] .article-shell pre .token.property,
[data-theme="dark"] .article-shell pre .token.parameter,
[data-theme="dark"] .article-shell pre .token.variable,
[data-theme="dark"] .article-shell pre .token.symbol {
  color: #e5a3ef;
}

[data-theme="dark"] .copy-code-button {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(180, 200, 226, 0.32);
  color: #d9e6f7;
}

[data-theme="dark"] .copy-code-button:hover {
  background: rgba(255, 255, 255, 0.17);
  border-color: rgba(200, 218, 240, 0.5);
}

[data-theme="dark"] .copy-code-button.is-copied {
  background: rgba(110, 199, 222, 0.22);
  color: #8fdcef;
}

[data-theme="dark"] .copy-code-button.is-error {
  background: rgba(176, 162, 255, 0.22);
  color: #c3b6ff;
}

[data-theme="dark"] .article-shell .faq-item {
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.045) 0%, rgba(255, 255, 255, 0.02) 100%);
  border-color: rgba(160, 185, 215, 0.3);
}

[data-theme="dark"] .article-shell .faq-question {
  color: #cfe0f5;
}

[data-theme="dark"] .article-shell .faq-answer {
  color: #b5c9df;
}

[data-theme="dark"] .article-shell .checklist-box {
  accent-color: #6ec7de;
}

[data-theme="dark"] .article-shell .checklist-box:checked + .checklist-text {
  color: #93a8c0;
}

[data-theme="dark"] .cta-card-blue .icon-wrap {
  background: rgba(139, 163, 194, 0.2);
  color: #bfd4ec;
}

[data-theme="dark"] .cta-card-cyan .icon-wrap,
[data-theme="dark"] .cta-card-sea .icon-wrap {
  background: rgba(110, 199, 222, 0.2);
  color: #8fdcef;
}

[data-theme="dark"] .cta-card-violet .icon-wrap {
  background: rgba(176, 162, 255, 0.2);
  color: #c3b6ff;
}

[data-theme="dark"] .topic-col li {
  border-top-color: rgba(160, 185, 215, 0.2);
}

[data-theme="dark"] .topic-col li a:hover {
  color: var(--accent-cyan);
  filter: brightness(1.12);
}

[data-theme="dark"] .site-footer {
  background: #080d15;
}

/* --- inline diagrams: remap the baked palette so SVG interiors follow the theme --- */

[data-theme="dark"] .article-shell .diagram {
  background: linear-gradient(150deg, #101927 0%, #0d151f 100%);
  border-color: rgba(160, 185, 215, 0.26);
}

[data-theme="dark"] .article-shell .diagram svg {
  color: #8ba3c2;
}

[data-theme="dark"] .article-shell .diagram svg [fill="#f7fafe"]:not(text):not(tspan) {
  fill: #0f1825;
}

[data-theme="dark"] .article-shell .diagram svg [fill="#ffffff"]:not(text):not(tspan) {
  fill: #18222f;
}

[data-theme="dark"] .article-shell .diagram svg [fill="#eef3fb"]:not(text):not(tspan) {
  fill: #1b2635;
}

[data-theme="dark"] .article-shell .diagram svg rect[fill="#f0ebd8"],
[data-theme="dark"] .article-shell .diagram svg circle[fill="#f0ebd8"],
[data-theme="dark"] .article-shell .diagram svg ellipse[fill="#f0ebd8"],
[data-theme="dark"] .article-shell .diagram svg path[fill="#f0ebd8"],
[data-theme="dark"] .article-shell .diagram svg polygon[fill="#f0ebd8"] {
  fill: #2c3446;
}

[data-theme="dark"] .article-shell .diagram svg [fill="#e3f3f7"]:not(text):not(tspan) {
  fill: #113642;
}

[data-theme="dark"] .article-shell .diagram svg [fill="#f7ede9"]:not(text):not(tspan) {
  fill: #35232a;
}

[data-theme="dark"] .article-shell .diagram svg [fill="#efeafe"]:not(text):not(tspan) {
  fill: #262048;
}

[data-theme="dark"] .article-shell .diagram svg [fill="#c3d0e4"]:not(text):not(tspan) {
  fill: #3b4c67;
}

[data-theme="dark"] .article-shell .diagram svg rect[fill="#1d2d44"],
[data-theme="dark"] .article-shell .diagram svg circle[fill="#1d2d44"],
[data-theme="dark"] .article-shell .diagram svg ellipse[fill="#1d2d44"],
[data-theme="dark"] .article-shell .diagram svg path[fill="#1d2d44"],
[data-theme="dark"] .article-shell .diagram svg polygon[fill="#1d2d44"] {
  fill: #223759;
}

[data-theme="dark"] .article-shell .diagram svg rect[fill="#3e5c76"],
[data-theme="dark"] .article-shell .diagram svg circle[fill="#3e5c76"],
[data-theme="dark"] .article-shell .diagram svg ellipse[fill="#3e5c76"],
[data-theme="dark"] .article-shell .diagram svg path[fill="#3e5c76"],
[data-theme="dark"] .article-shell .diagram svg polygon[fill="#3e5c76"] {
  fill: #3f5c7c;
}

[data-theme="dark"] .article-shell .diagram svg rect[fill="#0d1321"] {
  fill: #1b2432;
}

[data-theme="dark"] .article-shell .diagram svg rect[fill="#134a5c"],
[data-theme="dark"] .article-shell .diagram svg path[fill="#134a5c"],
[data-theme="dark"] .article-shell .diagram svg polygon[fill="#134a5c"] {
  fill: #175a70;
}

[data-theme="dark"] .article-shell .diagram svg rect[fill="#5b6b80"],
[data-theme="dark"] .article-shell .diagram svg path[fill="#5b6b80"],
[data-theme="dark"] .article-shell .diagram svg polygon[fill="#5b6b80"] {
  fill: #6a7d94;
}

/* Text: light-on-dark labels keep their colour; dark-on-light labels lighten. */

[data-theme="dark"] .article-shell .diagram svg text[fill="#1d2d44"],
[data-theme="dark"] .article-shell .diagram svg tspan[fill="#1d2d44"] {
  fill: #dce7f8;
}

[data-theme="dark"] .article-shell .diagram svg text[fill="#3e5c76"],
[data-theme="dark"] .article-shell .diagram svg tspan[fill="#3e5c76"] {
  fill: #adc4dd;
}

[data-theme="dark"] .article-shell .diagram svg text[fill="#5b6b80"],
[data-theme="dark"] .article-shell .diagram svg tspan[fill="#5b6b80"] {
  fill: #a3b6cc;
}

[data-theme="dark"] .article-shell .diagram svg text[fill="#134a5c"],
[data-theme="dark"] .article-shell .diagram svg tspan[fill="#134a5c"] {
  fill: #8bd8ec;
}

[data-theme="dark"] .article-shell .diagram svg text[fill="#0d6f87"],
[data-theme="dark"] .article-shell .diagram svg tspan[fill="#0d6f87"] {
  fill: #79d4ea;
}

[data-theme="dark"] .article-shell .diagram svg text[fill="#b23a48"],
[data-theme="dark"] .article-shell .diagram svg tspan[fill="#b23a48"] {
  fill: #ff9d9d;
}

[data-theme="dark"] .article-shell .diagram svg text[fill="#1f6b45"],
[data-theme="dark"] .article-shell .diagram svg tspan[fill="#1f6b45"] {
  fill: #71dcaa;
}

[data-theme="dark"] .article-shell .diagram svg text[fill="#a46016"],
[data-theme="dark"] .article-shell .diagram svg tspan[fill="#a46016"] {
  fill: #e3ad63;
}

[data-theme="dark"] .article-shell .diagram svg text[fill="#748cab"],
[data-theme="dark"] .article-shell .diagram svg tspan[fill="#748cab"] {
  fill: #a5b8d1;
}

/* Strokes: hairlines and dark connectors need lifting off the dark canvas. */

[data-theme="dark"] .article-shell .diagram svg [stroke="#d7deeb"] {
  stroke: #31405a;
}

[data-theme="dark"] .article-shell .diagram svg [stroke="#cdd8ec"] {
  stroke: #3d4d6b;
}

[data-theme="dark"] .article-shell .diagram svg [stroke="#1d2d44"] {
  stroke: #90a8c6;
}

[data-theme="dark"] .article-shell .diagram svg [stroke="#0d1321"] {
  stroke: #9db3cd;
}

[data-theme="dark"] .article-shell .diagram svg [stroke="#3e5c76"] {
  stroke: #86a1bf;
}

[data-theme="dark"] .article-shell .diagram svg [stroke="#748cab"] {
  stroke: #8ba3c2;
}

[data-theme="dark"] .article-shell .diagram svg [stroke="#5b6b80"] {
  stroke: #8395ab;
}

[data-theme="dark"] .article-shell .diagram svg [stroke="#eef3fb"] {
  stroke: #1b2635;
}

/* Arrowheads inside <marker> follow their own fill; lift the muted one. */

[data-theme="dark"] .article-shell .diagram svg marker path[fill="#748cab"],
[data-theme="dark"] .article-shell .diagram svg marker polygon[fill="#748cab"] {
  fill: #8ba3c2;
}

[data-theme="dark"] .article-shell > h1 {
  background: linear-gradient(120deg, #dfeaf9 0%, #b9d0ea 55%, #8fc6dd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.45));
}

[data-theme="dark"] .article-shell .diagram svg g[fill="#1d2d44"] > text,
[data-theme="dark"] .article-shell .diagram svg g[fill="#1d2d44"] > tspan {
  fill: #dce7f8;
}

[data-theme="dark"] .article-shell .diagram svg g[fill="#3e5c76"] > text,
[data-theme="dark"] .article-shell .diagram svg g[fill="#3e5c76"] > tspan {
  fill: #adc4dd;
}

[data-theme="dark"] .article-shell .diagram svg g[fill="#5b6b80"] > text,
[data-theme="dark"] .article-shell .diagram svg g[fill="#0d6f87"] > text {
  fill: #a9c6dc;
}
