/*
 * Foundry Base CSS
 * Provides fallback values for --foundry-* CSS variables when theme-shield
 * is not loaded. Sites using theme-shield do not need this file — theme.css
 * overrides these values. Sites WITHOUT theme-shield get clean neutral defaults.
 *
 * Load this BEFORE any block CSS. theme-shield's theme.css loads after and
 * overrides these automatically via cascade.
 */

:root {
  /* These are intentionally minimal neutral defaults — not a full theme */
  --foundry-bg: #ffffff;
  --foundry-surface: #ffffff;
  --foundry-surface-soft: #f8fafc;
  --foundry-text: #0f172a;
  --foundry-text-muted: #475569;
  --foundry-border: #e2e8f0;
  --foundry-border-strong: #cbd5e1;
  --foundry-brand-primary: #0f172a;
  --foundry-brand-accent: #3b82f6;
  --foundry-font-family-heading: inherit;
  --foundry-font-family-body: inherit;
  --foundry-font-family-ui: var(--foundry-font-family-body, inherit);
  --foundry-type-display-size: 3.25rem;
  --foundry-type-headline-size: 2.35rem;
  --foundry-type-section-size: 1.85rem;
  --foundry-type-item-size: 1.35rem;
  --foundry-type-body-size: 1rem;
  --foundry-type-meta-size: 0.78rem;
  --foundry-type-display-line-height: 1.04;
  --foundry-type-body-line-height: 1.68;
  --foundry-type-measure: 42rem;
  --foundry-type-meta-tracking: 0.12em;
  --foundry-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --foundry-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --foundry-radius-sm: 0.5rem;
  --foundry-radius: 1rem;
  --foundry-radius-lg: 1.5rem;
  --foundry-ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --foundry-duration-base: 200ms;
  /* Shared stacking contract. Downstream themes may raise the full scale, but
     overlays and modals must remain above sticky headers and popovers. */
  --foundry-layer-base: 0;
  --foundry-layer-sticky: 30;
  --foundry-layer-nav-backdrop: 35;
  --foundry-layer-header: 40;
  --foundry-layer-popover: 60;
  --foundry-layer-overlay: 100;
  --foundry-layer-modal: 120;
  --foundry-header-height: 0px;
  --foundry-scroll-offset-gap: 1rem;
  --foundry-scroll-offset: calc(var(--foundry-header-height) + var(--foundry-scroll-offset-gap));
  --foundry-toc-progress-track: color-mix(in srgb, var(--foundry-border, #e2e8f0) 88%, transparent);
  --foundry-toc-progress-bar: var(--foundry-brand-accent, #3b82f6);
  --foundry-toc-progress-width: 0%;
  --foundry-toc-link-marker: color-mix(in srgb, var(--foundry-text-muted, #475569) 58%, transparent);
  --foundry-toc-link-marker-active: var(--foundry-brand-accent, #3b82f6);
  --foundry-toc-link-marker-complete: color-mix(in srgb, var(--foundry-brand-accent, #3b82f6) 62%, transparent);
  --foundry-toc-link-active-bg: color-mix(in srgb, var(--foundry-brand-accent, #3b82f6) 12%, transparent);
  --foundry-toc-link-active-text: var(--foundry-text, #0f172a);
  --foundry-toc-link-complete-text: color-mix(in srgb, var(--foundry-text-muted, #475569) 82%, transparent);
  --foundry-toc-toggle-bg: color-mix(in srgb, var(--foundry-surface-soft, #f8fafc) 88%, transparent);
  --foundry-toc-toggle-border: color-mix(in srgb, var(--foundry-border, #e2e8f0) 92%, transparent);
  --foundry-cta-panel-bg: var(--foundry-surface-soft, #f8fafc);
  --foundry-cta-panel-border: var(--foundry-border, #e2e8f0);
  --foundry-cta-panel-shadow: var(--foundry-shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1));
  --foundry-cta-title-color: var(--foundry-text, #0f172a);
  --foundry-cta-text-color: var(--foundry-text-muted, #475569);
  --foundry-media-radius: var(--foundry-media-radius-default, var(--foundry-radius-lg, 1.5rem));
  --foundry-media-frame-bg: var(--foundry-media-frame-bg-default, var(--foundry-surface, #ffffff));
  --foundry-media-caption-color: var(--foundry-media-caption-color-default, var(--foundry-text-muted, #475569));
  --foundry-media-border: var(--foundry-media-border-default, var(--foundry-border, #e2e8f0));
  --foundry-media-shadow: var(--foundry-media-shadow-default, var(--foundry-shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1)));
}

html {
  scroll-padding-top: var(--foundry-scroll-offset, 0px);
}

.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;
}

:where(h1, h2, h3, h4, h5, h6)[id],
[data-foundry-anchor-target="true"] {
  scroll-margin-top: var(--foundry-scroll-offset, 0px);
}

.foundry-media-text__image {
  display: block;
  max-width: 100%;
}

/*
 * Portable math notation
 * MathML inherits the surrounding type and color. The wrappers provide only
 * layout safety so themes can refine presentation without replacing markup.
 */
.foundry-math {
  color: inherit;
  font-family: inherit;
  font-size: 1em;
}

.foundry-math--inline {
  display: inline-block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  vertical-align: -0.15em;
}

.foundry-math--display {
  display: block;
  contain: inline-size;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin-block: 1.5em;
  overflow-x: auto;
  overflow-y: hidden;
  text-align: center;
  -webkit-overflow-scrolling: touch;
}

.foundry-math--display > math {
  width: max-content;
  min-width: min-content;
  margin-inline: auto;
}

@media (forced-colors: active) {
  .foundry-math {
    color: CanvasText;
    forced-color-adjust: auto;
  }
}

@media print {
  .foundry-math {
    break-inside: avoid;
  }

  .foundry-math--display {
    overflow: visible;
  }
}

.foundry-header {
  position: sticky;
  top: 0;
  z-index: var(--foundry-layer-header, 40);
  border-bottom: 1px solid color-mix(in srgb, var(--foundry-border, #e2e8f0) 76%, transparent);
  background: color-mix(in srgb, var(--foundry-surface, #ffffff) 92%, transparent);
  color: var(--foundry-text, #0f172a);
  backdrop-filter: blur(16px);
}

.foundry-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  max-width: var(--foundry-shell-max-width, 72rem);
  margin: 0 auto;
  padding: 0.95rem 1.5rem;
}

.foundry-brand {
  min-width: 0;
  color: inherit;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.1;
  text-decoration: none;
}

.foundry-brand:hover,
.foundry-brand:focus-visible {
  color: var(--foundry-brand-primary, #0f172a);
}

.foundry-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid color-mix(in srgb, var(--foundry-border, #e2e8f0) 88%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--foundry-surface, #ffffff) 94%, transparent);
  color: inherit;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  cursor: pointer;
}

.foundry-nav > ul,
.foundry-subnav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.foundry-nav > ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
}

.foundry-nav-item {
  position: relative;
}

.foundry-nav a,
.foundry-nav-label {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  border-radius: 999px;
  color: var(--foundry-text-muted, #475569);
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1.1;
  padding: 0.55rem 0.8rem;
  text-decoration: none;
  transition:
    background var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease),
    color var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease);
}

.foundry-nav a:hover,
.foundry-nav a:focus-visible,
.foundry-nav-label:hover,
.foundry-nav-label:focus-visible {
  background: color-mix(in srgb, var(--foundry-brand-primary, #0f172a) 7%, transparent);
  color: var(--foundry-text, #0f172a);
}

.foundry-nav-parent {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
}

.foundry-subnav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--foundry-text-muted, #475569);
  cursor: pointer;
}

.foundry-subnav {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: var(--foundry-layer-popover, 60);
  isolation: isolate;
  display: none;
  min-width: 12rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0.85rem 0.4rem 0.4rem;
}

.foundry-subnav::before {
  position: absolute;
  inset: 0.45rem 0 0;
  z-index: -1;
  border: 1px solid color-mix(in srgb, var(--foundry-border, #e2e8f0) 88%, transparent);
  border-radius: 0.85rem;
  background: var(--foundry-surface, #ffffff);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.12);
  content: "";
}

.foundry-nav-item.is-open > .foundry-subnav,
.foundry-nav-item.is-submenu-open > .foundry-subnav {
  display: grid;
}

.foundry-subnav a {
  width: 100%;
  border-radius: 0.6rem;
}

.foundry-search-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.65rem;
  height: 2.65rem;
  border: 1px solid color-mix(in srgb, var(--foundry-border, #e2e8f0) 88%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--foundry-surface, #ffffff) 94%, transparent);
  color: var(--foundry-text-muted, #475569);
  text-decoration: none;
  box-shadow: var(--foundry-shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1));
  transition:
    border-color var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease),
    color var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease),
    transform var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease);
}

.foundry-search-trigger:hover,
.foundry-search-trigger:focus-visible {
  border-color: color-mix(in srgb, var(--foundry-brand-primary, #0f172a) 24%, var(--foundry-border, #e2e8f0));
  color: var(--foundry-text, #0f172a);
  transform: translateY(-1px);
}

.foundry-search-trigger__icon,
.foundry-search-trigger__svg {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
}

.foundry-search-trigger__svg {
  stroke-width: 1.9;
}

.foundry-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  border: 1px solid transparent;
  border-radius: var(--foundry-button-radius, 999px);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.1;
  padding: 0.78rem 1.15rem;
  text-align: center;
  text-decoration: none;
  transition:
    background var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease),
    border-color var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease),
    color var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease),
    transform var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease);
}

.foundry-button:hover,
.foundry-button:focus-visible {
  transform: translateY(-1px);
}

.foundry-button--primary {
  background: var(--foundry-button-primary-bg, var(--foundry-brand-primary, #0f172a));
  color: var(--foundry-button-primary-text, #ffffff);
  box-shadow: var(--foundry-button-primary-shadow, var(--foundry-shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1)));
}

.foundry-button--primary:hover,
.foundry-button--primary:focus-visible {
  background: var(--foundry-button-primary-hover-bg, color-mix(in srgb, var(--foundry-brand-primary, #0f172a) 88%, white));
  color: var(--foundry-button-primary-hover-text, #ffffff);
}

.foundry-button--secondary {
  border-color: var(--foundry-button-secondary-border, var(--foundry-border-strong, #cbd5e1));
  background: var(--foundry-button-secondary-bg, color-mix(in srgb, var(--foundry-surface, #ffffff) 88%, transparent));
  color: var(--foundry-button-secondary-text, var(--foundry-text, #0f172a));
}

.foundry-button--secondary:hover,
.foundry-button--secondary:focus-visible {
  border-color: var(--foundry-button-secondary-hover-border, color-mix(in srgb, var(--foundry-brand-primary, #0f172a) 28%, var(--foundry-border-strong, #cbd5e1)));
  background: var(--foundry-button-secondary-hover-bg, color-mix(in srgb, var(--foundry-surface-soft, #f8fafc) 82%, transparent));
  color: var(--foundry-button-secondary-hover-text, var(--foundry-text, #0f172a));
}

.foundry-button--ghost {
  background: transparent;
  color: var(--foundry-button-ghost-text, var(--foundry-text, #0f172a));
}

.foundry-button--ghost:hover,
.foundry-button--ghost:focus-visible {
  background: var(--foundry-button-ghost-hover-bg, color-mix(in srgb, var(--foundry-brand-primary, #0f172a) 7%, transparent));
  color: var(--foundry-button-ghost-hover-text, var(--foundry-text, #0f172a));
}

.foundry-cta__panel--framed {
  border: 1px solid var(--foundry-cta-panel-border, var(--foundry-border, #e2e8f0));
  background: var(--foundry-cta-panel-bg, var(--foundry-surface-soft, #f8fafc));
  box-shadow: var(--foundry-cta-panel-shadow, var(--foundry-shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1)));
}

@media (max-width: 48rem) {
  html.foundry-nav-open,
  body.foundry-nav-open {
    overflow: hidden;
    overscroll-behavior: none;
  }

  body.foundry-nav-open::before {
    position: fixed;
    inset: 0;
    z-index: var(--foundry-layer-nav-backdrop, 35);
    background: rgba(15, 23, 42, 0.36);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    content: "";
  }

  .foundry-header.is-menu-open {
    z-index: var(--foundry-layer-header, 40);
  }

  .foundry-header__inner {
    flex-wrap: wrap;
    gap: 0.85rem;
    padding: 0.85rem 1.25rem;
  }

  .foundry-nav-toggle {
    display: inline-flex;
  }

  .foundry-nav {
    display: none;
    width: 100%;
  }

  .foundry-nav.is-open {
    display: block;
    max-height: calc(100dvh - var(--foundry-header-height, 4.75rem) - max(0.75rem, env(safe-area-inset-bottom)));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .foundry-nav > ul {
    display: grid;
    justify-content: stretch;
    gap: 0.25rem;
  }

  .foundry-nav a,
  .foundry-nav-label {
    width: 100%;
    justify-content: space-between;
    border-radius: 0.7rem;
    padding-inline: 0.75rem;
  }

  .foundry-nav-parent {
    display: flex;
    justify-content: space-between;
  }

  .foundry-subnav-toggle {
    width: 2.75rem;
    height: 2.75rem;
  }

  .foundry-subnav {
    position: static;
    min-width: 0;
    margin: 0.25rem 0 0.35rem 0.75rem;
    border: 0;
    border-left: 1px solid color-mix(in srgb, var(--foundry-border, #e2e8f0) 82%, transparent);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: 0.2rem 0 0.2rem 0.45rem;
  }

  .foundry-subnav::before {
    content: none;
  }
}

.foundry-breadcrumbs {
  color: var(--foundry-breadcrumbs-text, var(--foundry-text-muted, #475569));
  font-size: 0.875rem;
  line-height: 1.4;
}

.foundry-breadcrumbs__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  max-width: var(--foundry-breadcrumbs-max-width, 72rem);
  margin: 0 auto;
  padding: var(--foundry-breadcrumbs-padding, 1rem 1.5rem);
  list-style: none;
}

.foundry-breadcrumbs__item {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 0.35rem;
}

.foundry-breadcrumbs__separator {
  color: color-mix(in srgb, currentColor 48%, transparent);
}

.foundry-breadcrumbs__link {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 0.2em;
  transition: color var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease);
}

.foundry-breadcrumbs__link:hover,
.foundry-breadcrumbs__link:focus-visible {
  color: var(--foundry-breadcrumbs-link-hover, var(--foundry-text, #0f172a));
  text-decoration: underline;
}

.foundry-breadcrumbs__current {
  overflow: hidden;
  max-width: min(26rem, 70vw);
  color: var(--foundry-breadcrumbs-current, var(--foundry-text, #0f172a));
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.foundry-features__item-link {
  color: inherit;
  text-decoration: none;
}

.foundry-features__item-link:hover,
.foundry-features__item-link:focus-visible {
  text-decoration: none;
}

.foundry-features__item-cta {
  color: var(--foundry-brand-primary, #0f172a);
  transition: color var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease);
}

.foundry-table-of-contents__widget {
  --foundry-toc-progress: 0;
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  color: var(--foundry-text, #0f172a);
}

.foundry-table-of-contents__widget--chapter-index {
  border-radius: 0.5rem;
}

.foundry-table-of-contents__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.9rem;
}

.foundry-table-of-contents__title-wrap {
  min-width: 0;
}

.foundry-table-of-contents__title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
}

.foundry-table-of-contents__toggle {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  width: 100%;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--foundry-toc-toggle-border);
  border-radius: 0.95rem;
  background: var(--foundry-toc-toggle-bg);
  color: var(--foundry-text, #0f172a);
  box-shadow: var(--foundry-shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1));
  cursor: pointer;
}

.foundry-table-of-contents__toggle-copy {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  text-align: left;
}

.foundry-table-of-contents__toggle-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--foundry-text-muted, #475569);
}

.foundry-table-of-contents__current {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--foundry-text, #0f172a);
}

.foundry-table-of-contents__toggle-icon {
  position: relative;
  flex: none;
  width: 0.95rem;
  height: 0.95rem;
}

.foundry-table-of-contents__toggle-icon::before,
.foundry-table-of-contents__toggle-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 0.6rem;
  height: 1px;
  background: currentColor;
  transition: transform var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease);
}

.foundry-table-of-contents__toggle-icon::before {
  left: 0.05rem;
  transform: translateY(-50%) rotate(45deg);
}

.foundry-table-of-contents__toggle-icon::after {
  right: 0.05rem;
  transform: translateY(-50%) rotate(-45deg);
}

.foundry-table-of-contents__widget.is-expanded .foundry-table-of-contents__toggle-icon::before {
  transform: translateY(-50%) rotate(-45deg);
}

.foundry-table-of-contents__widget.is-expanded .foundry-table-of-contents__toggle-icon::after {
  transform: translateY(-50%) rotate(45deg);
}

.foundry-table-of-contents__progress {
  position: relative;
  height: 0.35rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--foundry-toc-progress-track);
}

.foundry-table-of-contents__progress-track,
.foundry-table-of-contents__progress-bar {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.foundry-table-of-contents__progress-track {
  display: none;
}

.foundry-table-of-contents__progress-bar {
  width: 100%;
  background: var(--foundry-toc-progress-bar);
  transform: scaleX(var(--foundry-toc-progress));
  transform-origin: left center;
  transition: transform var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease);
}

.foundry-table-of-contents__panel[hidden] {
  display: none !important;
}

.foundry-table-of-contents__list,
.foundry-table-of-contents__auto nav > ul,
.foundry-table-of-contents__auto nav > ol {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.foundry-table-of-contents__item {
  margin: 0;
}

.foundry-table-of-contents__list--children,
.foundry-table-of-contents__auto nav ul ul,
.foundry-table-of-contents__auto nav ol ol,
.foundry-table-of-contents__auto nav ul ol,
.foundry-table-of-contents__auto nav ol ul {
  display: grid;
  gap: 0.3rem;
  margin: 0.35rem 0 0;
  padding: 0 0 0 0.85rem;
  border-left: 1px solid color-mix(in srgb, var(--foundry-border, #e2e8f0) 86%, transparent);
  list-style: none;
}

.foundry-table-of-contents__link,
.foundry-table-of-contents__auto a[href^="#"] {
  display: block;
  padding: 0.35rem 0.45rem;
  border-radius: 0.8rem;
  color: var(--foundry-text-muted, #475569);
  text-decoration: none;
  transition:
    color var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease),
    background var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease),
    opacity var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease);
}

.foundry-table-of-contents__link::before,
.foundry-table-of-contents__auto a[href^="#"]::before {
  content: "";
  display: inline-block;
  width: 0.32rem;
  height: 0.32rem;
  margin: 0.48em 0.5rem 0 0;
  border-radius: 999px;
  background: var(--foundry-toc-link-marker);
  vertical-align: top;
  transition: background var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease);
}

.foundry-table-of-contents__link:hover,
.foundry-table-of-contents__link:focus-visible,
.foundry-table-of-contents__auto a[href^="#"]:hover,
.foundry-table-of-contents__auto a[href^="#"]:focus-visible {
  color: var(--foundry-text, #0f172a);
  background: color-mix(in srgb, var(--foundry-surface-soft, #f8fafc) 92%, transparent);
}

.foundry-table-of-contents__link.is-active,
.foundry-table-of-contents__auto a[href^="#"].is-active {
  color: var(--foundry-toc-link-active-text);
  background: var(--foundry-toc-link-active-bg);
  font-weight: 700;
}

.foundry-table-of-contents__link.is-active::before,
.foundry-table-of-contents__auto a[href^="#"].is-active::before {
  background: var(--foundry-toc-link-marker-active);
}

.foundry-table-of-contents__link.is-complete,
.foundry-table-of-contents__auto a[href^="#"].is-complete {
  color: var(--foundry-toc-link-complete-text);
}

.foundry-table-of-contents__link.is-complete::before,
.foundry-table-of-contents__auto a[href^="#"].is-complete::before {
  background: var(--foundry-toc-link-marker-complete);
}

[data-foundry-toc-depth="2"] .foundry-table-of-contents__auto nav > ul ul,
[data-foundry-toc-depth="2"] .foundry-table-of-contents__auto nav > ol ol,
[data-foundry-toc-depth="2"] .foundry-table-of-contents__auto nav > ul ol,
[data-foundry-toc-depth="2"] .foundry-table-of-contents__auto nav > ol ul {
  display: none;
}

@media (max-width: 899px) {
  [data-foundry-toc-mobile="compact"].foundry-table-of-contents__widget {
    position: sticky;
    top: var(--foundry-scroll-offset, 0px);
    z-index: 30;
  }

  .foundry-article-shell__toc--mobile {
    position: sticky;
    top: var(--foundry-scroll-offset, 0px);
    z-index: 30;
  }

  .foundry-article-shell__toc--mobile > [data-foundry-toc-mobile="compact"].foundry-table-of-contents__widget {
    position: static;
    top: auto;
    grid-template-rows: auto auto minmax(0, 1fr);
    max-height: calc(100vh - var(--foundry-scroll-offset, 0px) - 1rem);
    max-height: calc(100dvh - var(--foundry-scroll-offset, 0px) - 1rem);
  }

  .foundry-article-shell__toc--mobile .foundry-table-of-contents__panel {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  [data-foundry-toc-mobile="compact"] .foundry-table-of-contents__toggle {
    display: flex;
  }
}

@media (min-width: 900px) {
  [data-foundry-toc-sticky="true"].foundry-table-of-contents__widget {
    position: sticky;
    top: var(--foundry-scroll-offset, 0px);
  }

  .foundry-article-shell__aside {
    position: sticky;
    top: var(--foundry-scroll-offset, 0px);
    z-index: 20;
    align-self: start;
    min-width: 0;
    max-height: calc(100vh - var(--foundry-scroll-offset, 0px) - 1rem);
    max-height: calc(100dvh - var(--foundry-scroll-offset, 0px) - 1rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  [data-foundry-toc-mobile="compact"] .foundry-table-of-contents__panel[hidden] {
    display: block !important;
  }
}

/* Dialog fallback styling:
   when scripts set [open] without showModal(), keep lightboxes centered and usable. */
.foundry-gallery__dialog,
.foundry-masonry-gallery__dialog {
  width: min(92vw, 1100px);
  max-width: 1100px;
  border: 1px solid var(--foundry-border, #e2e8f0);
}

.foundry-gallery__dialog::backdrop,
.foundry-masonry-gallery__dialog::backdrop {
  background: rgba(15, 23, 42, 0.72);
}

.foundry-gallery__dialog[open],
.foundry-masonry-gallery__dialog[open] {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  max-height: 92vh;
  overflow: hidden;
  z-index: 1000;
}

.foundry-gallery__dialog-inner,
.foundry-masonry-gallery__dialog-inner {
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.foundry-gallery__dialog-image,
.foundry-masonry-gallery [data-masonry-image] {
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
}

@media (max-width: 640px) {
  .foundry-gallery__dialog[open],
  .foundry-masonry-gallery__dialog[open] {
    width: 96vw;
  }

  .foundry-gallery__dialog-image,
  .foundry-masonry-gallery [data-masonry-image] {
    max-height: 68vh;
  }
}

.foundry-site-preferences {
  position: relative;
}

.foundry-site-preferences__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.5rem;
  padding: 0 0.9rem;
  border-radius: 9999px;
  border: 1px solid color-mix(in srgb, var(--foundry-border-strong, #cbd5e1) 92%, transparent);
  background: color-mix(in srgb, var(--foundry-surface, #ffffff) 94%, transparent);
  color: var(--foundry-text, #0f172a);
  box-shadow: var(--foundry-shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1));
  cursor: pointer;
  transition:
    background var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease),
    border-color var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease),
    box-shadow var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease),
    transform var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease);
}

.foundry-site-preferences__trigger:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--foundry-brand-accent, #3b82f6) 35%, var(--foundry-border-strong, #cbd5e1));
}

.foundry-site-preferences__trigger:focus-visible {
  outline: 2px solid var(--foundry-brand-accent, #3b82f6);
  outline-offset: 2px;
}

.foundry-site-preferences__meta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.foundry-site-preferences__language-code {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.foundry-site-preferences__chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease);
}

.foundry-site-preferences.is-open .foundry-site-preferences__chevron {
  transform: rotate(180deg);
}

.foundry-site-preferences__chevron-svg {
  width: 0.95rem;
  height: 0.95rem;
}

.foundry-site-preferences__panel {
  position: absolute;
  top: calc(100% + 0.65rem);
  right: 0;
  z-index: 80;
  width: min(20rem, calc(100vw - 2rem));
  padding: 0.95rem;
  border-radius: 1rem;
  border: 1px solid color-mix(in srgb, var(--foundry-border, #e2e8f0) 90%, transparent);
  background: color-mix(in srgb, var(--foundry-surface, #ffffff) 98%, transparent);
  box-shadow: var(--foundry-shadow-md, 0 4px 12px rgba(0, 0, 0, 0.1));
}

.foundry-site-preferences__panel[hidden] {
  display: none !important;
}

.foundry-site-preferences__section + .foundry-site-preferences__section {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid color-mix(in srgb, var(--foundry-border, #e2e8f0) 90%, transparent);
}

.foundry-site-preferences__section-title {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--foundry-text-muted, #475569);
}

.foundry-site-preferences--mobile {
  display: grid;
  gap: 1rem;
}

.foundry-theme-mode-display {
  position: relative;
  display: inline-grid;
  width: 1rem;
  height: 1rem;
  place-items: center;
}

.foundry-theme-mode-display__icon {
  display: none;
  align-items: center;
  justify-content: center;
}

.foundry-theme-mode-display__svg {
  width: 1rem;
  height: 1rem;
}

.foundry-theme-mode-display[data-mode="light"] .foundry-theme-mode-display__icon[data-icon="light"],
.foundry-theme-mode-display[data-mode="dark"] .foundry-theme-mode-display__icon[data-icon="dark"] {
  display: inline-flex;
}

.foundry-theme-mode-display[data-mode="system"] .foundry-theme-mode-display__icon[data-icon="light"] {
  display: inline-flex;
}

:root.dark .foundry-theme-mode-display[data-mode="system"] .foundry-theme-mode-display__icon[data-icon="light"],
:root[data-theme="dark"] .foundry-theme-mode-display[data-mode="system"] .foundry-theme-mode-display__icon[data-icon="light"] {
  display: none;
}

:root.dark .foundry-theme-mode-display[data-mode="system"] .foundry-theme-mode-display__icon[data-icon="dark"],
:root[data-theme="dark"] .foundry-theme-mode-display[data-mode="system"] .foundry-theme-mode-display__icon[data-icon="dark"] {
  display: inline-flex;
}

.foundry-theme-mode-display__badge {
  display: none;
  position: absolute;
  right: -0.22rem;
  bottom: -0.16rem;
  align-items: center;
  justify-content: center;
  width: 0.68rem;
  height: 0.68rem;
  border: 1px solid color-mix(in srgb, var(--foundry-border-strong, #cbd5e1) 88%, transparent);
  border-radius: 9999px;
  background: color-mix(in srgb, var(--foundry-surface, #ffffff) 96%, transparent);
  color: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.foundry-theme-mode-display[data-mode="system"] .foundry-theme-mode-display__badge {
  display: inline-flex;
}

.foundry-theme-mode-display__badge-svg {
  width: 0.4rem;
  height: 0.4rem;
}

.foundry-language-switcher--list {
  display: grid;
  gap: 0.45rem;
}

.foundry-language-switcher--list .foundry-language-switcher__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  min-height: 2.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: 0.9rem;
  border: 1px solid color-mix(in srgb, var(--foundry-border, #e2e8f0) 92%, transparent);
  background: color-mix(in srgb, var(--foundry-surface-soft, #f8fafc) 70%, transparent);
  color: var(--foundry-text, #0f172a);
  text-decoration: none;
  transition:
    background var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease),
    border-color var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease),
    transform var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease);
}

.foundry-language-switcher--list .foundry-language-switcher__link:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--foundry-brand-accent, #3b82f6) 35%, var(--foundry-border-strong, #cbd5e1));
}

.foundry-language-switcher--list .foundry-language-switcher__link:focus-visible {
  outline: 2px solid var(--foundry-brand-accent, #3b82f6);
  outline-offset: 2px;
}

.foundry-language-switcher__content {
  display: grid;
  gap: 0.12rem;
}

.foundry-language-switcher__label {
  font-weight: 600;
}

.foundry-language-switcher__meta {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--foundry-text-muted, #475569);
}

.foundry-language-switcher__state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.foundry-language-switcher__check {
  width: 1rem;
  height: 1rem;
}

.foundry-language-switcher--list .foundry-language-switcher__link.is-active {
  border-color: color-mix(in srgb, var(--foundry-brand-accent, #3b82f6) 46%, var(--foundry-border-strong, #cbd5e1));
  background: color-mix(in srgb, var(--foundry-brand-accent, #3b82f6) 10%, var(--foundry-surface, #ffffff));
}

.foundry-language-switcher--list .foundry-language-switcher__link.is-unavailable {
  opacity: 0.92;
}

/* Accessible disclosure floor shared by Accordion and FAQ Sections. */
.foundry-accordion__summary,
.foundry-faq-accordion__question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 2.75rem;
  border-radius: var(--foundry-radius-sm, 0.5rem);
  outline-offset: 0.2rem;
}

.foundry-accordion__summary:focus-visible,
.foundry-faq-accordion__question:focus-visible {
  outline: 0.18rem solid var(--foundry-brand-accent, #3b82f6);
}

.foundry-accordion__indicator,
.foundry-faq-accordion__indicator {
  flex: 0 0 auto;
  transition: transform var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease);
}

.foundry-faq-accordion__indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--foundry-border, #e2e8f0);
  border-radius: 9999px;
  color: var(--foundry-text-muted, #475569);
}

.foundry-accordion__item[open] > .foundry-accordion__summary .foundry-accordion__indicator,
.foundry-faq-accordion__item[open] > .foundry-faq-accordion__question .foundry-faq-accordion__indicator {
  transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
  .foundry-accordion__indicator,
  .foundry-faq-accordion__indicator {
    transition: none;
  }
}
