/* =========================================================
   ACCESSIBILITY
   1. Baseline (both modes): visible keyboard focus, skip link, and the
      always-present accessibility toggle button.
   2. html.a11y — "accessibility mode", toggled by the button and persisted
      in localStorage: strips the liquid glass / lava / motion for a static,
      high-contrast (WCAG AA) presentation of the same content.
   ========================================================= */

/* Keyboard focus must be visible in BOTH modes (mouse clicks are unaffected —
   :focus-visible only matches keyboard/programmatic focus). */
:focus-visible {
  outline: 3px solid #9ecbff;
  outline-offset: 2px;
}
html.a11y :focus-visible {
  outline: 3px solid #ffd54a;
}

/* Skip link: first tab stop; visually hidden until focused. */
.skip-link {
  position: fixed;
  top: -100px;
  left: 12px;
  z-index: 20000;
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  background: #ffffff;
  color: #000000;
  font-weight: 700;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 12px;
}

/* The accessibility toggle: a circular GLASS ORB icon button, matching the
   site chrome — frost tint + specular rim here, url() refraction attached by
   glassifySurfaces() on Chromium (full-axis, like a tiny bubble). Named for
   AT by its aria-label. border:none like every glass surface, so the
   engine's measured map stays aligned. */
.a11y-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 12000;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: hsl(0 0% 100% / var(--lg-frost, 0.05));
  -webkit-backdrop-filter: blur(2px) saturate(1.3);
  backdrop-filter: blur(2px) saturate(1.3);
  box-shadow: var(--lg-shadow);
  color: #ffffff; /* the SVG glyph inherits this via currentColor */
  cursor: pointer;
  transition: box-shadow 0.25s ease, background 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}
/* Legibility over bright lava: shadow on the GLYPH (a filter on the button
   itself would disable its url() backdrop refraction in Chromium). */
.a11y-toggle svg {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}
/* Hover: the same glow as the other pills (white fallback outside .nav). */
.a11y-toggle:hover {
  background: var(--lg-tint-hover);
  box-shadow:
    var(--lg-shadow),
    0 0 14px 3px color-mix(in srgb, var(--lava-now) 60%, transparent);
}
/* Pressed = accessibility mode ON: inverted so the state is obvious. The
   html.a11y variants below out-rank the a11y solid override. */
.a11y-toggle[aria-pressed="true"] {
  background: #ffd54a;
  color: #000000;
}
html.a11y .a11y-toggle {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  background: #141824;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: none;
}
html.a11y .a11y-toggle svg {
  filter: none;
}
html.a11y .a11y-toggle[aria-pressed="true"] {
  background: #ffd54a;
  border-color: #ffd54a;
  color: #000000;
}

/* ---- Display menu: the corner bubble plus the column that opens above it.
   Every bubble is its own fixed-position .a11y-toggle orb (not children of a
   moving wrapper), so each keeps its own glass. --i = place in the column.
   Closed: the items are hidden and drop back toward the corner. No scale in
   the motion: the refraction is sized from the orb's box. ---- */
.display-menu__item {
  bottom: calc(16px + var(--i, 1) * 62px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition:
    opacity 0.2s ease, transform 0.25s ease, visibility 0.2s,
    box-shadow 0.25s ease, background 0.25s ease;
}
.display-menu.is-open .display-menu__item {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition:
    opacity 0.3s ease calc(var(--i, 1) * 45ms),
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1) calc(var(--i, 1) * 45ms),
    visibility 0s,
    box-shadow 0.25s ease, background 0.25s ease;
}
/* The menu bubble shows it is open. */
.display-menu.is-open .display-menu__main {
  background: var(--lg-tint-hover);
  box-shadow:
    var(--lg-shadow),
    0 0 14px 3px color-mix(in srgb, var(--lava-now) 60%, transparent);
}
/* Name tag to the left of each bubble (icons alone are ambiguous). Solid, so
   it reads over any backdrop. Decorative: the button's aria-label is its name. */
.display-menu__label {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
  background: rgba(18, 19, 26, 0.92);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}
html.a11y .display-menu__label {
  background: #141824;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

/* ---- html.a11y: the accessible presentation ---- */

/* No motion anywhere (beats the inline riseIn animation JS sets, and stops
   the colour cycling). */
html.a11y *,
html.a11y *::before,
html.a11y *::after {
  animation: none !important;
  transition: none !important;
}

/* No lava backdrop; plain near-black page. */
html.a11y .lava,
html.a11y .lava__defs {
  display: none;
}
html.a11y body {
  background: #05070d;
}

/* All glass surfaces become solid, bordered panels: kill the url() refraction
   (inline style, hence !important), the frost, and the glow shadows. */
html.a11y .nav,
html.a11y .btn,
html.a11y .bubble,
html.a11y .orb,
html.a11y .dropdown-menu,
html.a11y .gallery-modal-nav,
html.a11y .gallery-modal-close {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  background: #141824;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: none;
}
html.a11y .orb { text-shadow: none; }
/* Gallery in a11y mode: flat frame, no glows, solid hover feedback. */
html.a11y .gallery-modal-slide::after {
  box-shadow: none;
}
/* Accessibility mode: no 3D, no reflection — just the current image, flat,
   with a plain border. Side covers are hidden entirely. */
html.a11y .gallery-modal-stage {
  perspective: none;
  height: var(--slide-h);
}
html.a11y .gallery-modal-slide {
  -webkit-box-reflect: none;
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.45);
  transform: none !important;
}
html.a11y .gallery-modal-slide:not(.is-current) { display: none; }
html.a11y .gallery-modal-btn {
  background: transparent;
  border: none;
}
html.a11y .gallery-modal-btn:hover,
html.a11y .gallery-modal-close:hover {
  background: #2a3040;
  box-shadow: none;
}

/* High-contrast text; drop the halo text-shadows (no busy backdrop now). */
html.a11y .bubble h3,
html.a11y .bubble h4,
html.a11y .bubble p {
  text-shadow: none;
}
html.a11y .bubble p {
  color: #eef1f7;
}
html.a11y .bubble h4 {
  color: rgba(255, 255, 255, 0.78);
}
html.a11y .page-title {
  color: #d6dbe6;
}
html.a11y .nav__mobile-label {
  color: rgba(255, 255, 255, 0.72);
}

/* Links: underlined (colour alone can't signal a link) and light enough. */
html.a11y .bubble a {
  color: #a7cbff;
  text-decoration: underline;
}
/* Download cards: flat icon tile; the button stays a button (no underline). */
html.a11y .download-card__icon {
  background: #1e2435;
  box-shadow: none;
  filter: none;
  border: 1px solid rgba(255, 255, 255, 0.45);
}
html.a11y .bubble .download-card__platform {
  color: #ffffff;
  text-decoration: none;
}
html.a11y .download-card__version,
html.a11y .download-card__cmd {
  background: #1e2435;
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.45);
}
html.a11y .download-card code {
  background: #0b0e16;
}
html.a11y .download-card p.download-card__label,
html.a11y .download-card p.download-card__note {
  color: rgba(255, 255, 255, 0.82);
}

/* Buttons: state shown by background + underline instead of colour glows. */
html.a11y .btn:hover,
html.a11y .dropdown-item:hover,
html.a11y .nav__mobile-item:hover,
html.a11y .nav__mobile-item:active {
  background: #2a3040;
  box-shadow: none;
}
html.a11y .nav__link { color: #ffffff; text-shadow: none; }
html.a11y .nav__link:hover { text-decoration: underline; text-shadow: none; }
html.a11y .nav__link.is-current { text-decoration: underline; text-underline-offset: 4px; }
html.a11y .nav__link::after { display: none; }
html.a11y .btn.is-current,
html.a11y .dropdown-item.is-active,
html.a11y .nav__mobile-item.is-active {
  background: #2e3a55;
  text-decoration: underline;
  box-shadow: none;
}

/* Solid panels for the menus (mobile panel is already solid). */
html.a11y .nav__mobile {
  background: #141824;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: none;
}
