/* ==========================================================
   Accessibility panel
   ========================================================== */

.a11y-root {
  --a-ink: #0b0d12;
  --a-ink-2: #4b5261;
  --a-blue: #3459a6;
  --a-blue-50: #eef2fa;
  --a-line: rgba(11, 13, 18, 0.09);
  --a-surface: #f6f8fc;
  --a-ease: cubic-bezier(0.22, 1, 0.36, 1);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: normal;
  word-spacing: normal;
  text-align: left;
  color: var(--a-ink);
}

.a11y-root *,
.a11y-root *::before,
.a11y-root *::after {
  box-sizing: border-box;
}

/* :where() keeps this reset at element-level priority, so component padding wins */
:where(.a11y-root) button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.a11y-root svg {
  display: block;
  flex: none;
}

.a11y-root :focus-visible {
  outline: 3px solid var(--a-blue);
  outline-offset: 2px;
}

.a11y-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Trigger ---------- */

.a11y-trigger {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 140;
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 16px;
  gap: 0;
  border-radius: 999px;
  background: var(--a-ink) !important;
  color: #fff !important;
  box-shadow:
    0 0 0 4px rgba(52, 89, 166, 0.28),
    0 18px 40px -14px rgba(11, 13, 18, 0.55);
  transition: gap 0.35s var(--a-ease), box-shadow 0.3s ease, transform 0.3s var(--a-ease);
}

.a11y-trigger svg {
  width: 24px;
  height: 24px;
}

.a11y-trigger-label {
  max-width: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  transition: max-width 0.4s var(--a-ease), opacity 0.25s ease;
}

.a11y-trigger:hover,
.a11y-trigger:focus-visible {
  gap: 10px;
  box-shadow:
    0 0 0 6px rgba(52, 89, 166, 0.35),
    0 22px 44px -14px rgba(11, 13, 18, 0.6);
}

.a11y-trigger:hover .a11y-trigger-label,
.a11y-trigger:focus-visible .a11y-trigger-label {
  max-width: 120px;
  opacity: 1;
}

.a11y-trigger[aria-expanded='true'] {
  background: var(--a-blue) !important;
}

.a11y-trigger-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  display: none;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--a-blue);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.a11y-trigger.has-active .a11y-trigger-badge {
  display: block;
}

html.menu-open .a11y-trigger {
  opacity: 0;
  pointer-events: none;
}

/* ---------- Panel ---------- */

.a11y-backdrop {
  position: fixed;
  inset: 0;
  z-index: 141;
  background: rgba(11, 13, 18, 0.45);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.a11y-backdrop.is-open {
  opacity: 1;
}

.a11y-panel {
  position: fixed;
  right: 20px;
  bottom: 88px;
  z-index: 142;
  display: flex;
  flex-direction: column;
  width: 400px;
  max-height: min(720px, calc(100vh - 110px));
  overflow: hidden;
  border: 1px solid var(--a-line);
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 40px 90px -30px rgba(11, 13, 18, 0.45);
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  transform-origin: bottom right;
  transition: opacity 0.25s ease, transform 0.4s var(--a-ease);
}

.a11y-panel.is-open {
  opacity: 1;
  transform: none;
}

/* The display rule above would otherwise override the hidden attribute and leave an invisible panel catching clicks */
.a11y-panel[hidden],
.a11y-backdrop[hidden] {
  display: none;
}

.a11y-head {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 20px 20px 24px;
  color: #fff;
  background:
    radial-gradient(90% 140% at 100% 0%, rgba(52, 89, 166, 0.8), transparent 70%),
    var(--a-ink);
}

.a11y-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.a11y-head p {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.7);
}

.a11y-icon-btn {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.a11y-icon-btn svg {
  width: 18px;
  height: 18px;
}

.a11y-close {
  background: rgba(255, 255, 255, 0.1) !important;
}

.a11y-close:hover {
  background: rgba(255, 255, 255, 0.2) !important;
}

.a11y-views {
  display: flex;
  flex: 1;
  min-height: 0;
}

.a11y-view {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}

.a11y-view[hidden] {
  display: none;
}

.a11y-scroll {
  flex: 1;
  min-height: 0;
  padding: 18px 18px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.a11y-section + .a11y-section {
  margin-top: 20px;
}

.a11y-section h3,
.a11y-subhead h3 {
  margin: 0 0 10px 4px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--a-ink-2);
}

/* Profiles */

.a11y-profiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.a11y-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--a-line) !important;
  border-radius: 16px;
  text-align: left;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.a11y-profile:hover {
  border-color: rgba(52, 89, 166, 0.35) !important;
  background: var(--a-surface) !important;
}

.a11y-profile-icon {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--a-blue-50);
  color: var(--a-blue);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.a11y-profile-icon svg {
  width: 18px;
  height: 18px;
}

.a11y-profile-text {
  min-width: 0;
}

.a11y-profile strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
}

.a11y-profile small {
  display: block;
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--a-ink-2);
}

.a11y-profile.is-on {
  border-color: var(--a-blue) !important;
  background: var(--a-blue-50) !important;
}

.a11y-profile.is-on .a11y-profile-icon {
  background: var(--a-blue);
  color: #fff;
}

/* Feature tiles */

.a11y-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.a11y-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-height: 104px;
  padding: 12px;
  border-radius: 18px;
  background: var(--a-surface) !important;
  text-align: left;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s var(--a-ease);
}

.a11y-tile:hover {
  background: #edf1f8 !important;
}

.a11y-tile:active {
  transform: scale(0.97);
}

.a11y-tile-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: #fff;
  color: var(--a-blue);
  box-shadow: 0 2px 6px -2px rgba(11, 13, 18, 0.12);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.a11y-tile-icon svg {
  width: 18px;
  height: 18px;
}

.a11y-tile-label {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
}

.a11y-tile-state {
  margin-top: auto;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--a-ink-2);
}

.a11y-steps {
  position: absolute;
  top: 14px;
  right: 12px;
  display: flex;
  gap: 3px;
}

.a11y-steps i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(11, 13, 18, 0.15);
  transition: background-color 0.2s ease;
}

.a11y-tile.is-on {
  background: var(--a-ink) !important;
  color: #fff;
}

.a11y-tile.is-on .a11y-tile-icon {
  background: var(--a-blue);
  color: #fff;
  box-shadow: none;
}

.a11y-tile.is-on .a11y-tile-state {
  color: #8ea8dc;
}

.a11y-tile.is-on .a11y-steps i {
  background: rgba(255, 255, 255, 0.25);
}

.a11y-tile.is-on .a11y-steps i.on {
  background: #8ea8dc;
}

/* Structure entry + view */

.a11y-structure-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 20px 0 10px;
  padding: 12px 14px 12px 12px;
  border: 1px solid var(--a-line) !important;
  border-radius: 18px;
  text-align: left;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.a11y-structure-btn:hover {
  border-color: rgba(52, 89, 166, 0.35) !important;
  background: var(--a-surface) !important;
}

.a11y-structure-btn strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
}

.a11y-structure-btn small {
  display: block;
  font-size: 12px;
  color: var(--a-ink-2);
}

.a11y-structure-btn .a11y-tile-icon {
  background: var(--a-blue-50);
  box-shadow: none;
}

.a11y-chev {
  width: 18px;
  height: 18px;
  margin-left: auto;
  color: var(--a-ink-2);
}

.a11y-subhead {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 18px 0 10px;
}

.a11y-subhead h3 {
  margin: 0;
}

.a11y-back:hover {
  background: var(--a-surface) !important;
}

.a11y-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: 999px;
  background: var(--a-surface);
}

.a11y-tabs button {
  padding: 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--a-ink-2);
}

.a11y-tabs button[aria-selected='true'] {
  background: #fff !important;
  color: var(--a-ink);
  box-shadow: 0 2px 8px -3px rgba(11, 13, 18, 0.2);
}

.a11y-outline {
  display: grid;
  gap: 4px;
  margin: 14px 0 8px;
  padding: 0;
  list-style: none;
}

.a11y-outline-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  text-align: left;
  transition: background-color 0.2s ease;
}

.a11y-outline-item:hover {
  background: var(--a-surface) !important;
}

.a11y-outline-item.lvl-2 {
  padding-left: 22px;
}

.a11y-outline-item.lvl-3 {
  padding-left: 36px;
}

.a11y-outline-tag {
  flex: none;
  min-width: 26px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--a-blue-50);
  font-size: 10.5px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  color: var(--a-blue);
}

.a11y-outline-text {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
}

.a11y-outline-empty {
  padding: 12px;
  font-size: 13.5px;
  color: var(--a-ink-2);
}

/* Footer */

.a11y-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px 14px 22px;
  border-top: 1px solid var(--a-line);
  font-size: 12px;
  color: var(--a-ink-2);
}

.a11y-reset {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--a-surface) !important;
  font-size: 13px;
  font-weight: 600;
  color: var(--a-ink) !important;
}

.a11y-reset:hover {
  background: #e7ecf5 !important;
}

.a11y-reset svg {
  width: 15px;
  height: 15px;
}

/* Mobile: bottom sheet */

@media (max-width: 639px) {
  .a11y-trigger {
    right: 14px;
    bottom: 14px;
    height: 52px;
    padding: 0 14px;
  }

  .a11y-panel {
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    max-height: 86vh;
    border-radius: 26px 26px 0 0;
    transform: translateY(100%);
    transition: transform 0.45s var(--a-ease), opacity 0.2s ease;
  }

  .a11y-head::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    width: 40px;
    height: 4px;
    margin-left: -20px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.3);
  }

  .a11y-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .a11y-profile-text small {
    display: none;
  }
}

@media (max-width: 359px) {
  .a11y-profiles {
    grid-template-columns: 1fr;
  }
}

/* ---------- Reading mask ---------- */

.a11y-mask {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 130;
  display: none;
  background: rgba(11, 13, 18, 0.55);
  pointer-events: none;
}

.a11y-mask-top {
  top: 0;
  border-bottom: 3px solid #f5a524;
}

.a11y-mask-bottom {
  bottom: 0;
  border-top: 3px solid #f5a524;
}

html.a11y-masked .a11y-mask {
  display: block;
}

html.a11y-open .a11y-mask {
  display: none;
}

/* ==========================================================
   Page adjustments (never applied to the panel itself)
   ========================================================== */

/* Colour filters are applied per top-level element, so fixed elements keep working */
html.a11y-filtered body > *:not(.a11y-root):not(script) {
  filter: var(--a11y-filter);
}

/* Dark mode: photos are flipped back so they look natural */
html.a11y-dark .feature-media img,
html.a11y-dark .cta-bg {
  filter: invert(1) hue-rotate(180deg);
}

html.a11y-dark body {
  background: #000;
}

/* High contrast: stronger text and borders */
html.a11y-contrast {
  --ink-2: #1f2430;
  --line: rgba(11, 13, 18, 0.35);
}

html.a11y-contrast .hl-word {
  color: rgba(11, 13, 18, 0.7);
}

html.a11y-contrast input::placeholder,
html.a11y-contrast textarea::placeholder {
  color: #4b5261;
}

/* Line height */
html.a11y-lh-1 body *:not(.a11y-root, .a11y-root *) {
  line-height: 1.8 !important;
}

html.a11y-lh-2 body *:not(.a11y-root, .a11y-root *) {
  line-height: 2.2 !important;
}

/* Text spacing (WCAG 1.4.12 values) */
html.a11y-spacing body *:not(.a11y-root, .a11y-root *) {
  letter-spacing: 0.12em !important;
  word-spacing: 0.16em !important;
}

/* Readable font: familiar shapes, generous letter widths */
html.a11y-font body *:not(.a11y-root, .a11y-root *, code, pre, .scan-obj code, .cmp-row span:first-child) {
  font-family: Verdana, Tahoma, 'Segoe UI', Arial, sans-serif !important;
}

/* Align left */
html.a11y-align body *:not(.a11y-root, .a11y-root *) {
  text-align: left !important;
}

html.a11y-align :is(.page-actions, .hero-actions, .cta-actions, .who-hero .page-actions) {
  justify-content: flex-start !important;
}

/* Hide images (the header logo stays for orientation) */
html.a11y-hide-img img:not(.a11y-root img, .header-logo img),
html.a11y-hide-img .cta-bg {
  visibility: hidden !important;
}

/* Pause animations */
html.a11y-pause *:not(.a11y-root, .a11y-root *),
html.a11y-pause *:not(.a11y-root, .a11y-root *)::before,
html.a11y-pause *:not(.a11y-root, .a11y-root *)::after {
  animation-play-state: paused !important;
  transition-duration: 0s !important;
  transition-delay: 0s !important;
  scroll-behavior: auto !important;
}

html.a11y-pause [data-reveal],
html.a11y-pause .split-word > span,
html.a11y-pause .f-reveal,
html.a11y-pause .hv-pop,
html.a11y-pause .pano-pop,
html.a11y-pause .code-line,
html.a11y-pause .code-status,
html.a11y-pause .berg-pill {
  opacity: 1 !important;
  transform: none !important;
  clip-path: none !important;
}

html.a11y-pause .hl-word {
  color: var(--ink) !important;
}

html.a11y-pause .hl-word.hl-strong {
  color: var(--blue) !important;
}

html.a11y-pause .mission .hl-word {
  color: #fff !important;
}

html.a11y-pause .rail {
  transform: none !important;
}

/* Highlight links */
html.a11y-links body a:not(.a11y-root a),
html.a11y-links body button:not(.a11y-root button) {
  outline: 2px solid #f5a524 !important;
  outline-offset: 2px !important;
}

html.a11y-links body a:not(.a11y-root a, .btn, .btn-cta, .m-cta, .challenge-card, .dropdown-link, .header-logo, .icon-btn, .footer-cta-btn) {
  text-decoration: underline !important;
  text-decoration-thickness: 2px !important;
  text-underline-offset: 3px !important;
  background-color: rgba(245, 165, 36, 0.14) !important;
}

/* Focus highlight: strong ring on every focused element, not only keyboard focus */
html.a11y-focus body *:not(.a11y-root *):focus {
  outline: 4px solid #f5a524 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 8px rgba(11, 13, 18, 0.85) !important;
}

/* Big cursor */
html.a11y-cursor,
html.a11y-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M8 4l30 15-13 3-6 14z' fill='%230b0d12' stroke='%23fff' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E") 8 4, auto !important;
}

html.a11y-cursor :is(a, button, label, [role='tab'], [role='slider'], input[type='radio']),
html.a11y-cursor :is(a, button, label, [role='tab'], [role='slider']) * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M8 4l30 15-13 3-6 14z' fill='%233459a6' stroke='%23fff' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E") 8 4, pointer !important;
}

html.a11y-cursor :is(input[type='text'], input[type='email'], textarea) {
  cursor: text !important;
}
