/* Every subject section owns its own header and can collapse independently. */
.path-unit > .path-header { position: sticky; top: 80px; z-index: 15; padding: 0; background: transparent; }
.path-unit[style*="--topic-rgb"] > .path-header .unit-banner { background: rgb(var(--topic-rgb)); color: #111; }
.path-unit[style*="--topic-rgb"] > .path-header .unit-banner::after { border-color: rgba(255,255,255,.38); }
.unit-banner .unit-title { min-width: 0; flex: 1 1 auto; }
.unit-banner .unit-title h2 { margin: 5px 0 0; font-size: clamp(19px, 2.1vw, 25px); line-height: 1.3; color: #111; }
.unit-banner .unit-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.unit-collapse { width: 48px; min-width: 48px; min-height: 48px; display: inline-grid; place-items: center; padding: 0; border: 2px solid #008da0; border-bottom-width: 5px; border-radius: 13px; background: #fff; color: #075d69; font-weight: 800; white-space: nowrap; cursor: pointer; }
.unit-collapse:focus-visible { outline: 3px solid #004c59; outline-offset: 3px; }
.unit-collapse svg { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.path-unit.is-collapsed { background: transparent !important; }
.path-unit-content[hidden], .math-path-list[hidden] { display: none !important; }
.math-path { margin-bottom: 20px; }
.math-path.is-collapsed { background: transparent !important; }
.math-path .math-unit { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.math-path .math-unit .unit-title { min-width: 0; flex: 1 1 auto; }
.math-path .math-path-list { display: flex; flex-direction: column; overflow: visible; }
.math-path .math-path-row { width: min(320px, calc(100% - 100px)); min-width: 0; margin-left: 0 !important; align-self: center; transform: translateX(0); }
.math-path .math-path-row:nth-child(6n + 2) { transform: translateX(-55px); }
.math-path .math-path-row:nth-child(6n + 3) { transform: translateX(-85px); }
.math-path .math-path-row:nth-child(6n + 4) { transform: translateX(-35px); }
.math-path .math-path-row:nth-child(6n + 5) { transform: translateX(55px); }
.math-path .math-path-row:nth-child(6n + 6) { transform: translateX(85px); }
.math-path .math-path-row > div { min-width: 0; }
@media (max-width: 600px) {
  .path-unit > .path-header { top: 70px; }
  .unit-banner { flex-wrap: wrap; }
  .unit-banner .unit-title { flex-basis: 100%; }
  .unit-banner .unit-actions { margin-left: auto; }
  .unit-collapse { width: 44px; min-width: 44px; min-height: 44px; padding: 0; }
  .math-path .math-unit { padding: 18px; }
  .math-path .math-unit h1 { font-size: 1.35rem; }
  .math-path .math-path-row { width: min(285px, calc(100% - 50px)); gap: 14px; }
  .math-path .math-path-row:nth-child(6n + 2), .math-path .math-path-row:nth-child(6n + 3) { transform: translateX(-22px); }
  .math-path .math-path-row:nth-child(6n + 5), .math-path .math-path-row:nth-child(6n + 6) { transform: translateX(22px); }
  .math-path .math-path-row:nth-child(6n + 4) { transform: translateX(-10px); }
}

/* Mathematics uses the same geography path nodes and lesson popovers. */
.math-path .lesson-popover[hidden] { display: none !important; }
.math-path .path-stop.opened .lesson-popover { width: min(300px, calc(100vw - 48px)); }

/* Course colours interpolate with the learner's scroll position. */
#app[data-path-colours] .main {
  --maqua-blue: rgb(var(--path-live-rgb));
  --maqua-shadow: color-mix(in srgb, rgb(var(--path-live-rgb)) 72%, #17292c);
  --maqua-blue80: color-mix(in srgb, rgb(var(--path-live-rgb)) 80%, white);
  --maqua-blue60: color-mix(in srgb, rgb(var(--path-live-rgb)) 60%, white);
  --maqua-blue40: color-mix(in srgb, rgb(var(--path-live-rgb)) 40%, white);
  --maqua-blue20: color-mix(in srgb, rgb(var(--path-live-rgb)) 20%, white);
}
#app[data-path-colours] .path-unit .path-stop:not(.future) .path-node {
  background: var(--maqua-blue40); box-shadow: 0 8px 0 var(--maqua-blue60); color: #192d31;
}
#app[data-path-colours] .path-unit .path-stop:is(.current,.in-progress) .path-node {
  background: var(--maqua-blue80); box-shadow: 0 8px 0 var(--maqua-shadow); color: #192d31;
}
#app[data-path-colours] .path-unit .path-stop.complete .path-node {
  background: var(--maqua-blue60); box-shadow: 0 8px 0 var(--maqua-blue); color: #192d31;
}
#app[data-path-colours] .path-unit .path-stop:not(.future) .path-node:active { box-shadow: 0 2px 0 var(--maqua-shadow); }
#app[data-path-colours] :is(.path-course-picker,.unit-collapse) { border-color: var(--maqua-shadow); color: var(--maqua-shadow); }
#app[data-path-colours] :is(.start-bubble,.start-bubble:after) { border-color: var(--maqua-blue40); color: var(--maqua-shadow); }
#app[data-path-colours] :is(.path-node,.nav-item,.subject-mark,.course-flag,.path-course-picker,.unit-collapse,.subject-switcher summary,.settings-menu summary,.lesson-popover) { transition: background-color .18s linear, border-color .18s linear, color .18s linear, box-shadow .18s linear; }
@media (prefers-reduced-motion: reduce) { #app[data-path-colours] :is(.path-node,.nav-item,.subject-mark,.course-flag,.path-course-picker,.unit-collapse,.subject-switcher summary,.settings-menu summary,.lesson-popover) { transition: none; } }
