/* Additive navigation layer. Scientific templates and figure geometry are untouched. */
[data-page-overview] { scroll-margin-top: 80px; }
[data-page-overview] .judging__a a { color: #165b67; text-decoration: underline; text-underline-offset: .16em; }
body[data-chapter-page] { --chapter-navy: #2c4460; --chapter-teal: #1f7a82; --chapter-line: #d6dcdf; }
body[data-chapter-page] .hero-factory { min-height: 220px; margin-bottom: 2rem !important; }
body[data-chapter-page] .hero-factory .hero-card { max-width: 820px; }
body[data-chapter-page] .hero-factory h1 { font-size: clamp(2.5rem, 5vw, 4.4rem); }
body[data-chapter-page] .hero-factory .lead { max-width: 62ch; }
.chapter-navigation { padding: 1rem 0 1.8rem; }
.chapter-index-heading { display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; margin-bottom: 1.5rem; }
.chapter-eyebrow { color: var(--chapter-navy); font: 700 .69rem/1.5 "Space Mono", monospace; letter-spacing: .11em; text-transform: uppercase; margin: 0 0 .65rem; }
.chapter-eyebrow span { margin: 0 .6rem; color: #8f9ea9; }
.chapter-index-title { font: 700 clamp(1.6rem, 3.2vw, 2.45rem)/1.15 "Space Grotesk", sans-serif; color: var(--chapter-navy); letter-spacing: -.04em; margin: 0 0 .65rem; }
.chapter-index-intro { font-size: 1rem; color: #4a4a4a; margin: 0; }
.chapter-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; flex-shrink: 0; }
.chapter-action { border: 1px solid var(--chapter-navy); border-radius: 6px; background: white; color: var(--chapter-navy); font: 700 .85rem/1.35 "Nunito", sans-serif; padding: .7rem .9rem; text-decoration: none; display: inline-flex; align-items: center; gap: .65rem; cursor: pointer; }
.chapter-action:hover { background: var(--chapter-navy); color: white; }
.chapter-action--quiet { border-color: transparent; text-decoration: underline; text-underline-offset: .2em; }
.chapter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.chapter-card { position: relative; min-width: 0; border: 1px solid var(--chapter-line); border-radius: 10px; background: #fff; color: var(--chapter-navy); padding: 1.1rem 1.25rem 1rem; display: flex; flex-direction: column; text-decoration: none !important; box-shadow: 0 3px 0 #e4e8ea; transition: border-color .15s, transform .15s, box-shadow .15s; }
.chapter-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; border-radius: 10px 0 0 10px; background: transparent; }
.chapter-card:hover { color: var(--chapter-navy); border-color: var(--chapter-teal); box-shadow: 0 5px 0 #d8edef; transform: translateY(-2px); }
.chapter-card[aria-current] { border-color: #c41e3a; box-shadow: 0 3px 0 #f7dde2; }
.chapter-card[aria-current]::before { background: #c41e3a; }
.chapter-card__top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.chapter-card__number { font: 700 .78rem/1 "Space Mono", monospace; color: #2c4460; }
.chapter-card__count { font: 600 .69rem/1.2 "Nunito", sans-serif; color: #64747d; }
.chapter-card__art { display: block; height: 116px; margin: .6rem -.2rem .75rem; overflow: hidden; }
.chapter-card__art svg, .chapter-card__art img.wiki-webp { width: 100%; height: 100%; display: block; }
.chapter-card__title { display: block; font: 700 1.18rem/1.16 "Space Grotesk", sans-serif; letter-spacing: -.025em; margin-bottom: .6rem; }
.chapter-card__description { display: block; color: #4a4a4a; font: 400 .88rem/1.5 "Nunito", sans-serif; margin-bottom: 1rem; }
.chapter-card__open { display: flex; justify-content: space-between; align-items: center; color: #1f7a82; font: 700 .8rem/1.3 "Nunito", sans-serif; border-top: 1px solid #e7ebed; padding-top: .8rem; margin-top: auto; }
.chapter-card__open span { font-size: 1.1rem; }
.chapter-nojs { margin: 1rem 0 0; padding: 1rem; border-left: 3px solid #1f7a82; background: #f2f7f7; }
body[data-chapter-page] #wikiPage > .wiki-toc, body[data-chapter-page] .wiki-toc-fab { display: none !important; }
body[data-chapter-page] #wikiMain { width: 100%; flex: 0 0 100%; }
.chapter-enhanced #wikiMain > .row { margin-top: 0 !important; }
.chapter-enhanced [data-chapter-content][hidden], .chapter-enhanced [data-chapter-shell][hidden], [data-chapter-chrome][hidden] { display: none !important; }
.chapter-reader { display: contents; }
.chapter-reader__bar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; position: sticky; top: 72px; z-index: 60; background: #fff; padding: .75rem 0; border-top: 1px solid var(--chapter-line); border-bottom: 1px solid var(--chapter-line); box-shadow: 0 8px 12px -12px #2c446055; }
.chapter-reader__back, .chapter-reader__details, .chapter-reader__print { border: 0; background: transparent; color: #2c4460; font: 700 .83rem/1.35 "Nunito", sans-serif; white-space: nowrap; padding: .55rem .65rem; border-radius: 5px; text-decoration: none; cursor: pointer; }
.chapter-reader__back { padding-left: 0; }
.chapter-reader__back span { margin-right: .35rem; }
.chapter-reader__details:hover, .chapter-reader__print:hover, .chapter-reader__back:hover { color: #1f7a82; background: #f2f7f7; }
.chapter-reader__select-label { margin: 0 auto 0 .5rem; min-width: 0; flex: 1 1 240px; max-width: 450px; }
.chapter-reader__select-label select { max-width: 100%; width: 100%; padding: .65rem 2rem .65rem .8rem; border: 1px solid #c7d1d7; background: #f7f9fa; border-radius: 5px; color: #2c4460; font: 700 .87rem/1.2 "Nunito", sans-serif; text-overflow: ellipsis; }
.chapter-reader__heading { padding: 2.2rem 0 1.6rem; scroll-margin-top: 150px; }
.chapter-reader__title { font: 700 clamp(1.9rem, 3.7vw, 3rem)/1.1 "Space Grotesk", sans-serif; letter-spacing: -.04em; color: #2c4460; margin: 0 0 1rem; }
.chapter-reader__sections { display: flex; gap: .45rem; flex-wrap: wrap; }
.chapter-reader__sections a { display: block; border: 1px solid #d4dfe4; border-radius: 4px; padding: .4rem .6rem; font: 700 .75rem/1.35 "Nunito", sans-serif; color: #2c4460; background: #f8fafb; text-decoration: none; }
.chapter-reader__sections a:hover { background: #d8edef; border-color: #1f7a82; }
.chapter-content { min-width: 0; margin-bottom: 2.25rem; }
.chapter-enhanced [data-chapter-content] h2 { scroll-margin-top: 156px; }
.chapter-enhanced [data-chapter-content] h3, .chapter-enhanced [data-chapter-content] h4, .chapter-enhanced [data-chapter-content] [id] { scroll-margin-top: 156px; }
.chapter-enhanced #wikiMain p, .chapter-enhanced #wikiMain li { overflow-wrap: break-word; }
.chapter-enhanced #wikiMain > .row > .col { min-width: 0; }
.chapter-end { display: flex; justify-content: space-between; gap: 1rem; padding: 2rem 0; margin: 1rem 0 0; border-top: 1px solid var(--chapter-line); }
.chapter-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[data-chapter-page] :is(.chapter-card, .chapter-action, .chapter-reader a, .chapter-reader button, .chapter-reader select):focus-visible { outline: 3px solid #c41e3a; outline-offset: 4px; }
/* Existing nested scientific panels remain readable before progressive enhancement. */
body[data-chapter-page]:not(.chapter-enhanced) #wikiMain .collapse:not(.show),
body[data-chapter-page]:not(.chapter-enhanced) #wikiMain .tab-pane { display: block !important; height: auto !important; visibility: visible !important; opacity: 1 !important; }
body[data-chapter-page]:not(.chapter-enhanced) #wikiMain details::details-content { content-visibility: visible; display: block; }
body[data-chapter-page]:not(.chapter-enhanced) #wikiMain details > :not(summary) { display: revert; }
@media (min-width: 1200px) {
  .chapter-grid:not(:has(.chapter-card:nth-child(6))) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .chapter-grid:not(:has(.chapter-card:nth-child(6))) .chapter-card { padding: 1rem .9rem; }
  .chapter-grid:not(:has(.chapter-card:nth-child(6))) .chapter-card__art { height: 105px; }
  .chapter-grid:not(:has(.chapter-card:nth-child(6))) .chapter-card__title { font-size: 1.05rem; }
}
@media (max-width: 991px) { .chapter-index-heading { align-items: start; flex-direction: column; gap: 1rem; } .chapter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575px) {
  body[data-chapter-page] .hero-factory { min-height: 190px; margin-bottom: 1rem !important; }
  .chapter-navigation { padding-top: .25rem; }
  .chapter-grid { grid-template-columns: 1fr; gap: .8rem; }
  .chapter-card { display: grid; grid-template-columns: 95px minmax(0, 1fr); column-gap: .9rem; padding: .85rem; }
  .chapter-card__top { grid-column: 2; margin-bottom: .5rem; }
  .chapter-card__art { grid-column: 1; grid-row: 1 / 5; width: 95px; height: 95px; margin: auto 0; }
  .chapter-card__title { grid-column: 2; font-size: 1.05rem; }
  .chapter-card__description { grid-column: 2; font-size: .8rem; margin-bottom: .6rem; }
  .chapter-card__open { grid-column: 2; font-size: .75rem; padding-top: .5rem; }
  .chapter-reader__bar { top: 62px; gap: .35rem; padding: .5rem 0; }
  .chapter-reader__back { flex-basis: auto; }
  .chapter-reader__select-label { order: 3; flex-basis: 100%; max-width: none; margin: 0; }
  .chapter-reader__details { margin-left: auto; }
  .chapter-reader__print { display: none; }
  .chapter-reader__heading { padding-top: 1.6rem; scroll-margin-top: 180px; }
  .chapter-reader__sections a { max-width: 100%; }
  .chapter-end { flex-direction: column; }
  .chapter-end .chapter-action { justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) { .chapter-card { transition: none; } .chapter-card:hover { transform: none; } }
@media print {
  body[data-chapter-page] .hero-factory { min-height: auto; padding: 1rem 0; }
  body[data-chapter-page] [data-chapter-chrome], body[data-chapter-page] .wiki-toc, body[data-chapter-page] .wiki-toc-fab { display: none !important; }
  body[data-chapter-page] #wikiMain { width: 100% !important; }
  body[data-chapter-page] [data-chapter-content][hidden], body[data-chapter-page] [data-chapter-shell][hidden],
  body[data-chapter-page] #wikiMain [data-gate-panel][hidden], body[data-chapter-page] #wikiMain .collapse,
  body[data-chapter-page] #wikiMain .tab-pane { display: block !important; height: auto !important; visibility: visible !important; opacity: 1 !important; }
  body[data-chapter-page] #wikiMain details::details-content { content-visibility: visible !important; display: block !important; }
  body[data-chapter-page] #wikiMain details > :not(summary) { display: revert !important; }
  body[data-chapter-page] #wikiMain .table-responsive, body[data-chapter-page] #wikiMain .results-plot-scroll { overflow: visible !important; }
  .chapter-content { break-before: auto; }
}
