/* ==========================================================================
   CMU Student Compass — Immersive design system · MODAL CHROME  (workstream D)
   "Vista": the chosen destination photo, softened, behind a luminous paper sheet.

   Covers  #resultsModal (backdrop, sheet, condensing header, segmented tab bar, loader,
           scroll stage, base typography for generated content, error card, chart
           text-alternative panel), the shared .imm-figure / .imm-fold skins, and
           #accessibilityModal.

   Contract reminders (compass.js 960-2000 — do not break):
   · state selectors are single-class: .modal.active, .hidden, .tab-panel.active
   · .loading-state / .results-state / .modal-content are first-match lookups
   · #modalTitle children are replaced on every open (text + p.warning-text + span.result-term-badge)
   · content is emptied 300 ms after close  → exit motion ends within 280 ms
   · Highcharts reflows 100 ms after a tab activates → no persistent transform on chart ancestors
   · focus trap drops elements whose offsetParent is null → no position:fixed on controls

   Public custom properties on #resultsModal (other streams may READ them):
     --imm-modal-pad          inline padding of the scrolling stage
     --imm-modal-pad-bottom   bottom breathing room (keeps the last lines clear of the avatar / help launcher)
     --imm-modal-max          max width of the content column (figures, tables)
     --imm-modal-measure      comfortable width for running text
     --imm-modal-radius       sheet corner radius
     --imm-modal-header-h     current header height in px (modal.js keeps it up to date)
     --imm-modal-tabs-h       current sticky tab-bar height in px (modal.js keeps it up to date)
     --imm-modal-sticky-top   offset to use for `position: sticky; top: …` inside the stage (0 when the tab bar is not sticky)
     --imm-vista-img / --imm-vista-img-lg / --imm-vista-pos   destination photo (small / large) and its focal point
   ========================================================================== */

/* ------------------------------------------------------------------ 1 · scope tokens */
#resultsModal,
#accessibilityModal {
  --imm-modal-gap-x: clamp(12px, 2.5vw, 48px);
  --imm-modal-gap-y: clamp(10px, 2.5vh, 28px);
  --imm-modal-radius: var(--imm-r-xl);
  --imm-modal-pad: clamp(16px, 3.2vw, 48px);
  --imm-modal-pad-bottom: clamp(96px, 15vh, 160px);
  --imm-modal-max: 1200px;
  --imm-modal-measure: 46rem;
  --imm-modal-header-h: 172px;
  --imm-modal-tabs-h: 74px;
  --imm-modal-sticky-top: var(--imm-modal-tabs-h);
  /* No photo is requested while a modal has never been used: the closed roots stay in the layout
     (visibility:hidden), so an unconditional url() would download on every page view. */
  --imm-vista-img: none;
  --imm-vista-img-lg: none;
  --imm-vista-pos: 50% 40%;
  --imm-vista-label: 'VISTA';
}
/* default destination (hand + brass compass) — results modal opened without a known menu, accessibility modal */
#resultsModal.active:not([data-program]),
#accessibilityModal.active, #accessibilityModal.imm-armed {
  --imm-vista-img: url('../../images/immersive/dest-default-768.webp');
  --imm-vista-img-lg: url('../../images/immersive/dest-default-768.webp');
}
#resultsModal[data-program='sw'] { --imm-vista-img: url('../../images/immersive/dest-sw-768.webp'); --imm-vista-img-lg: url('../../images/immersive/dest-sw-768.webp'); --imm-vista-pos: 60% 62%; --imm-vista-label: 'VISTA · STRENGTHS & GROWTH'; }
#resultsModal[data-program='el'] { --imm-vista-img: url('../../images/immersive/dest-el-768.webp'); --imm-vista-img-lg: url('../../images/immersive/dest-el-768.webp'); --imm-vista-pos: 50% 55%; --imm-vista-label: 'VISTA · MAJOR ELECTIVES'; }
#resultsModal[data-program='fe'] { --imm-vista-img: url('../../images/immersive/dest-fe-768.webp'); --imm-vista-img-lg: url('../../images/immersive/dest-fe-768.webp'); --imm-vista-pos: 50% 80%; --imm-vista-label: 'VISTA · FREE ELECTIVES'; }
#resultsModal[data-program='oc'] { --imm-vista-img: url('../../images/immersive/dest-oc-768.webp'); --imm-vista-img-lg: url('../../images/immersive/dest-oc-768.webp'); --imm-vista-pos: 50% 58%; --imm-vista-label: 'VISTA · CAREER PATHS'; }
#resultsModal[data-program='qq'] { --imm-vista-img: url('../../images/immersive/dest-qq-768.webp'); --imm-vista-img-lg: url('../../images/immersive/dest-qq-768.webp'); --imm-vista-pos: 50% 66%; --imm-vista-label: 'VISTA · FEEDBACK'; }
@media (min-width: 1280px) {
  /* crisp header band on large sheets; the blurred backdrop always uses the small file */
  #resultsModal[data-program='sw'] { --imm-vista-img-lg: url('../../images/immersive/dest-sw.webp'); }
  #resultsModal[data-program='el'] { --imm-vista-img-lg: url('../../images/immersive/dest-el.webp'); }
  #resultsModal[data-program='fe'] { --imm-vista-img-lg: url('../../images/immersive/dest-fe.webp'); }
  #resultsModal[data-program='oc'] { --imm-vista-img-lg: url('../../images/immersive/dest-oc.webp'); }
  #resultsModal[data-program='qq'] { --imm-vista-img-lg: url('../../images/immersive/dest-qq.webp'); }
}

/* State guards. The legacy `.hidden { display:none }` and UA `[hidden]` rules lose to any unlayered `display`
   declaration, so they are re-asserted here with !important (required: must beat component display rules). */
#resultsModal .hidden { display: none !important; }
#resultsModal [hidden], #accessibilityModal [hidden] { display: none !important; }
/* A closed modal is only visibility:hidden (see §2), so its loader / sparkle loops would keep ticking on every
   frame of the landing page. !important: component rules that use the `animation` shorthand reset the play state. */
.modal:not(.active) *, .modal:not(.active) *::before, .modal:not(.active) *::after { animation-play-state: paused !important; }

/* ------------------------------------------------------------------ 2 · modal root: open / close */
/* Legacy toggled display:none ↔ flex, which made every transition dead. The root now stays in the layout and is
   switched with visibility/opacity so both directions animate. Exit = 0.22 s (content is emptied at 300 ms). */
.modal {
  position: fixed; inset: 0; width: auto; height: auto;
  display: flex; align-items: center; justify-content: center;
  visibility: hidden; opacity: 0; pointer-events: none;
  transition: opacity 0.22s ease, visibility 0s linear 0.24s;
  -webkit-tap-highlight-color: transparent;
}
.modal.active {
  visibility: visible; opacity: 1; pointer-events: auto;
  transition: opacity 0.4s ease, visibility 0s linear 0s;
}

/* ------------------------------------------------------------------ 3 · vista backdrop */
.modal-overlay {
  position: absolute; inset: 0; width: auto; height: auto; overflow: hidden;
  background: var(--imm-night);
  -webkit-backdrop-filter: none; backdrop-filter: none; /* legacy blurred the live page every frame */
  cursor: pointer;
}
.imm-backdrop {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none;
  /* --imm-mx / --imm-my: pointer parallax numbers published by modal.js (fine pointers, motion allowed) */
  transform: translate3d(calc(var(--imm-mx, 0) * -14px), calc(var(--imm-my, 0) * -9px), 0) scale(1.04);
}
/* Blur a SMALL raster and scale it up 4× — a full-screen blur would be repainted on every frame of the reveal. */
.imm-backdrop__soft {
  position: absolute; left: -3%; top: -3%; width: 26.5%; height: 26.5%;
  transform-origin: 0 0; transform: scale(4);
  background: var(--imm-vista-img) var(--imm-vista-pos) / cover no-repeat;
  filter: blur(6px) saturate(1.25);
}
.imm-backdrop__sharp {
  position: absolute; inset: -2%;
  background: var(--imm-vista-img-lg) var(--imm-vista-pos) / cover no-repeat;
  opacity: 0;
}
.imm-backdrop__tint {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 50% 8%, rgba(37, 29, 90, 0.12) 0%, rgba(10, 9, 32, 0.66) 78%),
    linear-gradient(180deg, rgba(10, 9, 32, 0.42) 0%, rgba(10, 9, 32, 0.18) 34%, rgba(10, 9, 32, 0.62) 100%);
}
.modal.active .imm-backdrop { animation: imm-backdrop-settle 1.8s var(--imm-ease-out) backwards; }
.modal.active .imm-backdrop__soft { will-change: transform; }
.modal.active .imm-backdrop__sharp { animation: imm-backdrop-sharp 1.25s ease 0.05s backwards; }
@keyframes imm-backdrop-settle { from { transform: scale(1.12); } }
@keyframes imm-backdrop-sharp { from { opacity: 0.96; } to { opacity: 0; } }
/* the destination keeps breathing behind the sheet (outside the reading area; composited transform only) */
@media (min-width: 769px) {
  .modal.active .imm-backdrop__soft { animation: imm-backdrop-drift 38s var(--imm-ease-in-out) 1.8s infinite alternate; }
}
@keyframes imm-backdrop-drift { from { transform: scale(4); } to { transform: scale(4.22) translate3d(-0.9%, -0.5%, 0); } }

/* ------------------------------------------------------------------ 4 · the sheet */
.modal-container {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  overflow: hidden; overflow: clip; /* clip: cannot be scrolled programmatically (focus / scrollIntoView) */
  width: min(100% - 2 * var(--imm-modal-gap-x), 1680px); max-width: none;
  height: calc(100% - 2 * var(--imm-modal-gap-y)); max-height: none;
  margin: 0;
  color: var(--imm-text);
  background:
    radial-gradient(900px 360px at 8% -12%, rgba(250, 172, 30, 0.1), rgba(250, 172, 30, 0) 62%),
    var(--imm-surface);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: var(--imm-modal-radius);
  box-shadow: 0 44px 120px rgba(5, 4, 20, 0.55), 0 10px 28px rgba(5, 4, 20, 0.28);
  opacity: 0; transform: translate3d(0, 16px, 0) scale(0.985);
  transition: opacity 0.2s ease, transform 0.24s var(--imm-ease-in-out);
}
/* Enter runs as an animation (fill: backwards) so NO transform is left on chart ancestors afterwards. */
.modal.active .modal-container {
  opacity: 1; transform: none; transition: none;
  animation: imm-sheet-in 0.95s var(--imm-ease-out) 0.08s backwards;
}
@keyframes imm-sheet-in {
  from { opacity: 0; transform: translate3d(0, 64px, 0) scale(0.955); }
  45% { opacity: 1; }
  to { opacity: 1; transform: none; }
}
@keyframes imm-sheet-up {
  from { opacity: 0.4; transform: translate3d(0, 46%, 0); }
  to { opacity: 1; transform: none; }
}
.modal-container:focus { outline: none; }
.modal-container:focus-visible { outline: 2px solid var(--imm-gold-400); outline-offset: -6px; }

/* scrolling stage — .modal-content is THE scroll container of each sheet */
.modal-content {
  position: relative; flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  padding: 0 var(--imm-modal-pad);
  overflow-x: hidden; overflow-y: auto;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; scrollbar-color: var(--imm-violet-300) transparent;
  scrollbar-gutter: stable;
}

/* ------------------------------------------------------------------ 5 · results header ("title sequence") */
#resultsModal .modal-header {
  position: relative; top: auto; z-index: 3; flex: none;
  display: block; padding: 0; border: 0;
  background: transparent; color: var(--imm-text);
}
/* destination photo band (sharp) — dissolves into the paper towards the text */
.imm-modal-head__photo {
  position: absolute; inset: 0 0 0 auto; width: clamp(280px, 52%, 860px); z-index: 0; pointer-events: none;
  background: var(--imm-vista-img-lg) var(--imm-vista-pos) / cover no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.28) 30%, rgba(0, 0, 0, 0.9) 70%, #000 100%);
  mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.28) 30%, rgba(0, 0, 0, 0.9) 70%, #000 100%);
  transform: translate3d(calc(var(--imm-mx, 0) * -8px), calc(var(--imm-my, 0) * -5px), 0) scale(1.05);
  transition: opacity 0.5s ease;
}
.imm-modal-head__photo::after { /* paper rises from below so the tab bar sits on a clean ground */
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255, 253, 248, 0) 46%, var(--imm-surface) 100%);
}
.modal.active .imm-modal-head__photo { animation: imm-head-photo 1.5s var(--imm-ease-out) 0.25s backwards; }
@keyframes imm-head-photo {
  from { opacity: 0; clip-path: inset(0 0 0 60%); }
  to { opacity: 1; clip-path: inset(0 0 0 0); }
}

.imm-modal-head__bar {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 10px;
  padding: clamp(12px, 1.6vw, 18px) clamp(14px, 2vw, 22px) 0 var(--imm-modal-pad);
  transition: padding 0.45s var(--imm-ease-out);
}

/* back button — adopted by compass.js via its id; the legacy fixed/hidden floating pill is fully reset */
.main-menu-back-button {
  position: relative; inset: auto; z-index: auto;
  display: inline-flex; align-items: center; gap: 0.55em;
  min-height: 44px; max-width: none; padding: 5px 1.1em 5px 5px;
  border: 1px solid var(--imm-line); border-radius: var(--imm-r-pill);
  background: var(--imm-glass-bg-strong); color: var(--imm-violet-800);
  font: inherit; font-size: var(--imm-fs-sm); font-weight: 500; line-height: 1.2; white-space: nowrap;
  box-shadow: var(--imm-shadow-1);
  opacity: 1; transform: none; pointer-events: auto; cursor: pointer;
  -webkit-backdrop-filter: blur(10px) saturate(1.3); backdrop-filter: blur(10px) saturate(1.3);
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease, padding 0.45s var(--imm-ease-out), gap 0.45s var(--imm-ease-out);
}
.main-menu-back-button.active { opacity: 1; transform: none; }
.main-menu-back-button-icon {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 50%; background: var(--imm-grad-brand); color: #fff; font-size: 1rem; line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 0.5s var(--imm-ease-spring);
}
.main-menu-back-button-text {
  display: inline-block; max-width: 12em; overflow: hidden;
  transition: max-width 0.45s var(--imm-ease-out), opacity 0.3s ease;
}
.main-menu-back-button:focus-visible { outline: 2px solid var(--imm-gold-400); outline-offset: 3px; box-shadow: var(--imm-shadow-1); }
@media (hover: hover) {
  .main-menu-back-button:hover { border-color: var(--imm-line-gold); box-shadow: var(--imm-shadow-2); background: #fff; }
  .main-menu-back-button:hover .main-menu-back-button-icon { transform: translate3d(-3px, 0, 0); }
}

/* compact title that takes over when the header condenses (text mirrored by modal.js, aria-hidden) */
.imm-modal-head__mini {
  display: flex; align-items: center; gap: 0.7em; min-width: 0; margin: 0; padding-inline: 4px;
  opacity: 0; transform: translate3d(0, 8px, 0); pointer-events: none;
  transition: opacity 0.3s ease, transform 0.5s var(--imm-ease-out);
}
.imm-modal-head__mini-title {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: var(--imm-fs-lg); font-weight: 500; line-height: 1.5; color: var(--imm-ink);
}
.imm-modal-head__mini-term {
  flex: none; padding: 0.2em 0.8em; border-radius: var(--imm-r-pill);
  font-size: var(--imm-fs-xs); font-weight: 500; line-height: 1.5; white-space: nowrap;
  color: var(--imm-gold-700); background: rgba(250, 172, 30, 0.14); border: 1px solid rgba(250, 172, 30, 0.4);
}
.imm-modal-head__mini-term:empty { display: none; }

/* AI-disclaimer fold toggle (phones always; larger screens only while condensed) */
.imm-modal-note-toggle {
  display: none; align-items: center; gap: 0.45em;
  min-height: 44px; padding: 0 0.95em 0 0.7em;
  border: 1px solid rgba(250, 172, 30, 0.5); border-radius: var(--imm-r-pill);
  background: rgba(255, 249, 232, 0.9); color: var(--imm-gold-700);
  font: inherit; font-size: var(--imm-fs-xs); font-weight: 500; line-height: 1.2; white-space: nowrap;
  box-shadow: var(--imm-shadow-1); cursor: pointer;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: background-color 0.3s ease, border-color 0.3s ease, padding 0.45s var(--imm-ease-out);
}
.imm-modal-note-toggle__icon { display: grid; place-items: center; flex: none; }
.imm-modal-note-toggle .imm-chevron { margin-left: 0.15em; }
.imm-modal-note-toggle[aria-expanded='true'] { background: var(--imm-gold-100); border-color: var(--imm-gold-400); }

/* close */
.close-button {
  position: relative; flex: none; display: grid; place-items: center;
  width: 48px; height: 48px; padding: 0;
  border: 1px solid var(--imm-line); border-radius: 50%;
  background: var(--imm-glass-bg-strong); color: var(--imm-violet-800);
  box-shadow: var(--imm-shadow-1); cursor: pointer;
  -webkit-backdrop-filter: blur(10px) saturate(1.3); backdrop-filter: blur(10px) saturate(1.3);
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}
.close-button svg { transition: transform 0.6s var(--imm-ease-spring); }
.close-button:active { transform: scale(0.94); }
.close-button:focus-visible { outline: 2px solid var(--imm-gold-400); outline-offset: 3px; }
@media (hover: hover) {
  .close-button:hover { background: var(--imm-violet-800); color: #fff; border-color: transparent; box-shadow: var(--imm-shadow-violet); }
  .close-button:hover svg { transform: rotate(90deg); }
}

/* hero block: eyebrow + big title + disclaimer + term chip; collapses when the stage scrolls */
.imm-modal-head__hero {
  position: relative; z-index: 1;
  display: grid; grid-template-rows: 1fr;
  transition: grid-template-rows 0.6s var(--imm-ease-out), opacity 0.35s ease;
}
.imm-modal-head__hero-inner { min-height: 0; overflow: hidden; padding-inline: var(--imm-modal-pad); }
.imm-modal-head__eyebrow { margin: clamp(8px, 1.2vw, 14px) 0 0; white-space: nowrap; }
.imm-modal-head__eyebrow::after { content: var(--imm-vista-label); }

#modalTitle {
  display: flex; flex-wrap: wrap; align-items: center; column-gap: 0.4em; row-gap: 2px;
  max-width: min(100%, 62rem);
  margin: 2px 0 clamp(10px, 1.4vw, 18px);
  font-size: var(--imm-fs-2xl); font-weight: 600; line-height: 1.28; letter-spacing: 0;
  color: var(--imm-violet-800);
  /* gradient measured in em so short and long titles both travel from violet towards gold */
  background-image: linear-gradient(96deg, #2b275b 0, #6868ac 7.5em, #b0780a 16.5em);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
#modalTitle .result-term-badge {
  order: 1; flex: none; display: inline-flex; align-items: center; gap: 0.5em;
  margin: 0; padding: 0.28em 0.95em; border-radius: var(--imm-r-pill);
  font-size: var(--imm-fs-xs); font-weight: 500; line-height: 1.5; white-space: nowrap;
  color: var(--imm-gold-700); -webkit-text-fill-color: currentColor;
  background: rgba(250, 172, 30, 0.14); border: 1px solid rgba(250, 172, 30, 0.42);
  animation: imm-fade-up 0.7s var(--imm-ease-out) backwards;
}
#modalTitle .result-term-badge::before { content: ''; width: 0.5em; height: 0.5em; border-radius: 50%; background: var(--imm-grad-gold); box-shadow: 0 0 0 3px rgba(250, 172, 30, 0.2); }
#modalTitle .warning-text {
  order: 2; flex: 0 0 100%; max-width: 46rem; min-height: 0;
  margin: 0; font-size: var(--imm-fs-xs); font-weight: 300; line-height: 1.6;
  color: var(--imm-ink-3); -webkit-text-fill-color: currentColor;
}

/* staggered entrance of the header pieces */
.modal.active .imm-modal-head__bar { animation: imm-fade-up 0.8s var(--imm-ease-out) 0.3s backwards; }
.modal.active .imm-modal-head__hero-inner { animation: imm-fade-up 0.9s var(--imm-ease-out) 0.4s backwards; }
@keyframes imm-note-unfold { from { opacity: 0; filter: blur(4px); transform: translate3d(0, -6px, 0); } }

/* condensed header — class set by modal.js once the stage has scrolled (and forced on landscape phones) */
.imm-sheet.is-condensed:not(.is-note-open) .imm-modal-head__hero { grid-template-rows: 0fr; opacity: 0; }
.imm-sheet.is-condensed .imm-modal-head__bar { padding-top: 10px; padding-bottom: 10px; }
.imm-sheet.is-condensed .imm-modal-head__mini { opacity: 1; transform: none; }
.imm-sheet.is-condensed.is-note-open .imm-modal-head__mini { opacity: 0; }
.imm-sheet.is-condensed .main-menu-back-button { padding-right: 5px; gap: 0; }
.imm-sheet.is-condensed .main-menu-back-button-text { max-width: 0; opacity: 0; }
.imm-sheet.is-condensed .imm-modal-head__photo { opacity: 0.55; }
.imm-sheet.is-enhanced.is-condensed .imm-modal-note-toggle { display: inline-flex; padding: 0 0.7em; }
.imm-sheet.is-enhanced.is-condensed .imm-modal-note-toggle__label { display: none; }
/* modal.js: the header changes size in a single frame (with a matching scroll correction on desktops, or already
   compact when a phone opens the sheet) — no height animation that would drag the content under the finger */
.imm-sheet.is-snap :is(.imm-modal-head__hero, .imm-modal-head__bar, .main-menu-back-button, .main-menu-back-button-text) { transition: none !important; }

/* ------------------------------------------------------------------ 6 · segmented tab bar */
.imm-tabsbar {
  position: sticky; top: 0; z-index: 6;
  margin: 0 calc(-1 * var(--imm-modal-pad)); padding: clamp(8px, 1.2vw, 14px) var(--imm-modal-pad) clamp(14px, 1.6vw, 20px);
  background: linear-gradient(180deg, var(--imm-surface) 0%, var(--imm-surface) 74%, rgba(255, 253, 248, 0) 100%);
}
.tabs-nav {
  position: relative; isolation: isolate;
  display: flex; align-items: stretch; gap: 4px;
  width: fit-content; max-width: 100%; margin: 0 auto; padding: 5px;
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; scroll-padding-inline: 28px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--imm-line); border-radius: var(--imm-r-pill);
  background: rgba(104, 104, 172, 0.08);
  box-shadow: inset 0 1px 3px rgba(27, 24, 56, 0.07);
}
.tabs-nav::-webkit-scrollbar { display: none; }
.tabs-nav:empty, .imm-tabsbar:has(> .tabs-nav:empty) { display: none; } /* error state: no tabs were built */
/* edge fades appear only where more tabs are hiding (classes set by modal.js) */
.tabs-nav.can-start { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 34px); mask-image: linear-gradient(90deg, transparent 0, #000 34px); }
.tabs-nav.can-end { -webkit-mask-image: linear-gradient(270deg, transparent 0, #000 34px); mask-image: linear-gradient(270deg, transparent 0, #000 34px); }
.tabs-nav.can-start.can-end { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 34px, #000 calc(100% - 34px), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 34px, #000 calc(100% - 34px), transparent 100%); }

.tabs-nav .tab-button {
  position: relative; z-index: 1; flex: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45em;
  min-height: 44px; padding: 0.45em 1.3em;
  border: 0; border-radius: var(--imm-r-pill); background: transparent;
  color: var(--imm-ink-2); font: inherit; font-size: var(--imm-fs-sm); font-weight: 500; line-height: 1.3; white-space: nowrap;
  scroll-snap-align: center; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: color 0.35s ease, background-color 0.35s ease;
}
.tabs-nav .tab-button:focus-visible { outline: 2px solid var(--imm-gold-400); outline-offset: -2px; border-radius: var(--imm-r-pill); }
@media (hover: hover) {
  .tabs-nav .tab-button:not(.active):hover { color: var(--imm-violet-800); background: rgba(255, 255, 255, 0.75); }
}
.tabs-nav .tab-button.active {
  color: #fff; background: var(--imm-grad-brand);
  box-shadow: 0 4px 12px rgba(104, 104, 172, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
/* "ถามได้นะ!" — gold accent + sparkle */
.tabs-nav .tab-button[data-tab='QA'] { color: var(--imm-gold-700); }
.tabs-nav .tab-button[data-tab='QA']::before {
  content: ''; flex: none; width: 1.05em; height: 1.05em; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 2.5 11.9 8.6 18 10.5 11.9 12.4 10 18.5 8.1 12.4 2 10.5 8.1 8.6zM18.5 14l1 3 3 1-3 1-1 3-1-3-3-1 3-1z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 2.5 11.9 8.6 18 10.5 11.9 12.4 10 18.5 8.1 12.4 2 10.5 8.1 8.6zM18.5 14l1 3 3 1-3 1-1 3-1-3-3-1 3-1z'/%3E%3C/svg%3E") center / contain no-repeat;
  animation: imm-tab-sparkle 3.6s ease-in-out infinite;
}
.tabs-nav .tab-button[data-tab='QA'].active { color: #2b1d00; background: var(--imm-grad-gold); box-shadow: 0 4px 12px rgba(250, 172, 30, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.4); }
@keyframes imm-tab-sparkle { 0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; } 50% { transform: scale(0.82) rotate(18deg); opacity: 0.7; } }
/* AI chat switched off until the new token (owner 2026-11-19, compass.js): greyed, not clickable, a "coming soon" badge */
.tabs-nav .tab-button.is-soon, .tabs-nav .tab-button[data-tab='QA'].is-soon { color: var(--imm-ink-3); cursor: not-allowed; filter: grayscale(1); opacity: 0.6; }
.tabs-nav .tab-button.is-soon::before { animation: none; }
.tabs-nav .tab-button.is-soon:not(.active):hover { color: var(--imm-ink-3); background: none; }
.tab-soon {
  display: inline-flex; align-items: center; margin-left: 0.15em; padding: 0.08em 0.55em; border-radius: var(--imm-r-pill);
  background: rgba(27, 24, 56, 0.08); font-size: var(--imm-fs-2xs); font-weight: 500; line-height: 1.4; color: var(--imm-ink-3); white-space: nowrap;
}

/* sliding indicator (modal.js publishes --imm-tab-x / --imm-tab-w and adds .has-indicator) */
.tabs-nav::before, .tabs-nav::after {
  content: ''; position: absolute; z-index: 0; left: 0; top: 5px; height: calc(100% - 10px);
  width: var(--imm-tab-w, 0px); transform: translate3d(var(--imm-tab-x, 0px), 0, 0);
  border-radius: var(--imm-r-pill); pointer-events: none; opacity: 0;
  transition: transform 0.6s var(--imm-ease-out), width 0.6s var(--imm-ease-out), opacity 0.3s ease;
}
.tabs-nav::before { background: var(--imm-grad-brand); box-shadow: 0 4px 12px rgba(104, 104, 172, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.28); }
.tabs-nav::after { background: var(--imm-grad-gold); box-shadow: 0 4px 12px rgba(250, 172, 30, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.4); }
.tabs-nav.has-indicator::before { opacity: 1; }
.tabs-nav.has-indicator.is-qa::before { opacity: 0; }
.tabs-nav.has-indicator.is-qa::after { opacity: 1; }
.tabs-nav.has-indicator .tab-button.active { background: transparent; box-shadow: none; }
.tabs-nav.no-anim::before, .tabs-nav.no-anim::after { transition: none; }

.tab-qa { display: none; margin: 0; } /* pure state marker (#tabQa.active while the Q&A tab is open) */

/* ------------------------------------------------------------------ 7 · results stage */
.results-state:not(.hidden) { display: block; flex: 1 0 auto; min-width: 0; }
.tab-content {
  width: 100%; max-width: var(--imm-modal-max); min-height: 0;
  margin: 0 auto; padding: clamp(4px, 1vw, 14px) 0 var(--imm-modal-pad-bottom);
  color: var(--imm-ink-2); font-size: var(--imm-fs-md); line-height: var(--imm-lh-body);
  border-radius: 0;
  /* !important: compass.js writes an inline `background-color:#fff` on #tabContent after the feedback menu was opened */
  background: transparent !important;
}
.tab-panel { padding: 0; }
.tab-panel.active {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  width: 100%; min-width: 0;
  /* opacity/translate only, fill backwards: nothing is left on chart ancestors when it ends */
  animation: imm-panel-in 0.55s var(--imm-ease-out) backwards;
}
@keyframes imm-panel-in { from { opacity: 0; transform: translate3d(0, 12px, 0); } to { opacity: 1; transform: none; } }

/* Safety net for generated blocks sized in viewport units (100vw charts etc.): never wider than the column.
   Zero specificity — any component rule wins. */
:where(.tab-panel) > :where(*) { max-width: 100%; min-width: 0; }

/* ------------------------------------------------------------------ 8 · loading state */
#results-modal-status:not(.hidden) {
  position: relative; isolation: isolate; flex: 1 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; align-content: center; gap: clamp(12px, 2vh, 20px);
  min-height: min(100%, 420px); padding: clamp(24px, 6vh, 72px) 0 clamp(40px, 9vh, 110px);
  text-align: center;
}
.imm-modal-loading__wash {
  position: absolute; z-index: -1; inset: 0 calc(-1 * var(--imm-modal-pad));
  background: var(--imm-vista-img-lg) 50% 46% / cover no-repeat;
  opacity: 0.24;
  /* the mask reaches full transparency before every edge, so the wash never shows a seam against the header */
  -webkit-mask-image: radial-gradient(ellipse 58% 47% at 50% 47%, #000 0%, rgba(0, 0, 0, 0.55) 48%, transparent 100%);
  mask-image: radial-gradient(ellipse 58% 47% at 50% 47%, #000 0%, rgba(0, 0, 0, 0.55) 48%, transparent 100%);
  animation: imm-loading-wash 14s ease-in-out infinite alternate;
}
@keyframes imm-loading-wash { from { transform: scale(1.04) translate3d(-1.2%, 0, 0); } to { transform: scale(1.1) translate3d(1.2%, -1%, 0); } }
.imm-modal-loading__dial {
  position: relative; display: grid; place-items: center;
  width: clamp(124px, 22vmin, 164px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, rgba(255, 253, 248, 0.96) 52%, rgba(255, 253, 248, 0) 71%);
}
.imm-modal-loading__dial::before { /* degree ticks */
  content: ''; position: absolute; inset: 7%; border-radius: 50%;
  background: repeating-conic-gradient(from -0.6deg, var(--imm-violet-400) 0 1.2deg, transparent 1.2deg 15deg);
  -webkit-mask: radial-gradient(circle, transparent 0 86%, #000 87% 100%); mask: radial-gradient(circle, transparent 0 86%, #000 87% 100%);
  opacity: 0.55; animation: imm-spin 36s linear infinite;
}
.imm-modal-loading__dial::after { /* soft sonar ring */
  content: ''; position: absolute; inset: 16%; border-radius: 50%; border: 1px solid var(--imm-gold-400);
  animation: imm-pulse-ring 2.6s var(--imm-ease-out) infinite;
}
.imm-modal-loading__dial .imm-loader { --_s: clamp(74px, 13vmin, 96px); }
#results-modal-status .imm-modal-loading__text {
  margin: 0; font-size: var(--imm-fs-lg); font-weight: 500; line-height: 1.5; color: var(--imm-violet-800);
}
.imm-modal-loading__skeleton { display: grid; justify-items: center; gap: 12px; width: min(100%, 340px); margin-top: 6px; }
.imm-skeleton-row {
  display: block; height: 10px; width: 100%; border-radius: var(--imm-r-pill);
  background: linear-gradient(100deg, rgba(104, 104, 172, 0.12) 28%, rgba(250, 172, 30, 0.3) 46%, rgba(104, 104, 172, 0.12) 64%) 0 0 / 220% 100% no-repeat, rgba(104, 104, 172, 0.1);
  animation: imm-shimmer 1.9s linear infinite;
}
.imm-skeleton-row:nth-child(2) { width: 78%; animation-delay: 0.18s; }
.imm-skeleton-row:nth-child(3) { width: 54%; animation-delay: 0.36s; }

/* ------------------------------------------------------------------ 9 · base typography for generated content
   ZERO specificity (:where) — every component rule in results-analysis / results-courses / companions wins. */
:where(.tab-panel) > :where(h1, h2, h3, h4, h5, p, ul, ol, blockquote, hr) { width: min(100%, var(--imm-modal-measure)); }
:where(.tab-panel) > :where(h1, h2) { text-align: center; } /* section titles sit centred above full-width figures */
:where(#tabContent h1) { margin: 1.5em 0 0.5em; font-size: var(--imm-fs-xl); font-weight: 600; line-height: var(--imm-lh-snug); color: var(--imm-ink); text-wrap: balance; }
:where(#tabContent h2) { margin: 1.4em 0 0.5em; font-size: var(--imm-fs-lg); font-weight: 600; line-height: var(--imm-lh-snug); color: var(--imm-ink); text-wrap: balance; }
:where(#tabContent h3) { margin: 1.2em 0 0.4em; font-size: var(--imm-fs-md); font-weight: 600; line-height: 1.45; color: var(--imm-violet-700); }
:where(#tabContent h4, #tabContent h5) { margin: 1em 0 0.3em; font-size: var(--imm-fs-md); font-weight: 500; line-height: 1.45; color: var(--imm-ink-2); }
:where(#tabContent p) { margin: 0 0 0.9em; }
:where(#tabContent ul, #tabContent ol) { margin: 0 0 1em; padding-left: 1.5em; }
:where(#tabContent ul ul, #tabContent ol ol, #tabContent ul ol, #tabContent ol ul) { margin: 0.4em 0 0.2em; }
:where(#tabContent li) { margin: 0.3em 0; padding-left: 0.15em; }
:where(#tabContent li)::marker { color: var(--imm-gold-500); font-weight: 500; }
:where(#tabContent b, #tabContent strong) { font-weight: 600; color: var(--imm-ink); }
:where(#tabContent a) { color: var(--imm-violet-600); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; transition: color 0.2s ease; }
:where(#tabContent a:hover) { color: var(--imm-gold-600); }
:where(#tabContent hr) { height: 1px; margin: 1.8em 0; border: 0; background: linear-gradient(90deg, transparent, var(--imm-line-strong), transparent); }
:where(#tabContent blockquote) { margin: 1.2em 0; padding: 0.4em 0 0.4em 1.1em; border-left: 3px solid var(--imm-gold-400); color: var(--imm-ink-2); font-weight: 300; }
:where(#tabContent code) { padding: 0.1em 0.4em; border-radius: 6px; background: rgba(104, 104, 172, 0.1); font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; font-size: 0.9em; }
:where(#tabContent pre) { max-width: 100%; margin: 1em 0; padding: 1em 1.2em; overflow-x: auto; border-radius: var(--imm-r-sm); background: rgba(104, 104, 172, 0.08); }
:where(#tabContent pre code) { padding: 0; background: none; }
:where(#tabContent img) { max-width: 100%; height: auto; }
:where(#tabContent table) { width: 100%; margin-top: 1.2em; border-collapse: separate; border-spacing: 0; font-size: var(--imm-fs-sm); line-height: 1.55; }
:where(#tabContent th) { padding: 0.75em 0.95em; text-align: left; vertical-align: bottom; font-weight: 500; color: var(--imm-violet-800); background: rgba(104, 104, 172, 0.09); border-bottom: 1px solid var(--imm-line-strong); }
:where(#tabContent td) { padding: 0.7em 0.95em; vertical-align: top; border-bottom: 1px solid var(--imm-line); }
:where(#tabContent .warning-text) { margin: 0.6em 0 1.2em; font-size: var(--imm-fs-xs); font-weight: 300; line-height: 1.6; color: var(--imm-ink-3); }
/* first / last element of a panel never adds stray outer space */
:where(.tab-panel) > :where(:first-child) { margin-top: 0; }
:where(.tab-panel) > :where(:last-child) { margin-bottom: 0; }

/* ------------------------------------------------------------------ 10 · error card + chart text alternative */
.error-message {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0 clamp(14px, 2vw, 22px);
  width: min(100%, 44rem); margin: clamp(20px, 5vh, 56px) auto 0; padding: clamp(18px, 2.6vw, 28px);
  border: 1px solid rgba(201, 58, 85, 0.28); border-radius: var(--imm-r-lg);
  background: linear-gradient(135deg, rgba(201, 58, 85, 0.07), rgba(250, 172, 30, 0.07)), var(--imm-surface);
  box-shadow: var(--imm-shadow-2);
  color: var(--imm-ink-2); font-size: var(--imm-fs-md); line-height: 1.7;
  animation: imm-fade-up 0.6s var(--imm-ease-out) backwards;
}
.error-message::before { /* lost-bearing compass glyph */
  content: ''; width: clamp(44px, 6vw, 60px); aspect-ratio: 1; border-radius: 50%;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c93a55' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m15.6 8.4-2.1 5.1-5.1 2.1 2.1-5.1z'/%3E%3C/svg%3E") center / 58% no-repeat,
    rgba(201, 58, 85, 0.1);
}

.chart-accessibility-panel {
  width: 100%; margin: clamp(14px, 2vw, 24px) 0 0; padding: clamp(16px, 2.2vw, 26px);
  border: 1px solid var(--imm-line); border-radius: var(--imm-r-lg);
  background: var(--imm-surface); box-shadow: var(--imm-shadow-1);
  color: var(--imm-ink-2); text-align: left;
}
.chart-accessibility-panel h3 { margin: 0 0 0.3em; font-size: var(--imm-fs-lg); font-weight: 600; line-height: 1.4; color: var(--imm-violet-800); }
.chart-accessibility-panel p { margin: 0; color: var(--imm-ink-2); }
.chart-accessibility-summary { margin: 0.8em 0 0; padding-left: 1.4em; color: var(--imm-ink-2); }
.chart-accessibility-summary li + li { margin-top: 0.35em; }
.chart-accessibility-table-wrap {
  width: 100%; margin-top: 1em; overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--imm-line); border-radius: var(--imm-r-md); background: #fff;
}
.chart-accessibility-table { width: 100%; min-width: 420px; margin: 0; border-collapse: separate; border-spacing: 0; background: transparent; font-size: var(--imm-fs-sm); font-variant-numeric: tabular-nums; }
.chart-accessibility-table th, .chart-accessibility-table td { padding: 0.7em 0.95em; border: 0; border-bottom: 1px solid var(--imm-line); text-align: left; vertical-align: top; }
.chart-accessibility-table th { position: sticky; top: 0; font-weight: 500; color: var(--imm-violet-800); background: var(--imm-violet-50); border-bottom-color: var(--imm-line-strong); }
.chart-accessibility-table tbody tr:nth-child(even) td { background: rgba(104, 104, 172, 0.035); }
.chart-accessibility-table tbody tr:last-child td { border-bottom: 0; }
.chart-accessibility-note { margin-top: 0.8em; font-size: var(--imm-fs-xs); color: var(--imm-muted); }

/* ------------------------------------------------------------------ 11 · shared primitives: figure + fold
   Canonical skins, written with ZERO specificity (:where) so that any modifier / component rule of another
   stream (e.g. `.imm-fold--ai`, `.my-chart.imm-figure`) wins regardless of stylesheet order. */

/* .imm-figure — frame for a chart / table / media block (DESIGN §5.3)
     <figure class="imm-figure [imm-figure--scroll|--flush|--plain]">
       <div class="imm-figure__head"><h3 class="imm-figure__title">…</h3><div class="imm-figure__toolbar">…</div></div>
       <div class="imm-figure__scroll">…wide content…</div>
       <figcaption class="imm-figure__caption">…</figcaption>
     </figure> */
:where(.imm-figure) {
  position: relative; width: 100%; min-width: 0; margin: clamp(14px, 2.2vw, 28px) 0;
  padding: clamp(12px, 2vw, 28px);
  background: var(--imm-surface); border: 1px solid var(--imm-line); border-radius: var(--imm-r-lg);
  box-shadow: var(--imm-shadow-2); overflow: hidden;
}
:where(.imm-figure--flush) { padding: 0; }
:where(.imm-figure--plain) { background: transparent; border-color: transparent; box-shadow: none; }
:where(.imm-figure__head) { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 clamp(10px, 1.4vw, 18px); }
:where(.imm-figure__title) { margin: 0; font-size: var(--imm-fs-lg); font-weight: 600; line-height: 1.4; color: var(--imm-ink); text-align: left; }
:where(.imm-figure__toolbar) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
:where(.imm-figure__caption) { margin: clamp(10px, 1.4vw, 16px) 0 0; font-size: var(--imm-fs-sm); line-height: 1.6; color: var(--imm-muted); text-align: left; }
:where(.imm-figure__scroll) {
  position: relative; max-width: 100%; overflow-x: auto; overflow-y: hidden;
  overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: thin;
}
/* "swipe for more" hint — either a real <span class="imm-figure__hint">…</span> child, or the generated one of
   .imm-figure--scroll. modal.js adds .is-overflowing while the scroller overflows and .is-scrolled after the first swipe. */
:where(.imm-figure__hint), :where(.imm-figure--scroll)::after {
  position: absolute; right: 12px; bottom: 12px; z-index: 4;
  display: none; align-items: center; gap: 0.4em; padding: 0.4em 0.95em; border-radius: var(--imm-r-pill);
  background: var(--imm-glass-dark-bg); color: #fff; font-size: var(--imm-fs-xs); font-weight: 400; line-height: 1.4; white-space: nowrap;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  pointer-events: none; animation: imm-figure-hint 2.4s ease-in-out infinite;
}
:where(.imm-figure--scroll)::after { content: 'เลื่อนเพื่อดูเพิ่มเติม →'; }
:where(.imm-figure.is-overflowing:not(.is-scrolled)) > :where(.imm-figure__hint),
:where(.imm-figure--scroll.is-overflowing:not(.is-scrolled))::after { display: inline-flex; }
@keyframes imm-figure-hint { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(6px, 0, 0); } }

/* .imm-fold — disclosure skin (DESIGN §5.4); behaviour comes from engine.js [data-imm-collapse].
   Scoped as `:where(modal) .imm-fold…` = ONE class of specificity: it out-ranks the unscoped `.imm-fold__*` rules
   that journey.css (loaded earlier) applies page-wide, while any modifier / component rule of E, F, G
   (`.imm-fold--x …`, or the same single class in a later stylesheet) still wins. */
:where(#resultsModal, #accessibilityModal) .imm-fold {
  position: relative; width: 100%; min-width: 0; margin: clamp(10px, 1.6vw, 18px) 0;
  border: 1px solid var(--imm-line); border-radius: var(--imm-r-md);
  background: linear-gradient(135deg, rgba(104, 104, 172, 0.07), rgba(250, 172, 30, 0.06)), var(--imm-surface);
  color: var(--imm-ink-2); text-align: left;
  transition: border-color 0.5s ease, box-shadow 0.6s var(--imm-ease-out);
}
:where(#resultsModal, #accessibilityModal) .imm-fold.is-collapsible.is-open { border-color: rgba(250, 172, 30, 0.5); box-shadow: var(--imm-shadow-2); }
:where(#resultsModal, #accessibilityModal) .imm-fold__toggle {
  position: relative; display: flex; align-items: center; gap: 0.7em; width: 100%; min-height: 52px;
  padding: 0.55em 1.1em 0.55em 0.75em; margin: 0;
  border: 0; border-radius: inherit; background: none; color: var(--imm-violet-800);
  font: inherit; font-size: var(--imm-fs-md); font-weight: 500; line-height: 1.4; text-align: left;
}
:where(#resultsModal, #accessibilityModal) .imm-fold__toggle::after { /* gold hairline that draws itself as the fold opens */
  content: ''; position: absolute; left: 18px; right: 18px; bottom: 0; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--imm-gold-400) 18%, var(--imm-gold-400) 82%, transparent);
  transform: scaleX(0); transform-origin: 0 50%; transition: transform 0.9s var(--imm-ease-out) 0.08s;
}
:where(#resultsModal, #accessibilityModal) .imm-fold.is-collapsible.is-open > .imm-fold__toggle::after { transform: none; }
:where(#resultsModal, #accessibilityModal) .imm-fold:not(.is-collapsible) > .imm-fold__toggle::after { display: none; }
:where(#resultsModal, #accessibilityModal) .imm-fold__toggle:focus-visible { outline: 2px solid var(--imm-gold-400); outline-offset: -3px; border-radius: var(--imm-r-md); }
:where(#resultsModal, #accessibilityModal) .imm-fold__icon {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--imm-line-gold); background: var(--imm-gold-50); color: var(--imm-gold-700);
  font-size: 1rem; line-height: 1; transition: transform 0.7s var(--imm-ease-spring), background-color 0.4s ease;
}
:where(#resultsModal, #accessibilityModal) .imm-fold__icon svg { width: 18px; height: 18px; }
:where(#resultsModal, #accessibilityModal) .imm-fold.is-collapsible.is-open .imm-fold__icon { transform: rotate(-12deg) scale(1.06); background: var(--imm-gold-100); }
:where(#resultsModal, #accessibilityModal) .imm-fold__title { flex: 1 1 auto; min-width: 0; }
:where(#resultsModal, #accessibilityModal) .imm-fold__toggle .imm-chevron { margin: 0 0.2em 0 0; color: var(--imm-violet-500); }
/* padding lives on the inner wrapper's inline axis + a spacer pseudo-element so the 0fr row can really reach 0 */
:where(#resultsModal, #accessibilityModal) .imm-fold__panel > * { padding-inline: clamp(14px, 2vw, 22px); }
:where(#resultsModal, #accessibilityModal) .imm-fold__panel > *::after { content: ''; display: block; height: clamp(14px, 2vw, 20px); }
/* above the collapse breakpoint the toggle is a plain heading row */
:where(#resultsModal, #accessibilityModal) .imm-fold:not(.is-collapsible) > .imm-fold__toggle { min-height: 0; padding-top: 1em; padding-bottom: 0.5em; }

/* .imm-empty — graceful "nothing here yet" state (many first-year students have no academic records yet).
     <div class="imm-empty" role="status">
       <span class="imm-empty__mark" aria-hidden="true"></span>
       <p class="imm-empty__title">ยังไม่มีข้อมูลในส่วนนี้</p>
       <p class="imm-empty__text">…</p>
     </div>
   A tab panel that ends up with no element at all shows the same card by itself (safety net below). */
:where(#resultsModal) .imm-empty,
:where(#tabContent) > .tab-panel.active:empty {
  display: grid; grid-template-columns: minmax(0, 1fr); justify-content: center; justify-items: center; align-content: center; gap: 8px;
  width: min(100%, 34rem); min-height: 0; margin: clamp(24px, 6vh, 64px) auto; padding: clamp(24px, 4vw, 44px) clamp(18px, 3vw, 34px);
  text-align: center; color: var(--imm-ink-2);
  border: 1px dashed var(--imm-line-strong); border-radius: var(--imm-r-lg);
  background: radial-gradient(120% 90% at 50% 0%, rgba(250, 172, 30, 0.1), rgba(250, 172, 30, 0) 62%), var(--imm-surface);
}
:where(#resultsModal) .imm-empty__mark,
:where(#tabContent) > .tab-panel.active:empty::before {
  /* the glass elephant guide (art direction v2: no compass imagery), resting on a soft golden glow */
  content: ''; display: block; width: 76px; height: 80px; margin-bottom: 6px;
  background:
    url("../../images/immersive/elephant-glass-420.webp") center 40% / contain no-repeat,
    radial-gradient(closest-side at 50% 88%, rgba(250, 172, 30, 0.32), rgba(250, 172, 30, 0) 100%) center bottom / 100% 34% no-repeat;
  filter: drop-shadow(0 8px 14px rgba(43, 39, 91, 0.18));
  animation: imm-empty-seek 6s var(--imm-ease-in-out) infinite;
}
:where(#resultsModal) .imm-empty__title,
:where(#tabContent) > .tab-panel.active:empty::after { margin: 0; font-size: var(--imm-fs-lg); font-weight: 600; line-height: 1.45; color: var(--imm-ink); }
:where(#tabContent) > .tab-panel.active:empty::after { content: 'ยังไม่มีข้อมูลสำหรับส่วนนี้'; }
:where(#resultsModal) .imm-empty__text { margin: 0; max-width: 28rem; font-size: var(--imm-fs-sm); font-weight: 300; line-height: 1.65; color: var(--imm-ink-3); }
@keyframes imm-empty-seek { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(0, -5px, 0); } }

/* ------------------------------------------------------------------ 12 · accessibility modal */
#accessibilityModal { --imm-modal-pad: clamp(16px, 3vw, 34px); --imm-vista-pos: 50% 34%; }
.accessibility-modal-container {
  width: min(100% - 2 * var(--imm-modal-gap-x), 900px); max-width: none;
  height: auto; max-height: calc(100% - 2 * max(var(--imm-modal-gap-y), 18px));
  border: 1px solid rgba(255, 255, 255, 0.62);
  background:
    radial-gradient(520px 260px at 100% -6%, rgba(104, 104, 172, 0.13), rgba(104, 104, 172, 0) 66%),
    radial-gradient(560px 280px at -4% -10%, rgba(250, 172, 30, 0.12), rgba(250, 172, 30, 0) 62%),
    var(--imm-surface);
}
.accessibility-modal-header {
  position: relative; top: auto; z-index: 2; flex: none;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: clamp(12px, 1.8vw, 18px);
  padding: clamp(18px, 2.4vw, 26px) clamp(16px, 2.2vw, 24px) clamp(14px, 1.8vw, 18px) var(--imm-modal-pad);
  border: 0; border-bottom: 1px solid var(--imm-line);
  background: transparent; color: var(--imm-text);
}
.imm-sheet__grabber { display: none; }
.accessibility-modal-emblem {
  position: relative; display: grid; place-items: center; width: clamp(48px, 5vw, 60px); aspect-ratio: 1; border-radius: 50%;
  color: #fff; background: var(--imm-grad-brand); box-shadow: var(--imm-shadow-violet), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.accessibility-modal-emblem::after { content: ''; position: absolute; inset: -7px; border-radius: 50%; border: 1px dashed var(--imm-line-gold); animation: imm-spin 40s linear infinite; }
.accessibility-modal-title-group { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.accessibility-modal-eyebrow { margin: 0; font-size: var(--imm-fs-sm); font-weight: 500; letter-spacing: 0; line-height: 1.5; color: var(--imm-gold-600); }
.accessibility-modal-header h2 {
  margin: 0; font-size: var(--imm-fs-xl); font-weight: 600; line-height: 1.3; color: var(--imm-violet-800); text-wrap: balance;
  background: var(--imm-grad-text); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.accessibility-modal-content { gap: clamp(12px, 1.6vw, 18px); padding-top: clamp(14px, 2vw, 22px); padding-bottom: clamp(18px, 2.6vw, 30px); }
.accessibility-modal-intro { margin: 0; font-size: var(--imm-fs-md); font-weight: 300; line-height: 1.65; color: var(--imm-ink-2); }
.accessibility-modal-status {
  position: relative; margin: 0; padding: 0.7em 1em 0.7em 2.6em;
  border: 1px solid var(--imm-line); border-radius: var(--imm-r-md);
  background: rgba(104, 104, 172, 0.07); color: var(--imm-violet-800);
  font-size: var(--imm-fs-sm); font-weight: 400; line-height: 1.55;
}
.accessibility-modal-status::before { content: ''; position: absolute; left: 1em; top: 1.2em; width: 0.6em; height: 0.6em; border-radius: 50%; background: var(--imm-success); box-shadow: 0 0 0 4px rgba(44, 154, 108, 0.18); }
.accessibility-settings-card {
  flex: none; padding: clamp(14px, 2vw, 22px);
  border: 1px solid var(--imm-line); border-radius: var(--imm-r-lg);
  background: rgba(255, 255, 255, 0.62); box-shadow: var(--imm-shadow-1);
}
.accessibility-settings-header { margin: 0 0 clamp(10px, 1.4vw, 14px); padding-left: 0.9em; border-left: 3px solid var(--imm-gold-400); }
.accessibility-settings-header h3 { margin: 0; font-size: var(--imm-fs-lg); font-weight: 600; line-height: 1.4; color: var(--imm-ink); }
.accessibility-settings-header p { margin: 0; font-size: var(--imm-fs-sm); font-weight: 300; line-height: 1.55; color: var(--imm-ink-3); }
.accessibility-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(10px, 1.4vw, 14px); }
.a11y-toggle-card, .a11y-select-card {
  position: relative; min-height: 100%; padding: clamp(12px, 1.6vw, 16px);
  border: 1px solid var(--imm-line); border-radius: var(--imm-r-md);
  background: var(--imm-surface); box-shadow: 0 1px 2px rgba(27, 24, 56, 0.04);
  transition: border-color 0.3s ease, box-shadow 0.4s var(--imm-ease-out), transform 0.4s var(--imm-ease-out), background-color 0.3s ease;
}
.a11y-toggle-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.a11y-select-card { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px 12px; }
.a11y-select-card .a11y-select-input { grid-column: 1 / -1; }
.a11y-tile-icon {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  color: var(--imm-violet-600); background: var(--imm-violet-50); border: 1px solid var(--imm-line);
  transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, transform 0.6s var(--imm-ease-spring);
}
.a11y-toggle-copy, .a11y-select-label { display: flex; flex-direction: column; gap: 0.1em; min-width: 0; }
.a11y-toggle-title { font-size: var(--imm-fs-md); font-weight: 500; line-height: 1.45; color: var(--imm-ink); }
.a11y-toggle-description { font-size: var(--imm-fs-sm); font-weight: 300; line-height: 1.5; color: var(--imm-ink-3); }
.a11y-select-input { width: 100%; }
@media (hover: hover) {
  .a11y-toggle-card:hover { border-color: var(--imm-line-strong); box-shadow: var(--imm-shadow-1); transform: translate3d(0, -2px, 0); }
}
/* tile reacts to its own switch (no JS): :has() where available, plain switch styling everywhere else */
.a11y-toggle-card:has(input:checked) { border-color: rgba(250, 172, 30, 0.55); background: linear-gradient(135deg, var(--imm-gold-50), var(--imm-surface) 70%); }
.a11y-toggle-card:has(input:checked) .a11y-tile-icon { color: var(--imm-gold-700); background: var(--imm-gold-100); border-color: rgba(250, 172, 30, 0.5); transform: rotate(-8deg) scale(1.05); }

.a11y-switch { position: relative; flex: 0 0 auto; display: inline-flex; align-items: center; }
.a11y-switch input { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; margin: 0; opacity: 0; pointer-events: none; }
.a11y-switch-track {
  position: relative; display: block; width: 56px; height: 32px; border-radius: var(--imm-r-pill);
  background: rgba(104, 104, 172, 0.22); box-shadow: inset 0 1px 3px rgba(27, 24, 56, 0.18);
  transition: background-color 0.35s ease, box-shadow 0.35s ease;
}
.a11y-switch-track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(27, 24, 56, 0.28);
  transition: transform 0.5s var(--imm-ease-spring), background 0.35s ease, box-shadow 0.35s ease;
}
.a11y-switch input:checked + .a11y-switch-track { background: var(--imm-violet-600); box-shadow: inset 0 1px 3px rgba(27, 24, 56, 0.3), 0 0 0 4px rgba(250, 172, 30, 0.16); }
.a11y-switch input:checked + .a11y-switch-track::after { transform: translate3d(24px, 0, 0); background: var(--imm-grad-gold); box-shadow: 0 2px 8px rgba(250, 172, 30, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.a11y-switch input:focus-visible + .a11y-switch-track { outline: 2px solid var(--imm-gold-400); outline-offset: 3px; }

.accessibility-modal-actions { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px 18px; padding-top: 2px; }
.accessibility-reset-button { flex: none; min-height: 48px; font-size: var(--imm-fs-sm); }
.accessibility-modal-note { margin: 0; font-size: var(--imm-fs-xs); font-weight: 300; line-height: 1.55; color: var(--imm-ink-3); text-align: right; }

/* ------------------------------------------------------------------ 13 · responsive */
/* ultrawide: the side bands show more of the destination, so keep them more legible */
@media (min-width: 1920px) {
  #resultsModal { --imm-modal-pad: 56px; }
  #resultsModal .imm-backdrop__soft { filter: blur(3.5px) saturate(1.2); }
}
/* very large canvases (4K at 1×): a wider sheet and data column so charts are not lost in the middle */
@media (min-width: 2400px) and (min-height: 1300px) {
  #resultsModal { --imm-modal-pad: 72px; --imm-modal-max: 1480px; }
  #resultsModal .modal-container { width: min(100% - 2 * var(--imm-modal-gap-x), 2080px); }
}
/* short desktop windows: tighter title sequence */
@media (min-width: 769px) and (max-height: 760px) {
  .imm-modal-head__eyebrow { display: none; }
  #modalTitle { margin-top: 6px; font-size: var(--imm-fs-xl); }
}
@media (min-width: 769px) {
  .imm-sheet.is-enhanced.is-condensed .imm-modal-note-toggle { padding: 0; width: 44px; justify-content: center; }
  .imm-sheet.is-enhanced.is-condensed .imm-modal-note-toggle .imm-chevron { display: none; }
}

@media (max-width: 1024px) {
  #resultsModal, #accessibilityModal { --imm-modal-radius: 28px; --imm-modal-gap-x: 12px; --imm-modal-gap-y: 12px; }
}
/* the results sheet nearly fills the window (owner 2026-11-19): only a 10px frame of the destination shows around it
   (phones keep their own slide-up sheet below; very short windows go edge to edge) */
@media (min-width: 769px) {
  #resultsModal { --imm-modal-gap-x: 10px; --imm-modal-gap-y: 10px; }
  #resultsModal .modal-container { width: calc(100% - 2 * var(--imm-modal-gap-x)); }
}

@media (max-width: 768px) {
  /* phones: a full-height sheet that slides up; a sliver of the destination stays visible above it */
  #resultsModal { --imm-modal-radius: 22px; --imm-modal-pad: 16px; --imm-modal-pad-bottom: 108px; }
  #resultsModal.modal { align-items: flex-end; }
  #resultsModal .modal-container {
    width: 100%; height: calc(100% - var(--imm-safe-t) - 10px);
    border-width: 1px 0 0; border-radius: var(--imm-modal-radius) var(--imm-modal-radius) 0 0;
  }
  /* exit: the sheet drops back down (ease-in, 0.26 s — content is emptied at 300 ms) */
  #resultsModal .modal-container, #accessibilityModal .modal-container {
    transform: translate3d(0, 34%, 0);
    transition: opacity 0.22s ease 0.04s, transform 0.26s cubic-bezier(0.55, 0, 0.85, 0.3);
  }
  #resultsModal.active .modal-container, #accessibilityModal.active .modal-container {
    transform: none; transition: none;
    animation: imm-sheet-up 0.7s var(--imm-ease-out) 0.04s backwards;
  }
  .modal-content { scrollbar-gutter: auto; }

  .imm-modal-head__photo {
    inset: 0 0 auto 0; width: auto; height: 118px;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.62) 44%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.62) 44%, transparent 100%);
    transform: none;
  }
  .imm-modal-head__photo::after { display: none; }
  .imm-sheet.is-condensed .imm-modal-head__photo { opacity: 0.4; }
  .imm-modal-head__bar { gap: 8px; padding: 12px 12px 0 12px; }
  .close-button { width: 44px; height: 44px; }
  .main-menu-back-button { padding-right: 0.95em; }
  .main-menu-back-button-icon { width: 32px; height: 32px; }
  .imm-modal-head__mini-term { display: none; }
  .imm-modal-head__mini-title { font-size: var(--imm-fs-md); }
  .imm-modal-head__eyebrow { margin-top: 14px; }

  /* AI disclaimer = a one-line clamp that unfolds on tap (modal.js toggles .is-note-open on the sheet; the ⓘ
     button in the bar is the keyboard / screen-reader path to the same state). The node never leaves #modalTitle. */
  .imm-sheet.is-enhanced .imm-modal-note-toggle { display: inline-flex; justify-content: center; width: 44px; padding: 0; }
  .imm-sheet.is-enhanced .imm-modal-note-toggle__label,
  .imm-sheet.is-enhanced .imm-modal-note-toggle .imm-chevron { display: none; }
  #modalTitle { font-size: var(--imm-fs-xl); row-gap: 6px; margin-bottom: 12px; }
  #modalTitle .result-term-badge { margin-right: 2px; }
  .imm-sheet.is-enhanced #modalTitle .warning-text {
    flex: 1 1 13em; max-width: none; max-height: 1.6em; overflow: hidden;
    padding-right: 1.6em; white-space: nowrap; text-overflow: ellipsis; cursor: pointer;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b87004' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.15em top 0.4em / 0.95em;
    transition: max-height 0.7s var(--imm-ease-out);
  }
  .imm-sheet.is-enhanced.is-note-open #modalTitle .warning-text {
    flex-basis: 100%; max-height: 10em; white-space: normal;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b87004' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 15 6-6 6 6'/%3E%3C/svg%3E");
    animation: imm-note-unfold 0.6s var(--imm-ease-out) backwards;
  }

  .imm-tabsbar { padding-top: 6px; padding-bottom: 14px; }
  .tabs-nav .tab-button { padding-inline: 1.1em; }

  .error-message { grid-template-columns: minmax(0, 1fr); justify-items: center; row-gap: 12px; text-align: center; }

  /* accessibility modal → bottom sheet */
  #accessibilityModal.modal { align-items: flex-end; }
  .accessibility-modal-container {
    width: 100%; max-height: calc(100% - var(--imm-safe-t) - 28px);
    border-width: 1px 0 0; border-radius: 22px 22px 0 0;
  }
  .accessibility-modal-header { padding-top: 26px; }
  .accessibility-modal-emblem { width: 48px; }
  .accessibility-modal-emblem svg { width: 22px; height: 22px; }
  .imm-sheet__grabber { display: block; position: absolute; left: 50%; top: 9px; width: 44px; height: 4px; margin-left: -22px; border-radius: 4px; background: var(--imm-line-strong); }
  /* the last row must scroll clear of the avatar (bottom-left) and the help launcher (bottom-right) */
  .accessibility-modal-content { padding-bottom: calc(96px + var(--imm-safe-b)); }
  .accessibility-settings-grid { grid-template-columns: minmax(0, 1fr); }
  .accessibility-modal-actions { flex-direction: column; align-items: stretch; }
  .accessibility-modal-note { text-align: left; }
}

/* short phones (≤ 700px tall): the ornamental eyebrow gives its row back to the data */
@media (max-width: 768px) and (max-height: 700px) {
  .imm-modal-head__eyebrow { display: none; }
  #modalTitle { margin-top: 12px; }
}

@media (max-width: 380px) {
  .main-menu-back-button { padding-right: 5px; gap: 0; }
  .main-menu-back-button-text { max-width: 0; opacity: 0; }
  .imm-modal-note-toggle__label { display: none; }
  .a11y-toggle-card { grid-template-columns: minmax(0, 1fr) auto; }
  .a11y-select-card { grid-template-columns: minmax(0, 1fr); }
  .a11y-tile-icon { display: none; }
  .accessibility-modal-emblem { display: none; }
  .accessibility-modal-header { grid-template-columns: minmax(0, 1fr) auto; }
}

/* landscape phones / very short windows: the header is always compact and the tab bar scrolls away,
   so the data keeps almost the whole height */
@media (max-height: 520px) {
  #resultsModal { --imm-modal-sticky-top: 0px; --imm-modal-pad-bottom: 72px; --imm-modal-gap-y: 0px; --imm-modal-gap-x: 0px; --imm-modal-radius: 0px; }
  #resultsModal .modal-container { width: 100%; height: 100%; border: 0; border-radius: 0; }
  #resultsModal .imm-modal-head__bar { padding: 6px max(12px, var(--imm-safe-r)) 6px max(12px, var(--imm-safe-l)); }
  #resultsModal .modal-content { padding-left: max(var(--imm-modal-pad), var(--imm-safe-l)); padding-right: max(var(--imm-modal-pad), var(--imm-safe-r)); }
  .imm-sheet:not(.is-note-open) .imm-modal-head__hero { grid-template-rows: 0fr; opacity: 0; }
  #resultsModal .imm-modal-head__mini { opacity: 1; transform: none; }
  #resultsModal .imm-sheet.is-note-open .imm-modal-head__mini { opacity: 0; }
  #resultsModal .main-menu-back-button { padding-right: 5px; gap: 0; min-height: 40px; }
  #resultsModal .main-menu-back-button-text { max-width: 0; opacity: 0; }
  #resultsModal .main-menu-back-button-icon { width: 30px; height: 30px; }
  #resultsModal .close-button { width: 40px; height: 40px; }
  #resultsModal .imm-sheet.is-enhanced .imm-modal-note-toggle { display: inline-flex; justify-content: center; width: 40px; min-height: 40px; padding: 0; }
  #resultsModal .imm-modal-note-toggle__label, #resultsModal .imm-modal-note-toggle .imm-chevron { display: none; }
  #resultsModal .imm-modal-head__photo { opacity: 0.4; height: 100%; }
  #resultsModal .modal-header { border-bottom: 1px solid var(--imm-line); }
  .imm-tabsbar { position: relative; padding-top: 10px; }
  .imm-modal-head__eyebrow { display: none; }
  #modalTitle { font-size: var(--imm-fs-lg); margin-top: 8px; }
  #results-modal-status:not(.hidden) { grid-template-columns: auto auto; column-gap: 20px; align-items: center; justify-content: center; padding-block: 16px; }
  .imm-modal-loading__skeleton { grid-column: 1 / -1; }
  .imm-modal-loading__dial { width: 104px; }
  .accessibility-modal-container { max-height: 100%; height: 100%; width: 100%; border-radius: 0; }
  .accessibility-modal-header { padding-block: 10px; }
  .accessibility-modal-emblem { display: none; }
  .accessibility-modal-header { grid-template-columns: minmax(0, 1fr) auto; }
}

/* ------------------------------------------------------------------ 14 · reduced motion */
html.imm-reduced .modal, html.imm-reduced .modal.active { transition: opacity 0.12s linear, visibility 0s linear 0.12s; }
html.imm-reduced .modal.active { transition: opacity 0.12s linear, visibility 0s; }
/* id-level selectors: they must out-rank the phone sheet rules (#resultsModal .modal-container …) */
html.imm-reduced #resultsModal .modal-container,
html.imm-reduced #accessibilityModal .modal-container { opacity: 1; transform: none; transition: none; animation: none; }
html.imm-reduced .modal.active .imm-backdrop,
html.imm-reduced .modal.active .imm-backdrop__soft,
html.imm-reduced .modal.active .imm-backdrop__sharp,
html.imm-reduced .modal.active .imm-modal-head__photo,
html.imm-reduced .modal.active .imm-modal-head__bar,
html.imm-reduced .modal.active .imm-modal-head__hero-inner,
html.imm-reduced .tab-panel.active,
html.imm-reduced .error-message,
html.imm-reduced #modalTitle .result-term-badge,
html.imm-reduced .imm-modal-loading__wash,
html.imm-reduced .imm-modal-loading__dial::before,
html.imm-reduced .imm-modal-loading__dial::after,
html.imm-reduced .imm-skeleton-row,
html.imm-reduced .tabs-nav .tab-button[data-tab='QA']::before,
html.imm-reduced .accessibility-modal-emblem::after,
html.imm-reduced .imm-figure__hint,
html.imm-reduced .imm-figure--scroll::after,
html.imm-reduced .imm-empty__mark,
html.imm-reduced #tabContent > .tab-panel.active:empty::before { animation: none; }
html.imm-reduced .imm-modal-head__photo { transform: none; }
html.imm-reduced .imm-modal-head__hero,
html.imm-reduced .imm-modal-head__mini,
html.imm-reduced .imm-modal-head__bar,
html.imm-reduced .main-menu-back-button,
html.imm-reduced .main-menu-back-button-text,
html.imm-reduced .main-menu-back-button-icon,
html.imm-reduced .close-button svg,
html.imm-reduced #modalTitle,
html.imm-reduced #modalTitle .warning-text,
html.imm-reduced .tabs-nav::before,
html.imm-reduced .tabs-nav::after,
html.imm-reduced .a11y-switch-track::after,
html.imm-reduced .a11y-toggle-card,
html.imm-reduced .a11y-tile-icon,
html.imm-reduced .imm-fold__toggle::after,
html.imm-reduced .imm-fold__icon { transition: none; }
html.imm-reduced .imm-sheet.is-enhanced #modalTitle .warning-text { animation: none; transition: none; }
html.imm-reduced .imm-modal-loading__dial .imm-loader__ring { animation: imm-spin 9s linear infinite !important; } /* keep a calm sign of life */

/* ------------------------------------------------------------------ 15 · high contrast */
html.a11y-high-contrast .modal-overlay { background: #05050c; }
html.a11y-high-contrast .imm-backdrop,
html.a11y-high-contrast .imm-modal-head__photo,
html.a11y-high-contrast .imm-modal-loading__wash { display: none; }
html.a11y-high-contrast .modal-container { background: var(--imm-surface); border: 2px solid #0b0b12; box-shadow: none; }
html.a11y-high-contrast #modalTitle,
html.a11y-high-contrast .accessibility-modal-header h2 { background: none; -webkit-text-fill-color: currentColor; color: var(--imm-ink); }
html.a11y-high-contrast #modalTitle .warning-text,
html.a11y-high-contrast .imm-modal-head__eyebrow,
html.a11y-high-contrast .accessibility-modal-eyebrow { color: var(--imm-ink-2); font-weight: 400; }
html.a11y-high-contrast #modalTitle .result-term-badge,
html.a11y-high-contrast .imm-modal-head__mini-term,
html.a11y-high-contrast .imm-modal-note-toggle { color: var(--imm-ink); background: #fff; border: 2px solid var(--imm-ink); }
html.a11y-high-contrast #resultsModal .modal-header { border-bottom: 2px solid var(--imm-ink); background: #f4ecd3; }
html.a11y-high-contrast .main-menu-back-button,
html.a11y-high-contrast .close-button { background: #fff; color: var(--imm-ink); border: 2px solid var(--imm-ink); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
html.a11y-high-contrast .main-menu-back-button-icon { background: var(--imm-accent-strong); }
html.a11y-high-contrast .imm-tabsbar { background: var(--imm-surface); border-bottom: 2px solid var(--imm-ink); }
html.a11y-high-contrast .tabs-nav { background: #fff; border: 2px solid var(--imm-ink); box-shadow: none; }
html.a11y-high-contrast .tabs-nav .tab-button { color: var(--imm-ink); }
html.a11y-high-contrast .tabs-nav .tab-button.active,
html.a11y-high-contrast .tabs-nav.has-indicator .tab-button.active { color: #fff; background: var(--imm-accent-strong); box-shadow: none; }
html.a11y-high-contrast .tabs-nav::before, html.a11y-high-contrast .tabs-nav::after { display: none; }
html.a11y-high-contrast .tab-content { color: var(--imm-ink); }
:where(html.a11y-high-contrast .imm-figure),
:where(html.a11y-high-contrast) .imm-fold,
:where(html.a11y-high-contrast) .imm-empty,
:where(html.a11y-high-contrast #tabContent) > .tab-panel.active:empty { background: #fff; border: 2px solid var(--imm-ink); box-shadow: none; color: var(--imm-ink); }
:where(html.a11y-high-contrast) .imm-fold__icon { color: var(--imm-ink); background: #fff; border: 2px solid var(--imm-ink); }
:where(html.a11y-high-contrast) .imm-empty__text { color: var(--imm-ink-2); font-weight: 400; }
html.a11y-high-contrast .error-message,
html.a11y-high-contrast .chart-accessibility-panel,
html.a11y-high-contrast .chart-accessibility-table-wrap,
html.a11y-high-contrast .accessibility-settings-card,
html.a11y-high-contrast .a11y-toggle-card,
html.a11y-high-contrast .a11y-select-card,
html.a11y-high-contrast .accessibility-modal-status { background: #fff; border: 2px solid var(--imm-ink); box-shadow: none; color: var(--imm-ink); }
html.a11y-high-contrast .chart-accessibility-table th { background: #f4ecd3; color: var(--imm-ink); border-bottom: 2px solid var(--imm-ink); }
html.a11y-high-contrast .chart-accessibility-table td { border-bottom: 1px solid var(--imm-ink); }
html.a11y-high-contrast .accessibility-modal-header { border-bottom: 2px solid var(--imm-ink); background: #f4ecd3; }
html.a11y-high-contrast .a11y-toggle-description,
html.a11y-high-contrast .accessibility-settings-header p,
html.a11y-high-contrast .accessibility-modal-intro,
html.a11y-high-contrast .accessibility-modal-note { color: var(--imm-ink-2); font-weight: 400; }
html.a11y-high-contrast .a11y-switch-track { background: #fff; box-shadow: inset 0 0 0 2px var(--imm-ink); }
html.a11y-high-contrast .a11y-switch-track::after { background: var(--imm-ink); box-shadow: none; }
html.a11y-high-contrast .a11y-switch input:checked + .a11y-switch-track { background: var(--imm-accent-strong); box-shadow: inset 0 0 0 2px var(--imm-ink); }
html.a11y-high-contrast .a11y-switch input:checked + .a11y-switch-track::after { background: #fff; box-shadow: none; }
html.a11y-high-contrast .a11y-tile-icon { color: var(--imm-ink); background: #fff; border: 2px solid var(--imm-ink); }
html.a11y-high-contrast .imm-skeleton-row { background: rgba(11, 11, 18, 0.2); animation: none; }
:where(html.a11y-high-contrast .imm-figure__hint), :where(html.a11y-high-contrast .imm-figure--scroll)::after { background: #05050c; -webkit-backdrop-filter: none; backdrop-filter: none; }

/* ------------------------------------------------------------------ 16 · print */
@media print {
  .modal { position: static; }
  .modal-overlay, .imm-modal-head__photo, .imm-tabsbar { display: none; }
  .modal-container { height: auto; box-shadow: none; border: 0; overflow: visible; }
  .modal-content { overflow: visible; }
}
