/* Accessibility improvements and final video layout (v19). Loaded last. */
:root { --a11y-focus: #32104f; }
/* Visible keyboard focus on pastel as well as dark-purple surfaces. */
:where(a,button,input,select,textarea,summary,[tabindex]):focus-visible {
  outline: 3px solid #ffd56a !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 6px #3f1169 !important;
}
.skip:focus-visible { z-index: 1000; top: 12px; outline-color: #3f1169 !important; box-shadow: 0 0 0 4px #fff !important; }
main[tabindex="-1"]:focus { outline: none; }
/* Keep controls touchable and legible; do not alter the original palette. */
#primary-nav .sub-toggle { min-height: 32px; min-width: 32px; }
#primary-nav .sub-menu a { min-height: 40px; }
#primary-nav .sub-menu { z-index: 180; }
@media (min-width: 1381px) {
  #primary-nav .nav-item.escape-closed > .sub-menu { display: none !important; }
}
@media (min-width: 981px) and (max-width: 1380px) {
  #primary-nav .nav-item.escape-closed > .sub-menu { display: none !important; }
}
@media (max-width: 980px) {
  #primary-nav .nav-item.escape-closed > .sub-menu { display: none !important; }
}
/* Zoom, long link text and responsive cards must never force horizontal scroll. */
.content-body, .page-hero, .container { min-width: 0; }
.content-body :is(h1,h2,h3,h4,p,a) { overflow-wrap: anywhere; }
button, a { -webkit-tap-highlight-color: rgba(110,39,178,.24); }
/* Avoid obscuring keyboard-focused controls with the fixed sponsor badge. */
.eu-fixed-bubble:focus-within { z-index: 220; }
.eu-fixed-bubble .eu-dismiss { min-width: 30px; min-height: 30px; }
/* Four video-bearing pages: centered two-column strip on large screens,
   never 850px-constrained by legacy .content-body > div style. */
body[data-video-page] .content-shell { display: block !important; }
body[data-video-page] .content-shell > .related { display: none !important; }
body[data-video-page] .main-column, body[data-video-page] .content-body { width: 100%; max-width: none !important; }
body[data-video-page] .content-body > .lesson-grid,
body[data-video-page] .content-body > .video-grid,
body[data-video-page] .content-body > .video-section,
body[data-video-page] .content-body > p.lead {
  box-sizing: border-box;
  width: min(100%, 1100px) !important;
  max-width: 1100px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
body[data-video-page] .lesson-grid,
body[data-video-page] .video-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 28px !important;
  align-items: stretch;
  justify-content: center;
  height: auto !important;
}
body[data-video-page] .lesson,
body[data-video-page] .video-panel {
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  box-sizing: border-box;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
  padding: 22px !important;
  border-radius: 22px;
}
body[data-video-page] .lesson > div,
body[data-video-page] .video-panel > div {
  min-width: 0 !important;
  min-height: auto !important;
  max-height: none !important;
  flex: 1 1 auto !important;
  display: flex;
  flex-direction: column;
}
body[data-video-page] .lesson h2,
body[data-video-page] .video-panel h3 { min-height: 0 !important; margin: 0 0 10px !important; }
body[data-video-page] .lesson p,
body[data-video-page] .video-panel p { min-height: 0 !important; margin: 0 0 14px !important; }
body[data-video-page] .video-mount,
body[data-video-page] .video-embed {
  display: flex !important;
  flex-direction: column !important;
  box-sizing: border-box;
  width: 100% !important;
  max-width: none !important;
  height: auto !important;
  min-height: 0 !important;
  overflow: visible !important;
  aspect-ratio: auto !important;
  flex: 0 0 auto !important;
  gap: 12px !important;
}
body[data-video-page] .video-mount,
body[data-video-page] .video-panel > .video-embed { margin-top: auto !important; }
body[data-video-page] .video-player {
  display: block !important;
  position: relative !important;
  box-sizing: border-box;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  padding: 0 !important;
  margin: 0 !important;
  flex: 0 0 auto !important;
  aspect-ratio: 16 / 9 !important;
  overflow: hidden !important;
}
body[data-video-page] .video-player > iframe {
  position: absolute !important;
  inset: 0 !important;
  display: block;
  width: 100% !important;
  height: 100% !important;
  border: 0;
}
body[data-video-page] .video-external {
  position: relative;
  display: flex !important;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
  width: 100% !important;
  min-height: 46px;
  height: auto !important;
  margin: 0 !important;
  padding: 12px 16px !important;
  border-radius: 12px;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: break-word;
}
/* Ensure the fixed sponsor logo doesn't create a horizontal scrollbar at large zoom. */
.eu-fixed-bubble { max-width: min(360px, 34vw); }
@media (max-width: 760px) {
  body[data-video-page] .lesson-grid,
  body[data-video-page] .video-grid { grid-template-columns: 1fr !important; gap: 22px !important; }
  body[data-video-page] .content-body > .lesson-grid,
  body[data-video-page] .content-body > .video-grid,
  body[data-video-page] .content-body > .video-section,
  body[data-video-page] .content-body > p.lead { width: 100% !important; max-width: none !important; }
  body[data-video-page] .lesson,
  body[data-video-page] .video-panel { padding: 18px !important; }
}
@media (max-width: 420px) {
  body[data-video-page] .lesson,
  body[data-video-page] .video-panel { padding: 15px !important; }
}
@media (prefers-reduced-motion: reduce) {
  .item-card, .gallery a, .video-panel, .lesson, .nav-parent, .sub-menu { transition: none !important; transform: none !important; }
}
@media (forced-colors: active) {
  .video-panel, .lesson, .related, .item-card { border: 1px solid CanvasText !important; }
  .video-external { border: 1px solid LinkText !important; color: LinkText !important; }
  .sub-toggle, .menu-toggle { color: ButtonText !important; }
}
