/* ============================================================================
   css/a11y.css — кнопка и панель доступности (js/a11y.js), общие для
   index.html и cv.html: размер текста, высокий контраст, коррекция цвета.
   ============================================================================ */

/* ---- Кнопка в шапке: иконка в кружке ---- */
.a11y { position: relative; display: flex; }
.a11y__btn {
  position: relative;
  display: grid; place-items: center;
  width: 34px; height: 34px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  color: var(--color-text);
  cursor: pointer;
  mix-blend-mode: difference; /* как остальные элементы шапки — негатив по дыму */
  transition: border-color var(--transition), color var(--transition);
}
.a11y__btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.a11y__btn circle { fill: currentColor; stroke: none; }
.a11y__btn:hover, .a11y__btn:focus-visible, .a11y.is-open .a11y__btn { border-color: var(--color-accent); color: var(--color-accent); }
/* точка: какая-то настройка включена */
.a11y__btn.is-set::after {
  content: ''; position: absolute; top: -1px; right: -1px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-accent);
}

/* ---- Панель ---- */
.a11y__panel {
  position: absolute; top: calc(100% + 10px); right: -6px; z-index: 210;
  width: min(290px, calc(100vw - 24px));
  padding: 14px 16px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  background: rgba(6, 8, 16, 0.95);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-secondary);
  text-align: left;
}
.a11y__panel[hidden] { display: none; }
.a11y__panel button { font: inherit; color: inherit; cursor: pointer; }
.a11y__panel button:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.a11y__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.a11y__title { margin: 0; font-size: var(--text-body); font-weight: var(--fw-title, 500); color: var(--color-white, #fff); }
.a11y__close {
  display: grid; place-items: center; width: 34px; height: 34px; margin-right: -8px;
  padding: 0; border: 0; border-radius: 50%; background: transparent;
}
.a11y__close svg { width: 11px; height: 11px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.a11y__close:hover { background: var(--color-surface); }
.a11y__label {
  margin: 14px 0 8px;
  font-size: var(--fs-label); letter-spacing: var(--ls-label, 0.1em); text-transform: uppercase;
  color: var(--color-text-muted);
}
.a11y__size { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 8px; }
.a11y__step {
  width: 40px; height: 40px; padding: 0;
  border: 1px solid var(--color-border); border-radius: 50%; background: rgba(255, 255, 255, 0.04);
  font-weight: var(--fw-ui, 500);
}
.a11y__step:hover:not(:disabled) { border-color: var(--color-accent); color: var(--color-accent); }
.a11y__step:disabled { opacity: 0.35; cursor: default; }
.a11y__value { text-align: center; font-variant-numeric: tabular-nums; }
.a11y__toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 44px; margin-top: 14px; padding: 0 2px;
  border: 0; border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border);
  background: none; text-align: left;
}
.a11y__toggle i { position: relative; flex: none; width: 36px; height: 20px; border-radius: 10px; background: rgba(255, 255, 255, 0.18); transition: background var(--transition); }
.a11y__toggle i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--color-white, #fff); transition: transform var(--transition); }
.a11y__toggle[aria-pressed="true"] i { background: var(--color-accent); }
.a11y__toggle[aria-pressed="true"] i::after { transform: translateX(16px); }
.a11y__cvd { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.a11y__chip {
  display: flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 6px 10px;
  border: 1px solid var(--color-border); border-radius: 8px; background: rgba(255, 255, 255, 0.03);
  font-size: 13px; text-align: left;
}
.a11y__chip:hover { border-color: rgba(255, 255, 255, 0.45); }
.a11y__chip[aria-pressed="true"] { border-color: var(--color-accent); background: rgba(125, 211, 252, 0.12); }
/* образец: те же красный/зелёный/синий, пропущенные через свой фильтр коррекции */
.a11y__swatch { flex: none; width: 20px; height: 12px; border-radius: 3px; background: linear-gradient(90deg, #e5484d 0 33%, #30a46c 33% 66%, #3e63dd 66%); }
.a11y__swatch--protan { filter: url(#a11y-protan); }
.a11y__swatch--deutan { filter: url(#a11y-deutan); }
.a11y__swatch--tritan { filter: url(#a11y-tritan); }
.a11y__reset {
  margin-top: 14px; min-height: 36px; padding: 0;
  border: 0; background: none;
  color: var(--color-text-muted); text-decoration: underline; text-underline-offset: 3px;
}
.a11y__reset:hover { color: var(--color-text); }
.a11y-filters { position: absolute; width: 0; height: 0; overflow: hidden; }

@media (max-width: 940px), (pointer: coarse) {
  .a11y__btn { width: 40px; height: 40px; }
}

/* ---- Размер текста: zoom на блоках с текстом (ширина колонки та же,
   строки переносятся заново) ---- */
html[data-a11y-size] .page-section,
html[data-a11y-size] .pd-article,
html[data-a11y-size] .star-detail__body,
html[data-a11y-size] .mascot__bubble,
html[data-a11y-size] .perf-toast,
html[data-a11y-size] .cv { zoom: var(--a11y-zoom); }

/* ---- Высокий контраст: токены — в css/variables.css; здесь — то, что не
   токен: дым за текстом тише, подписи звёзд ярче ---- */
html[data-contrast="high"] .fluid-canvas { opacity: 0.35; }
html[data-contrast="high"] .star-label { color: var(--color-white, #fff); }

/* ---- Коррекция цвета (дальтонизация): фильтр на корне документа —
   у <html> он не меняет позиционирование fixed-элементов ---- */
html[data-cvd="protan"] { filter: url(#a11y-protan); }
html[data-cvd="deutan"] { filter: url(#a11y-deutan); }
html[data-cvd="tritan"] { filter: url(#a11y-tritan); }

/* Печать CV: без кнопки, фильтров и увеличения — PDF всегда одинаковый */
@media print {
  .a11y, .a11y-filters { display: none !important; }
  html[data-cvd] { filter: none !important; }
  html[data-a11y-size] .cv { zoom: 1; }
}
