/* Universal site header. Page styles must not define header presentation. */
@font-face { font-family: 'PG Header'; src: url('/fonts/dm-sans/dm-sans-latin-normal.woff2') format('woff2'); font-weight: 100 1000; font-display: swap; }
:root { --header-height: 72px; --site-header-bg: #f6f4f0; --site-header-text: #20372a; --site-header-border: #d9e2d9; --site-header-hover: #e6f2e8; }
:root[data-theme='dark'] { --site-header-bg: #18211c; --site-header-text: #e2eee4; --site-header-border: #3a4c40; --site-header-hover: #243f30; }
body .site-header { position: sticky; top: 0; z-index: 25; width: 100%; height: var(--header-height); margin: 0; border: 0; border-bottom: 1px solid var(--site-header-border); border-radius: 0; background: var(--site-header-bg); color: var(--site-header-text); font: 16px/1.5 'PG Header', system-ui, sans-serif; transform: none; }
.site-header *, .site-header *::before, .site-header *::after, .header-expansions * { box-sizing: border-box; }
body .site-header > header { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 18px; width: 100%; max-width: none; height: calc(var(--header-height) - 1px); min-height: 0; padding: 0 28px; margin: 0; background: transparent; }
.site-header .header-left, .site-header .header-right, .site-header .site-icon-title { display: flex; align-items: center; gap: 12px; }
.site-header .site-icon-title { color: inherit; text-decoration: none; cursor: pointer; }
.site-header .site-icon-title p { margin: 0; font: 750 20px/1.5 'PG Header', system-ui, sans-serif; letter-spacing: normal; color: inherit; text-align: left; }
.site-header .site-icon-title .logo { display: block; width: 36px; height: 36px; padding: 0; margin: 0; }
.site-header .header-site-nav { display: flex; flex-wrap: nowrap; align-items: center; gap: 24px; margin: 0; height: auto; font-size: 16px; }
.site-header .header-nav-menu { position: relative; margin: 0; }
.site-header .header-nav-menu > summary { display: flex; align-items: center; gap: 6px; padding: 10px 8px; border: 0; border-radius: 8px; color: inherit; font: inherit; font-weight: 650; list-style: none; cursor: pointer; user-select: none; background: transparent; }
.site-header .header-nav-menu > summary::-webkit-details-marker { display: none; }
.site-header .header-nav-menu::after { display: none; }
.site-header .header-nav-link { display: flex; align-items: center; padding: 10px 8px; border-radius: 8px; color: inherit; font: inherit; font-weight: 650; white-space: nowrap; text-decoration: none; }
.site-header .header-nav-link:hover, .site-header .header-nav-menu > summary:hover, .site-header .header-nav-menu[open] > summary { color: inherit; background: var(--site-header-hover); text-decoration: none; }
.site-header .header-nav-chevron { display: inline-grid; place-items: center; flex: 0 0 18px; width: 18px; height: 18px; margin-left: 2px; transition: transform 250ms ease-in-out; }
.site-header .header-nav-chevron svg { display: block; width: 18px; height: 18px; }
.site-header .header-nav-menu[open] .header-nav-chevron { transform: rotate(180deg); }
.site-header .leftnav-toggle-button { display: none; background: transparent; border: 1px solid var(--site-header-border); border-radius: 8px; padding: 5px; }
.site-header .bar { display: block; width: 20px; height: 2px; margin: 4px 0; background: var(--site-header-text); }
body .site-header #theme-toggle-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 9px; margin: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; flex-shrink: 0; cursor: pointer; }
.site-header #theme-toggle-btn:hover { background: var(--site-header-hover); }
.site-header #theme-toggle-btn svg { display: block; width: 22px; height: 22px; }
.site-header :is(a, button, summary):focus-visible, .header-expansions a:focus-visible { outline: 3px solid #9cdbb6; outline-offset: 3px; }
/* Native details provide the same catalog when JavaScript is unavailable. */
.site-header .header-dropdown-panel { position: fixed; top: var(--header-height); left: 50%; right: auto; transform: translateX(-50%); display: grid; width: min(840px, calc(100vw - 40px)); max-height: calc(100dvh - var(--header-height) - 20px); overflow: auto; padding: 24px 28px; gap: 24px; grid-template-columns: repeat(3, minmax(0, 1fr)); background: #18251f; color: #dcebe1; border: 0; border-radius: 0; box-shadow: 0 12px 28px #0002; z-index: 30; }
.site-header .header-nav-menu:not([open]) > .header-dropdown-panel { display: none; }
.site-header .header-compilers-panel { max-width: 600px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.header-expansions { position: sticky; top: var(--header-height); z-index: 24; background: #20784f; color: #dcebe1; color-scheme: dark; overflow-anchor: none; font: 14px/1.5 'PG Header', system-ui, sans-serif; }
.header-expansion { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows 250ms ease-in-out, visibility 250ms; overflow-anchor: none; }
.header-expansion.is-open { grid-template-rows: 1fr; visibility: visible; }
.header-expansion-body { min-height: 0; overflow: hidden; }
/* Clip the animated row; scroll only the full-height inner content. */
.header-expansion-scroll { max-height: calc(100dvh - var(--header-height) - 100px); overflow: auto; overscroll-behavior: contain; }
body .header-expansions .header-dropdown-panel { position: static; inset: auto; display: grid; width: calc(100% - 40px); max-width: 840px; max-height: none; margin: 0 auto; padding: 24px 28px 30px; gap: 24px; border: 0; border-radius: 0; box-shadow: none; background: transparent; overflow: visible; transform: none; }
.header-expansions .header-courses-panel { grid-template-columns: repeat(3, minmax(0, 1fr)); }
body .header-expansions .header-compilers-panel { max-width: 600px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
:is(.site-header, .header-expansions) .header-dropdown-section { display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-width: 0; }
:is(.site-header, .header-expansions) .header-dropdown-heading { display: block; font: 800 13px/1.4 'PG Header', system-ui, sans-serif; color: #fff; letter-spacing: .01em; padding-bottom: 9px; margin-bottom: 4px; border-bottom: 1px solid #ffffff40; }
:is(.site-header, .header-expansions) .header-dropdown-panel a { display: flex; align-items: center; gap: 9px; padding: 5px 0; color: #dcebe1; border-radius: 6px; font: 14px/1.5 'PG Header', system-ui, sans-serif; text-decoration: none; }
:is(.site-header, .header-expansions) .header-dropdown-panel a:hover { color: #b7f0cc; background: #263c30; text-decoration: underline; }
@media (max-width: 900px) {
  body .site-header > header { padding: 0 18px; }
  .site-header .header-site-nav { gap: 12px; font-size: 13px; }
  .site-header .site-icon-title p { font-size: 16px; }
}
@media (max-width: 650px) {
  :root { --header-height: 104px; }
  body .site-header > header { flex-wrap: wrap; gap: 0; padding: 10px 14px 0; }
  .site-header .header-left, .site-header .header-right { height: 44px; }
  .site-header .header-left { gap: 8px; }
  .site-header .header-right { margin-left: auto; }
  .site-header .site-icon-title .logo { width: 28px; height: 28px; }
  .site-header .header-site-nav { display: flex; order: 3; flex-basis: 100%; align-items: center; justify-content: center; gap: 8px; height: 40px; font-size: 13px; }
  .site-header .header-nav-menu > summary, .site-header .header-nav-link { padding: 8px 6px; }
  .site-header .leftnav-toggle-button { display: block; }
  .site-header .header-dropdown-panel { position: fixed; top: var(--header-height); left: 10px; right: 10px; width: auto; transform: none; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body .header-expansions .header-dropdown-panel { width: calc(100% - 24px); padding: 20px 8px 24px; gap: 20px; }
  .header-expansions .header-courses-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 390px) {
  .site-header .header-site-nav { gap: 2px; font-size: 11px; }
  .site-header .header-nav-menu > summary { gap: 2px; padding: 8px 2px; }
  .site-header .header-nav-link { padding: 8px 2px; }
  .site-header .header-nav-chevron { flex-basis: 12px; width: 12px; }
  .site-header .header-nav-chevron svg { width: 12px; height: 12px; }
}
@media (prefers-reduced-motion: reduce) { .header-expansion, .site-header .header-nav-chevron { transition: none; } }

/* Legacy topic drawers use a wider breakpoint than interactive course menus. */
@media (max-width: 1000px) {
  .site-header[data-legacy-drawer] .leftnav-toggle-button { display: block; }
}

:is(.site-header,.header-expansions) .header-topic-icon{display:block;width:20px;height:20px;flex:0 0 20px;object-fit:contain;box-sizing:content-box;padding:3px;border-radius:5px;background:#f4f7f5}

.header-course-column{display:flex;flex-direction:column;gap:24px;min-width:0}
@media(max-width:650px){.header-course-column{display:contents}}
