/* =========================================================
   Accessible version ("Версия для слабовидящих")
   Toggled via data-a11y-* attributes on <html>, set by js/accessibility.js
   ========================================================= */

/* ---- Font size ---- */
html[data-a11y-font="2"] {
  font-size: 125%;
}

html[data-a11y-font="3"] {
  font-size: 150%;
}

/* ---- Line / letter spacing ---- */
html[data-a11y-spacing="wide"] body {
  letter-spacing: 0.03em;
  line-height: 1.7;
}

html[data-a11y-spacing="wide"] p,
html[data-a11y-spacing="wide"] li {
  line-height: 1.8;
}

/* ---- Hide decorative images ---- */
html[data-a11y-images="off"] img,
html[data-a11y-images="off"] iframe {
  visibility: hidden;
}

/* ---- Contrast schemes ---- */
html[data-a11y-contrast="bw"] {
  --color-bg-sky: #FFFFFF;
  --color-text-primary: #000000;
  --color-text-muted: #000000;
  --color-accent-red: #000000;
  --color-accent-blue: #000000;
  --color-text-on-accent: #FFFFFF;
  --color-surface: #FFFFFF;
  --color-surface-cream: #FFFFFF;
  --color-text-card-muted: #000000;
  --color-kicker-bg: #FFFFFF;
  --color-kicker-text: #000000;
  --color-card-mint: #FFFFFF;
  --color-card-blue: #FFFFFF;
  --color-card-blue-deep: #FFFFFF;
  --color-card-blue-soft: #FFFFFF;
  --color-bg-tracks: #FFFFFF;
  --color-track-num-bg: #FFFFFF;
  --color-bg-about-wash: #FFFFFF;
  --color-kicker-bg-blue: #FFFFFF;
  --color-kicker-text-blue: #000000;
  --color-step-card-bg: #FFFFFF;
  --color-step-num-border: #000000;
  --shadow-chip: none;
}

html[data-a11y-contrast="wb"] {
  --color-bg-sky: #000000;
  --color-text-primary: #FFFFFF;
  --color-text-muted: #FFFFFF;
  --color-accent-red: #FFFF00;
  --color-accent-blue: #FFFF00;
  --color-text-on-accent: #000000;
  --color-surface: #000000;
  --color-surface-cream: #000000;
  --color-text-card-muted: #FFFFFF;
  --color-kicker-bg: #000000;
  --color-kicker-text: #FFFF00;
  --color-card-mint: #000000;
  --color-card-blue: #000000;
  --color-card-blue-deep: #000000;
  --color-card-blue-soft: #000000;
  --color-bg-tracks: #000000;
  --color-track-num-bg: #000000;
  --color-bg-about-wash: #000000;
  --color-kicker-bg-blue: #000000;
  --color-kicker-text-blue: #FFFF00;
  --color-step-card-bg: #000000;
  --color-step-num-border: #FFFFFF;
  --shadow-chip: none;
}

html[data-a11y-contrast="wb"] body {
  background: #000000;
}

html[data-a11y-contrast="blue"] {
  --color-bg-sky: #F2ECD9;
  --color-text-primary: #1A2E6B;
  --color-text-muted: #1A2E6B;
  --color-accent-red: #1A2E6B;
  --color-accent-blue: #1A2E6B;
  --color-text-on-accent: #F2ECD9;
  --color-surface: #F2ECD9;
  --color-surface-cream: #F2ECD9;
  --color-text-card-muted: #1A2E6B;
  --color-kicker-bg: #F2ECD9;
  --color-kicker-text: #1A2E6B;
  --color-card-mint: #F2ECD9;
  --color-card-blue: #F2ECD9;
  --color-card-blue-deep: #F2ECD9;
  --color-card-blue-soft: #F2ECD9;
  --color-bg-tracks: #F2ECD9;
  --color-track-num-bg: #F2ECD9;
  --color-bg-about-wash: #F2ECD9;
  --color-kicker-bg-blue: #F2ECD9;
  --color-kicker-text-blue: #1A2E6B;
  --color-step-card-bg: #F2ECD9;
  --color-step-num-border: #1A2E6B;
  --shadow-chip: none;
}

html[data-a11y-contrast="blue"] body {
  background: #F2ECD9;
}

/* Give card-like blocks a visible outline once every background
   collapses to the same flat color under a high-contrast scheme */
html[data-a11y-contrast="bw"] .course-card,
html[data-a11y-contrast="bw"] .advantage-card,
html[data-a11y-contrast="bw"] .step-card,
html[data-a11y-contrast="bw"] .review-card,
html[data-a11y-contrast="bw"] .about__stat,
html[data-a11y-contrast="bw"] .program-track,
html[data-a11y-contrast="bw"] .contact-item,
html[data-a11y-contrast="bw"] .contacts__card,
html[data-a11y-contrast="bw"] .faq-item,
html[data-a11y-contrast="bw"] .hero__chip,
html[data-a11y-contrast="bw"] .signup__card,
html[data-a11y-contrast="bw"] .legal__draft-note,
html[data-a11y-contrast="bw"] .svedeniya__toc,
html[data-a11y-contrast="wb"] .course-card,
html[data-a11y-contrast="wb"] .advantage-card,
html[data-a11y-contrast="wb"] .step-card,
html[data-a11y-contrast="wb"] .review-card,
html[data-a11y-contrast="wb"] .about__stat,
html[data-a11y-contrast="wb"] .program-track,
html[data-a11y-contrast="wb"] .contact-item,
html[data-a11y-contrast="wb"] .contacts__card,
html[data-a11y-contrast="wb"] .faq-item,
html[data-a11y-contrast="wb"] .hero__chip,
html[data-a11y-contrast="wb"] .signup__card,
html[data-a11y-contrast="wb"] .legal__draft-note,
html[data-a11y-contrast="wb"] .svedeniya__toc,
html[data-a11y-contrast="blue"] .course-card,
html[data-a11y-contrast="blue"] .advantage-card,
html[data-a11y-contrast="blue"] .step-card,
html[data-a11y-contrast="blue"] .review-card,
html[data-a11y-contrast="blue"] .about__stat,
html[data-a11y-contrast="blue"] .program-track,
html[data-a11y-contrast="blue"] .contact-item,
html[data-a11y-contrast="blue"] .contacts__card,
html[data-a11y-contrast="blue"] .faq-item,
html[data-a11y-contrast="blue"] .hero__chip,
html[data-a11y-contrast="blue"] .signup__card,
html[data-a11y-contrast="blue"] .legal__draft-note,
html[data-a11y-contrast="blue"] .svedeniya__toc {
  border: 2px solid currentColor;
}

html[data-a11y-contrast="bw"] .header,
html[data-a11y-contrast="wb"] .header,
html[data-a11y-contrast="blue"] .header {
  border-bottom: 2px solid currentColor;
}

html[data-a11y-contrast="bw"] .footer,
html[data-a11y-contrast="wb"] .footer,
html[data-a11y-contrast="blue"] .footer {
  border-top: 2px solid currentColor;
}

/* The hero section is pinned with fixed-rem absolute positioning at the
   1440 breakpoint to match an exact Figma composition. Those offsets
   scale with the root font-size, but the section's max-width does not,
   so at larger text sizes the illustration overflows past the right
   edge. Fall back to the normal stacked flex layout instead. */
html[data-a11y-font="2"] .hero__inner,
html[data-a11y-font="3"] .hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: auto;
  padding: var(--hero-padding-y) var(--section-padding-x);
}

html[data-a11y-font="2"] .hero__content,
html[data-a11y-font="3"] .hero__content {
  position: static;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  left: auto;
  top: auto;
}

html[data-a11y-font="2"] .hero__visual,
html[data-a11y-font="3"] .hero__visual {
  position: relative;
  width: 100%;
  max-width: var(--hero-visual-max-width);
  left: auto;
  top: auto;
}

/* The floating chips over the illustration are anchored by a left/top
   percentage with nowrap text — at larger font sizes their unbounded
   width pushes the right edge past the illustration (and viewport). */
html[data-a11y-font="2"] .hero__chip,
html[data-a11y-font="3"] .hero__chip {
  white-space: normal;
  max-width: 5rem;
  text-align: center;
}

/* Purely decorative (no information beyond the other two chips) —
   hide it rather than chase the last couple of overflow pixels on the
   narrowest phones at maximum text size. */
html[data-a11y-font="3"] .hero__chip--hello {
  display: none;
}

/* Same nowrap-pill overflow as the hero chips, elsewhere on the page */
html[data-a11y-font="2"] .hero__badge,
html[data-a11y-font="3"] .hero__badge,
html[data-a11y-font="2"] .course-card__badge,
html[data-a11y-font="3"] .course-card__badge {
  white-space: normal;
}

/* The "two programs" block pins its label column to a fixed rem width
   at the tablet+ breakpoints — that width grows with the root font size
   and squeezes its sibling until the row overflows. Fall back to the
   stacked mobile layout instead. */
html[data-a11y-font="2"] .tracks,
html[data-a11y-font="3"] .tracks {
  flex-direction: column;
}

html[data-a11y-font="2"] .tracks__head,
html[data-a11y-font="3"] .tracks__head {
  width: auto;
}

/* Flex/grid items default to a content-based minimum width, which
   silently blocks text from wrapping once the scaled font makes that
   content wider than the space available — the classic cause of the
   overflow above. Let every item shrink so text wraps normally instead. */
html[data-a11y-font="2"] *,
html[data-a11y-font="3"] * {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: break-word;
}

/* The review carousel's slides are intentionally wider than their
   viewport (it shows one at a time via overflow:hidden + transform) —
   the blanket max-width above would collapse them into each other. */
html[data-a11y-font="2"] .review-carousel__track,
html[data-a11y-font="3"] .review-carousel__track,
html[data-a11y-font="2"] .review-carousel__slide,
html[data-a11y-font="3"] .review-carousel__slide {
  max-width: none;
}

/* Header nav can overflow at larger text sizes on desktop widths —
   let it wrap onto a second row instead of overlapping content */
html[data-a11y-font="2"] .header__inner,
html[data-a11y-font="3"] .header__inner {
  flex-wrap: wrap;
  row-gap: 0.75rem;
}

html[data-a11y-font="2"] .header__nav,
html[data-a11y-font="3"] .header__nav {
  flex-wrap: wrap;
  width: 100%;
  order: 3;
}

html[data-a11y-font="2"] .header__nav-list,
html[data-a11y-font="3"] .header__nav-list {
  flex-wrap: wrap;
}

/* =========================================================
   Toggle button + panel widget
   ========================================================= */
/* Temporarily hidden site-wide — remove this rule to bring the
   accessibility-version toggle back. Markup/JS left intact below. */
.a11y-toggle {
  display: none !important;
}

.a11y-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  flex-shrink: 0;
  padding: 0.375rem 0.625rem;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--color-text-primary);
  color: var(--color-text-primary);
  font-family: var(--font-family-base);
  font-weight: var(--fw-semibold);
  font-size: 0.6875rem;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.a11y-toggle:hover,
.a11y-toggle:focus-visible,
.a11y-toggle[aria-expanded="true"] {
  background: var(--color-text-primary);
  color: var(--color-surface);
}

.a11y-toggle__icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.a11y-toggle__label {
  display: none;
}

@media (min-width: 1280px) {
  .a11y-toggle__label {
    display: inline;
  }
}

.a11y-panel {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(32, 36, 75, 0.35);
  overflow-y: auto;
}

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

.a11y-panel__inner {
  width: 100%;
  max-width: 26rem;
  margin-top: 4.5rem;
  background: var(--color-surface);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 1.5rem 3rem rgba(20, 22, 50, 0.25);
}

.a11y-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.a11y-panel__title {
  margin: 0;
  font-family: var(--font-family-heading);
  font-weight: var(--fw-bold);
  font-size: 1.0625rem;
  color: var(--color-text-primary);
}

.a11y-panel__close {
  font-size: 1.25rem;
  line-height: 1;
  color: var(--color-text-primary);
  padding: 0.25rem 0.5rem;
}

.a11y-panel__group {
  margin-bottom: 1.25rem;
}

.a11y-panel__group-title {
  margin: 0 0 0.5rem;
  font-family: var(--font-family-base);
  font-weight: var(--fw-semibold);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.a11y-panel__row {
  display: flex;
  gap: 0.5rem;
}

.a11y-panel__row--wrap {
  flex-wrap: wrap;
}

.a11y-btn {
  flex: 1;
  padding: 0.625rem 0.75rem;
  border-radius: 0.625rem;
  border: 1.5px solid color-mix(in srgb, var(--color-text-primary) 25%, transparent);
  font-family: var(--font-family-base);
  font-weight: var(--fw-medium);
  font-size: 0.8125rem;
  color: var(--color-text-primary);
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.a11y-panel__row--wrap .a11y-btn {
  flex: 1 1 calc(50% - 0.25rem);
}

.a11y-btn:hover,
.a11y-btn:focus-visible {
  border-color: var(--color-accent-blue);
}

.a11y-btn[aria-pressed="true"] {
  background: var(--color-text-primary);
  border-color: var(--color-text-primary);
  color: var(--color-surface);
}

.a11y-panel__reset {
  width: 100%;
  padding: 0.75rem;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--color-accent-red);
  color: var(--color-accent-red);
  font-family: var(--font-family-base);
  font-weight: var(--fw-semibold);
  font-size: 0.8125rem;
  text-align: center;
}

.a11y-panel__reset:hover,
.a11y-panel__reset:focus-visible {
  background: var(--color-accent-red);
  color: var(--color-text-on-accent);
}
