/* ==========================================================================
   Explainer v2 layout for /calculators/{slug}. Scoped to .f402-ex so docs
   pages are unchanged. Uses existing site tokens; works in both themes.
   ========================================================================== */

.f402-ex {
  --ex-card: color-mix(in srgb, var(--color-base-content) 3.5%, var(--color-base-100));
  --ex-card-2: color-mix(in srgb, var(--color-base-content) 6%, var(--color-base-100));
  --ex-line: var(--f402-line);
  --ex-soft: color-mix(in srgb, var(--color-base-content) 78%, transparent);
  --ex-accent: var(--color-primary);
  --ex-mint: var(--color-accent);
  --ex-ok: var(--color-success); /* mint in dark, darker green in light (text-safe) */
  --ex-warn: var(--color-warning);
  --ex-err: var(--color-error);
  --ex-radius: 4px;
  --ex-head: 4rem;
  padding: 0 0 4rem;
  overflow-x: clip;
  min-width: 0;
  max-width: 100%;
}

/* ---------- Hero ---------- */
.f402-ex-hero {
  position: relative;
  padding: 1.5rem 0 2rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--ex-line);
  overflow-x: clip;
}
.f402-ex-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(40rem 18rem at 85% 0%, color-mix(in srgb, var(--ex-accent) 16%, transparent), transparent 70%),
    radial-gradient(30rem 14rem at 10% 100%, color-mix(in srgb, var(--ex-mint) 7%, transparent), transparent 70%);
  pointer-events: none;
}
.f402-ex-hero .f402-docs-title {
  max-width: 24ch;
  font-size: clamp(1.9rem, 4.4vw, 3.1rem);
  margin: 0.9rem 0 1rem;
}
.f402-ex-hero .f402-ex-summary {
  max-width: 44rem;
  margin: 0 0 1.25rem;
  color: var(--ex-soft);
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  line-height: 1.6;
}
.f402-ex-hero-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0.75rem;
  align-items: center;
}
.f402-ex-disclaimer {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.4rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--ex-warn) 45%, transparent);
  background: color-mix(in srgb, var(--ex-warn) 9%, transparent);
  color: var(--color-base-content);
  font-size: 0.82rem;
  max-width: none;
}
.f402-ex-disclaimer::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  flex: none;
  border-radius: 50%;
  background: var(--ex-warn);
}
.f402-ex-disclaimer em { font-style: normal; }
.f402-ex .f402-explainer-api {
  margin: 0;
  padding: 0.4rem 0.75rem;
  max-width: none;
  font-size: 0.82rem;
  border-color: color-mix(in srgb, var(--ex-accent) 45%, transparent);
}
.f402-ex-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}
.f402-ex-chips a,
.f402-ex-chips span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--ex-line);
  background: var(--ex-card);
  color: var(--color-base-content);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.f402-ex-chips a:hover { border-color: var(--ex-accent); }
.f402-ex-chips a::after { content: "↓"; color: var(--ex-accent); }
.f402-ex-chips .is-meta { color: var(--f402-muted); }
.f402-ex-chips .is-meta a,
.f402-ex-chips a.is-meta::after { content: none; }

/* ---------- Layout + table of contents ---------- */
.f402-ex-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
}
@media (min-width: 1024px) {
  .f402-ex-layout {
    grid-template-columns: 14.5rem minmax(0, 1fr);
    gap: 3.5rem;
  }
}
.f402-ex-toc {
  font-size: 0.86rem;
}
.f402-ex-toc details {
  border: 1px solid var(--ex-line);
  background: var(--ex-card);
}
.f402-ex-toc summary {
  cursor: pointer;
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--f402-muted);
}
.f402-ex-toc ol {
  margin: 0;
  padding: 0 0.5rem 0.75rem;
  list-style: none;
}
.f402-ex-toc a {
  display: block;
  padding: 0.32rem 0.6rem;
  border-left: 2px solid transparent;
  color: var(--f402-muted) !important;
  text-decoration: none;
  line-height: 1.35;
}
.f402-ex-toc a:hover { color: var(--color-base-content) !important; }
.f402-ex-toc a[aria-current="true"] {
  border-left-color: var(--ex-accent);
  color: var(--color-base-content) !important;
  background: color-mix(in srgb, var(--ex-accent) 10%, transparent);
}
@media (min-width: 1024px) {
  .f402-ex-toc {
    position: sticky;
    top: calc(var(--ex-head) + 1.25rem);
    align-self: start;
    max-height: calc(100vh - var(--ex-head) - 2.5rem);
    overflow-y: auto;
  }
  .f402-ex-toc details { border: 0; background: none; }
  .f402-ex-toc summary { pointer-events: none; list-style: none; padding: 0 0 0.6rem 0.6rem; }
  .f402-ex-toc summary::-webkit-details-marker { display: none; }
  .f402-ex-toc ol { padding: 0; border-left: 1px solid var(--ex-line); }
  .f402-ex-toc a { margin-left: -1px; }
}

/* ---------- Sections ---------- */
.f402-ex-main { min-width: 0; }
.f402-ex-sec {
  margin: 0 0 3.25rem;
  scroll-margin-top: calc(var(--ex-head) + 1rem);
}
.f402-ex-sec > .f402-docs-h2,
.f402-ex-ctx .f402-docs-h2 {
  margin-top: 0;
  font-size: clamp(1.35rem, 2.2vw, 1.7rem);
}
.f402-ex .f402-docs-lead,
.f402-ex .f402-docs-list { color: var(--ex-soft); max-width: 46rem; }
.f402-ex .f402-docs-h3 { font-size: 1.1rem; margin: 2rem 0 0.75rem; }

.f402-ex-card {
  border: 1px solid var(--ex-line);
  background: var(--ex-card);
  border-radius: var(--ex-radius);
  padding: clamp(1rem, 2.5vw, 1.5rem);
}

/* Citation markers [1] */
.f402-ex-cite {
  font-family: var(--font-mono);
  font-size: 0.72em;
  vertical-align: super;
  line-height: 0;
  text-decoration: none;
}

/* ---------- Formula card ---------- */
.f402-ex-formula {
  position: relative;
  margin: 1rem 0 1.25rem;
  border: 1px solid color-mix(in srgb, var(--ex-accent) 40%, var(--ex-line));
  background: var(--f402-terminal-bg);
  border-radius: var(--ex-radius);
  overflow: hidden;
}
.f402-ex-formula::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--ex-accent), var(--ex-mint));
}
.f402-ex-formula .f402-docs-pre {
  margin: 0;
  border: 0;
  max-height: none;
  padding: clamp(1.1rem, 3vw, 2rem) clamp(1rem, 3vw, 2rem);
  background: transparent;
  color: var(--f402-terminal-fg);
  font-size: clamp(0.95rem, 2.1vw, 1.45rem);
  line-height: 1.55;
}
.f402-ex-formula .f402-docs-pre code { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 639px) {
  .f402-ex-table-wrap .f402-docs-table th,
  .f402-ex-table-wrap .f402-docs-table td { padding: 0.6rem 0.55rem; }
  .f402-ex-formula.is-multiline .f402-docs-pre { font-size: 0.82rem; }
  /* Several worked examples become a swipeable row on phones (keyboard-scrollable via tabindex). */
  .f402-ex-examples:not(.is-single) {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 86%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 0.75rem;
  }
  .f402-ex-examples:not(.is-single) > .f402-ex-example { scroll-snap-align: start; }
}
.f402-ex-examples:focus-visible { outline: 2px solid var(--ex-accent); outline-offset: 4px; }
.f402-ex-formula.is-secondary { border-color: var(--ex-line); }
.f402-ex-formula.is-secondary::before { background: var(--ex-line); }
.f402-ex-formula.is-secondary .f402-docs-pre { font-size: 0.85rem; padding: 0.9rem 1.1rem; }
.f402-ex-words {
  padding-left: 0.9rem;
  border-left: 2px solid var(--ex-mint);
}

/* ---------- Variable legend (Term | meaning | unit | range) ---------- */
.f402-ex .f402-docs-table { font-size: 0.9rem; }
.f402-ex .f402-docs-table td,
.f402-ex .f402-docs-table tbody th { color: var(--ex-soft); }
.f402-ex-table-wrap {
  overflow-x: auto;
  margin: 0.75rem 0 1.25rem;
  border: 1px solid var(--ex-line);
  border-radius: var(--ex-radius);
  background: var(--ex-card);
}
.f402-ex-table-wrap .f402-docs-table { margin: 0; }
.f402-ex-table-wrap .f402-docs-table th,
.f402-ex-table-wrap .f402-docs-table td { padding: 0.7rem 0.9rem; }
.f402-ex-table-wrap thead th { background: var(--ex-card-2); }
.f402-ex-table-wrap tbody tr:last-child > * { border-bottom: 0; }
.f402-ex-table-wrap th,
.f402-ex-table-wrap td {
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}
.f402-ex-table-wrap.is-data thead th { font-size: 0.75rem; }
/* Only the four-column Yes/No score table (qSOFA) tries to fit a 390px
   article. Other data tables keep overflow-x: auto so long header words
   scroll instead of breaking mid-word. Never overflow-wrap: anywhere /
   break-word on these headers. */
@media (max-width: 639px) {
  .f402-ex-table-wrap.is-fit .f402-docs-table th,
  .f402-ex-table-wrap.is-fit .f402-docs-table td {
    padding: 0.45rem 0.32rem;
  }
  .f402-ex-table-wrap.is-fit thead th {
    font-size: 0.75rem;
    letter-spacing: 0.04em;
  }
  .f402-ex-table-wrap.is-fit .f402-ex-pips {
    gap: 2px;
  }
  .f402-ex-table-wrap.is-fit .f402-ex-pips i {
    width: 0.5rem;
    height: 0.5rem;
  }
}
.f402-ex-table-wrap tbody th {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-base-content);
}
.f402-ex-vars tbody th {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
  color: var(--color-base-content);
}
.f402-ex code {
  padding: 0.1rem 0.35rem;
  border: 1px solid color-mix(in srgb, var(--ex-accent) 30%, transparent);
  background: color-mix(in srgb, var(--ex-accent) 10%, transparent);
  color: var(--color-base-content);
  font-size: 0.86em;
}
.f402-ex pre code { padding: 0; border: 0; background: none; font-size: inherit; color: inherit; }
@media (max-width: 639px) {
  /* Stack legend body rows as cards on phones. Keep thead visible at every width. */
  .f402-ex-stack, .f402-ex-stack tbody, .f402-ex-stack tbody tr, .f402-ex-stack tbody th, .f402-ex-stack tbody td { display: block; }
  .f402-ex-stack thead { display: table-header-group; }
  .f402-ex-stack thead tr { display: table-row; }
  .f402-ex-stack thead th { display: table-cell; }
  .f402-ex-stack tbody tr { padding: 0.8rem 0.9rem; border-bottom: 1px solid var(--ex-line); }
  .f402-ex-stack tbody tr:last-child { border-bottom: 0; }
  .f402-ex-table-wrap .f402-ex-stack tbody th,
  .f402-ex-table-wrap .f402-ex-stack tbody td { padding: 0.15rem 0; border: 0; }
  .f402-ex-stack td::before {
    content: attr(data-label);
    display: block;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--f402-muted);
    margin-top: 0.35rem;
  }
}

/* ---------- Stepper (ordered list under "How ... works / How to calculate") ---------- */
.f402-ex-steps {
  counter-reset: step;
  list-style: none;
  margin: 1rem 0 1.25rem;
  padding: 0;
  max-width: 46rem;
}
.f402-ex-steps > li {
  counter-increment: step;
  position: relative;
  padding: 0 0 1.1rem 2.9rem;
  color: var(--ex-soft);
  line-height: 1.55;
}
.f402-ex-steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -0.1rem;
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border: 1px solid var(--ex-accent);
  background: color-mix(in srgb, var(--ex-accent) 14%, var(--color-base-100));
  color: var(--color-base-content);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.f402-ex-steps > li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 0.95rem;
  top: 1.9rem;
  bottom: 0.1rem;
  width: 1px;
  background: var(--ex-line);
}
.f402-ex-steps > li strong { color: var(--color-base-content); }

/* ---------- Worked example cards ---------- */
.f402-ex-examples {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}
.f402-ex-examples.is-single { grid-template-columns: minmax(0, 46rem); }
.f402-ex-example {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ex-line);
  border-radius: var(--ex-radius);
  background: var(--ex-card);
  overflow: hidden;
}
.f402-ex-example > .f402-docs-h3 {
  margin: 0;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--ex-line);
  background: var(--ex-card-2);
  font-size: 0.98rem;
  line-height: 1.35;
}
.f402-ex-example > .f402-ex-steps { margin: 1rem 1.1rem 0; }
.f402-ex-example > .f402-ex-steps > li { padding-bottom: 0.7rem; padding-left: 2.4rem; font-size: 0.92rem; }
.f402-ex-example > .f402-ex-steps > li::before { width: 1.55rem; height: 1.55rem; font-size: 0.7rem; }
.f402-ex-example > .f402-ex-steps > li:not(:last-child)::after { left: 0.77rem; top: 1.55rem; }
.f402-ex-example > .f402-ex-steps > li.is-result {
  margin-top: auto;
  padding: 0.85rem 0 0.85rem 2.4rem;
  border-top: 1px dashed var(--ex-line);
  color: var(--color-base-content);
  font-size: 1.05rem;
}
.f402-ex-example > .f402-ex-steps > li.is-result::before {
  top: 0.75rem;
  border-color: var(--ex-mint);
  background: color-mix(in srgb, var(--ex-mint) 18%, var(--color-base-100));
}
.f402-ex-example li.is-result strong {
  color: var(--ex-ok);
  font-family: var(--font-display);
  font-size: 1.3em;
  letter-spacing: -0.02em;
}
.f402-ex-example > .f402-docs-lead { margin: 0 1.1rem 1rem; font-size: 0.86rem; }
.f402-ex-example > :last-child { margin-bottom: 1rem; }

/* ---------- Heat grid (2-input reference table, corner header contains "\") ---------- */
.f402-ex-grid td {
  text-align: center;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--color-base-content) !important;
  background: color-mix(in srgb, var(--ex-accent) calc(var(--t, 0) * 42%), transparent);
}
.f402-ex-grid thead th:not(:first-child) { text-align: center; }
.f402-ex-grid tbody th { white-space: nowrap; }
.f402-ex-grid td.is-match {
  outline: 2px solid var(--ex-mint);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--ex-mint) 22%, transparent);
  font-weight: 700;
}
.f402-ex-legend {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: -0.5rem 0 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--f402-muted);
}
.f402-ex-legend i {
  display: inline-block;
  width: 6rem;
  height: 0.5rem;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--ex-accent) 42%, transparent));
  border: 1px solid var(--ex-line);
}
.f402-ex-legend i::before { content: "low"; position: relative; left: -2.2rem; top: -0.35rem; }
.f402-ex-legend i::after { content: "high"; position: relative; left: 4.6rem; top: -0.35rem; }
.f402-ex-legend { padding-left: 2.2rem; gap: 2.6rem; }
.f402-ex-legend b::after { content: "worked example"; display: inline-block; margin-left: 1.4rem; white-space: nowrap; font-weight: 400; }
.f402-ex-legend b { display: inline-block; width: 0.9rem; height: 0.9rem; outline: 2px solid var(--ex-mint); outline-offset: -2px; }

/* ---------- Score column: number kept as text, pips are decorative ---------- */
.f402-ex-score { white-space: nowrap; }
.f402-ex-score .n {
  display: inline-block;
  min-width: 1.4rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--color-base-content);
}
.f402-ex-pips { display: inline-flex; gap: 3px; vertical-align: middle; }
.f402-ex-pips i {
  width: 0.7rem;
  height: 0.7rem;
  border: 1px solid color-mix(in srgb, var(--ex-accent) 60%, transparent);
}
.f402-ex-pips i.on { background: var(--ex-accent); border-color: var(--ex-accent); }
.f402-ex-bool {
  display: inline-block;
  padding: 0.05rem 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  border: 1px solid var(--ex-line);
}
.f402-ex-bool.is-yes { border-color: color-mix(in srgb, var(--ex-mint) 60%, transparent); color: var(--ex-ok); }

/* ---------- Criteria / points cards (table whose header mentions "point") ---------- */
/* Still a <table> with ARIA roles. Thead stays visible; body cells also carry data-label. */
.f402-ex-criteria { display: block; margin: 1rem 0 1.5rem; font-size: 0.9rem; }
.f402-ex-criteria thead { display: block; margin: 0 0 0.75rem; }
.f402-ex-criteria thead tr {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.1rem;
  padding: 0.2rem 0 0.45rem;
  border: 0;
  background: none;
}
.f402-ex-criteria thead th {
  display: inline;
  padding: 0;
  border: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--f402-muted);
  font-weight: 600;
}
.f402-ex-criteria tbody {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 0.9rem;
}
.f402-ex-criteria tbody tr {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.1rem 1.1rem 1rem;
  border: 1px solid var(--ex-line);
  border-top: 3px solid var(--ex-accent);
  border-radius: var(--ex-radius);
  background: var(--ex-card);
}
.f402-ex-criteria tbody th,
.f402-ex-criteria td { display: block; padding: 0; border: 0; overflow-wrap: normal; }
.f402-ex-criteria tbody th {
  margin-bottom: 0.25rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-base-content);
}
.f402-ex-criteria td { color: var(--ex-soft); }
.f402-ex-criteria td::before {
  content: attr(data-label);
  display: block;
  margin-bottom: 0.15rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--f402-muted);
}
.f402-ex-criteria td.is-key {
  align-self: flex-start;
  padding: 0.35rem 0.6rem;
  border: 1px solid color-mix(in srgb, var(--ex-mint) 55%, transparent);
  background: color-mix(in srgb, var(--ex-mint) 10%, transparent);
  color: var(--color-base-content);
  font-weight: 600;
}
.f402-ex-criteria td.is-key::before { color: var(--ex-ok); }

/* ---------- Conversion tables side by side ---------- */
.f402-ex-pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 1rem;
}
.f402-ex-pair { align-items: start; }
.f402-ex-pair .f402-ex-table-wrap { margin: 0.5rem 0 0; }
.f402-ex-conv td { font-family: var(--font-mono); color: var(--color-base-content) !important; }

/* ---------- Context trio: When / Where / Who ---------- */
.f402-ex-ctx {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 1rem;
  margin: 0 0 3.25rem;
}
.f402-ex-ctx > section {
  padding: 1.2rem;
  border: 1px solid var(--ex-line);
  border-radius: var(--ex-radius);
  background: var(--ex-card);
  scroll-margin-top: calc(var(--ex-head) + 1rem);
}
.f402-ex-ctx .f402-docs-h2 { font-size: 1.12rem !important; margin-bottom: 0.5rem; }
.f402-ex-ctx .f402-docs-lead { font-size: 0.92rem; margin: 0; }

/* ---------- History timeline ---------- */
.f402-ex-timeline {
  position: relative;
  margin: 1rem 0 0;
  padding-left: 1.6rem;
  border-left: 1px solid var(--ex-line);
}
.f402-ex-timeline > p { position: relative; margin: 0 0 1.1rem; }
.f402-ex-timeline > p::before {
  content: "";
  position: absolute;
  left: calc(-1.6rem - 5px);
  top: 0.45rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--color-base-100);
  border: 2px solid var(--ex-accent);
}
.f402-ex-timeline > p:first-child::before { background: var(--ex-accent); }
.f402-ex-year {
  display: inline-block;
  position: relative;
  margin: 0 0 0.9rem calc(-1.6rem - 1px);
  transform: translateX(-50%);
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--ex-accent);
  background: var(--color-base-100);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-base-content);
}
/* Below 1024px the article is a single column. translateX(-50%) plus the
   negative left margin hangs the 4-digit year outside .f402-ex, and
   overflow-x: clip on .f402-ex cuts it to two digits. Drop the translate
   so the badge sits on the timeline and the full year stays inside. */
@media (max-width: 1023px) {
  .f402-ex-year {
    transform: none;
  }
}

/* ---------- Callouts ---------- */
.f402-ex-callout {
  padding: 1.2rem 1.3rem;
  border: 1px solid color-mix(in srgb, var(--ex-warn) 40%, transparent);
  border-left: 4px solid var(--ex-warn);
  border-radius: var(--ex-radius);
  background: color-mix(in srgb, var(--ex-warn) 6%, transparent);
}
.f402-ex-callout > :last-child { margin-bottom: 0; }
.f402-ex-callout > :first-child { margin-top: 0; }
.f402-ex-callout .f402-docs-list { padding-left: 1.1rem; }
.f402-ex-callout .f402-docs-list li { margin-bottom: 0.4rem; }

/* Bold-lead list items -> cards (Common mistakes, How it differs) */
.f402-ex-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 0.9rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  max-width: none !important;
}
.f402-ex-cards > li {
  position: relative;
  padding: 1rem 1.1rem 1rem 1.1rem;
  border: 1px solid var(--ex-line);
  border-radius: var(--ex-radius);
  background: var(--ex-card);
  font-size: 0.92rem;
}
.f402-ex-cards > li > strong:first-child {
  display: block;
  margin-bottom: 0.35rem;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--color-base-content);
}
.f402-ex-cards.is-mistakes > li { padding-left: 3rem; }
.f402-ex-cards.is-mistakes > li::before {
  content: "";
  position: absolute;
  left: 1rem;
  top: 1.05rem;
  width: 1.3rem;
  height: 1.3rem;
  border: 1px solid color-mix(in srgb, var(--ex-err) 60%, transparent);
  background:
    linear-gradient(45deg, transparent 46%, var(--ex-err) 46%, var(--ex-err) 54%, transparent 54%),
    linear-gradient(-45deg, transparent 46%, var(--ex-err) 46%, var(--ex-err) 54%, transparent 54%);
  background-size: 60% 60%;
  background-position: center;
  background-repeat: no-repeat;
}

/* Glossary: "**Term:** definition" list items */
.f402-ex-glossary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 0 1.5rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  max-width: none !important;
  border-top: 1px solid var(--ex-line);
}
.f402-ex-glossary > li {
  padding: 0.85rem 1rem 0.85rem 0;
  border-bottom: 1px solid var(--ex-line);
  font-size: 0.9rem;
}
.f402-ex-glossary > li > strong:first-child {
  display: block;
  color: var(--color-base-content);
  font-family: var(--font-display);
}

/* ---------- Sources ---------- */
.f402-ex-source {
  display: grid;
  gap: 0.75rem;
  border-left: 4px solid var(--ex-accent);
}
.f402-ex-source .f402-docs-lead { margin: 0; color: var(--color-base-content); }
.f402-ex-refs {
  counter-reset: ref;
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  display: grid;
  gap: 0.6rem;
  max-width: none !important;
}
.f402-ex-refs > li {
  counter-increment: ref;
  position: relative;
  padding: 0.8rem 1rem 0.8rem 3rem;
  border: 1px solid var(--ex-line);
  border-radius: var(--ex-radius);
  background: var(--ex-card);
  font-size: 0.88rem;
  scroll-margin-top: calc(var(--ex-head) + 1rem);
}
.f402-ex-refs > li::before {
  content: counter(ref);
  position: absolute;
  left: 1rem;
  top: 0.8rem;
  font-family: var(--font-mono);
  color: var(--ex-accent);
}
.f402-ex-refs > li:target { border-color: var(--ex-accent); }

/* ---------- FAQ accordions ---------- */
.f402-ex-faq { border-top: 1px solid var(--ex-line); }
.f402-ex-faq details { border-bottom: 1px solid var(--ex-line); }
.f402-ex-faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0.25rem;
  cursor: pointer;
  list-style: none;
}
.f402-ex-faq summary::-webkit-details-marker { display: none; }
.f402-ex-faq summary .f402-docs-h3 { margin: 0; font-size: 1.02rem; }
.f402-ex-faq summary::after {
  content: "";
  flex: none;
  width: 0.6rem;
  height: 0.6rem;
  border-right: 2px solid var(--ex-accent);
  border-bottom: 2px solid var(--ex-accent);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}
.f402-ex-faq details[open] summary::after { transform: rotate(-135deg); }
.f402-ex-faq summary:hover .f402-docs-h3 { color: var(--ex-accent); }
.f402-ex-faq summary:focus-visible { outline: 2px solid var(--ex-accent); outline-offset: 2px; }
.f402-ex-faq .f402-ex-ans { padding: 0 0.25rem 1rem; }
.f402-ex-faq .f402-ex-ans > :first-child { margin-top: 0; }

/* ---------- Related link cards ---------- */
.f402-ex-related {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 0.8rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  max-width: none !important;
}
.f402-ex-related > li {
  position: relative;
  padding: 1rem 2.4rem 1rem 1rem;
  border: 1px solid var(--ex-line);
  border-radius: var(--ex-radius);
  background: var(--ex-card);
  font-size: 0.86rem;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.f402-ex-related > li:hover,
.f402-ex-related > li:focus-within { border-color: var(--ex-accent); transform: translateY(-1px); }
.f402-ex-related > li > a {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
}
.f402-ex-related > li > a::after { content: ""; position: absolute; inset: 0; }
.f402-ex-related > li::after {
  content: "→";
  position: absolute;
  right: 1rem;
  top: 1rem;
  color: var(--ex-accent);
}

/* ---------- Motion, print ---------- */
@media (prefers-reduced-motion: reduce) {
  .f402-ex *, .f402-ex *::before, .f402-ex *::after { transition: none !important; }
  .f402-ex-related > li:hover { transform: none; }
}
@media print {
  .f402-header, .f402-footer, .f402-ex-toc, .f402-ex-chips, .f402-ex-hero::before { display: none !important; }
  body, body.is-reference { background: #fff !important; color: #000 !important; }
  body::before { display: none; }
  .f402-ex { --ex-card: #fff; --ex-card-2: #f3f3f3; --ex-line: #bbb; --ex-soft: #111; }
  .f402-ex-layout { display: block; }
  .f402-ex-sec > .f402-docs-h2 { break-after: avoid; }
  .f402-ex-formula, .f402-ex-formula .f402-docs-pre { background: #fff !important; color: #000 !important; }
  .f402-ex-formula, .f402-ex-example, .f402-ex-criteria > li, .f402-ex-cards > li { break-inside: avoid; }
  .f402-ex-faq details::details-content { content-visibility: visible; display: block; }
  .f402-ex-faq summary::after { display: none; }
  .f402-ex a[href^="https://doi.org"]::after { content: " (" attr(href) ")"; font-size: 0.8em; }
}

.f402-ex-layout,
.f402-ex-main {
  min-width: 0;
  max-width: 100%;
}
