/* ============================================================
   ACCESSIBILITY PANEL  –  accessibility-styles.css
   job.kurier.at Karriere News
   ============================================================ */

/* ── Font size scaling ───────────────────────────────────────
   Applied via data-attribute on <html>.
   Uses !important to override existing px values in main-styles.css.
   Targets all meaningful text-bearing elements on the page.
   ─────────────────────────────────────────────────────────── */

/* Small: 87.5% of base (≈14px) */
[data-a11y-size="small"] .grid-item p,
[data-a11y-size="small"] .grid-item h2,
[data-a11y-size="small"] .grid-item h6,
[data-a11y-size="small"] h1,
[data-a11y-size="small"] body,
[data-a11y-size="small"] button,
[data-a11y-size="small"] a {
  font-size: 87.5% !important;
}

/* Normal: explicit reset (no change needed, but makes intent clear) */
[data-a11y-size="normal"] .grid-item p,
[data-a11y-size="normal"] .grid-item h2 { /* inherit */ }

/* Large: ~120% */
[data-a11y-size="large"] .grid-item p  { font-size: 17px !important; line-height: 1.65 !important; }
[data-a11y-size="large"] .grid-item h2 { font-size: 20px !important; }
[data-a11y-size="large"] .grid-item h6 { font-size: 12px !important; }
[data-a11y-size="large"] h1            { font-size: 2rem !important; }
[data-a11y-size="large"] body          { font-size: 17px !important; }

/* XL: ~137% */
[data-a11y-size="xlarge"] .grid-item p  { font-size: 19px !important; line-height: 1.7  !important; }
[data-a11y-size="xlarge"] .grid-item h2 { font-size: 23px !important; }
[data-a11y-size="xlarge"] .grid-item h6 { font-size: 13px !important; }
[data-a11y-size="xlarge"] h1            { font-size: 2.4rem !important; }
[data-a11y-size="xlarge"] body          { font-size: 19px !important; }

/* ── High contrast ───────────────────────────────────────── */
[data-a11y-contrast] {
  filter: contrast(1.4) !important;
}
[data-a11y-contrast] .grid-item h2,
[data-a11y-contrast] .grid-item p {
  color: #000 !important;
}
[data-a11y-contrast] .grid-item a {
  outline: 1px solid #000;
}

/* ── Reduced motion ──────────────────────────────────────── */
[data-a11y-motion] *,
[data-a11y-motion] *::before,
[data-a11y-motion] *::after {
  animation-duration:        0.001ms !important;
  animation-iteration-count: 1       !important;
  transition-duration:       0.001ms !important;
  scroll-behavior:           auto    !important;
}

/* ── Line spacing ────────────────────────────────────────── */
[data-a11y-spacing] .grid-item p,
[data-a11y-spacing] .grid-item h2,
[data-a11y-spacing] article p,
[data-a11y-spacing] article li,
[data-a11y-spacing] body {
  line-height:    1.95  !important;
  letter-spacing: 0.02em;
}

/* ── Dyslexia font ───────────────────────────────────────── */
[data-a11y-dyslexia] body,
[data-a11y-dyslexia] h1,
[data-a11y-dyslexia] h2,
[data-a11y-dyslexia] p,
[data-a11y-dyslexia] li,
[data-a11y-dyslexia] a,
[data-a11y-dyslexia] button {
  font-family: 'Lexend', sans-serif !important;
  word-spacing: 0.1em;
}

/* ============================================================
   FLOATING BUTTON STACK  (scroll-to-top + accessibility)
   Both buttons share the same visual language:
   – 44×44 px square with 10px radius
   – Kurier red fill / white icon
   – Subtle shadow, clean hover lift
   ============================================================ */



/* ── Accessibility panel wrapper ──────────────────────────── */
#a11y-wrapper {
  position: fixed;
  bottom:   72px;   /* 20px gap above #myBtn (20 + 44 + 8) */
  right:    20px;
  z-index:  9000;
}

/* ── Accessibility trigger button ─────────────────────────── */
#a11y-btn {
  width:           44px;
  height:          44px;
  padding:         0;
  border-radius:   10px;
  border:          none;
  background:      #c8102e;
  color:           #ffffff;
  cursor:          pointer;
  display:         flex;
  align-items:     center;
  justify-content: center;
  box-shadow:      0 2px 10px rgba(200, 16, 46, .35);
  transition:      transform 0.18s ease, box-shadow 0.18s ease;
}

#a11y-btn:hover,
#a11y-btn.open {
  transform:  translateY(-3px);
  box-shadow: 0 6px 18px rgba(200, 16, 46, .45);
}

#a11y-btn:focus-visible {
  outline:        3px solid #c8102e;
  outline-offset: 3px;
}

/* ── Panel ────────────────────────────────────────────────── */
#a11y-panel {
  position:      absolute;
  bottom:        calc(100% + 10px);
  right:         0;
  width:         268px;
  background:    #ffffff;
  border:        1px solid #e8e8e8;
  border-radius: 12px;
  box-shadow:    0 8px 30px rgba(0, 0, 0, .14);
  font-family:   'Roboto', sans-serif;
  font-size:     14px;
  color:         #222;
  overflow:      hidden;
  /* Entrance animation */
  animation:     a11ySlideIn 0.18s ease;
}

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

@keyframes a11ySlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0);   }
}

/* Header */
.a11y-header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         13px 15px 11px;
  border-bottom:   1px solid #f0f0f0;
}

.a11y-title {
  font-weight:     700;
  font-size:       11px;
  letter-spacing:  0.1em;
  text-transform:  uppercase;
  color:           #c8102e;
}

.a11y-close {
  width:           28px;
  height:          28px;
  border-radius:   6px;
  border:          1px solid #e8e8e8;
  background:      none;
  color:           #999;
  cursor:          pointer;
  display:         flex;
  align-items:     center;
  justify-content: center;
  transition:      color 0.15s, border-color 0.15s, background 0.15s;
}

.a11y-close:hover {
  color:         #c8102e;
  border-color:  #c8102e;
  background:    #fff5f6;
}

.a11y-close:focus-visible {
  outline:        2px solid #c8102e;
  outline-offset: 2px;
}

/* Section */
.a11y-section {
  padding:       12px 15px;
  border-bottom: 1px solid #f5f5f5;
}

.a11y-section-label {
  display:        block;
  font-size:      10px;
  font-weight:    700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color:          #bbb;
  margin-bottom:  10px;
}

/* Font size buttons */
.a11y-font-btns {
  display: flex;
  gap:     6px;
}

.a11y-size-btn {
  flex:            1;
  padding:         8px 4px 6px;
  border:          1.5px solid #e8e8e8;
  border-radius:   8px;
  background:      #fafafa;
  cursor:          pointer;
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  gap:             4px;
  transition:      border-color 0.15s, background 0.15s, color 0.15s;
  color:           #555;
}

.a11y-size-preview {
  font-family:  'Merriweather', serif;
  font-weight:  700;
  line-height:  1;
  display:      block;
  height:       22px;
  display:      flex;
  align-items:  center;
}

.a11y-size-tag {
  font-size:   9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #aaa;
  line-height: 1;
}

.a11y-size-btn:hover {
  border-color: #c8102e;
  color:        #c8102e;
}

.a11y-size-btn:hover .a11y-size-tag {
  color: #c8102e;
}

.a11y-size-btn.active,
.a11y-size-btn[aria-pressed="true"] {
  border-color: #c8102e;
  background:   #fff0f2;
  color:        #c8102e;
}

.a11y-size-btn.active .a11y-size-tag,
.a11y-size-btn[aria-pressed="true"] .a11y-size-tag {
  color: #c8102e;
}

.a11y-size-btn:focus-visible {
  outline:        2px solid #c8102e;
  outline-offset: 2px;
}

/* Toggle rows */
.a11y-toggle-row {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         7px 0;
  cursor:          pointer;
  gap:             12px;
}

.a11y-toggle-row + .a11y-toggle-row {
  border-top: 1px solid #f8f8f8;
}

.a11y-toggle-label {
  font-size:   13px;
  color:       #333;
  line-height: 1.3;
  flex:        1;
  user-select: none;
}

/* Toggle track */
.a11y-toggle-track {
  position:     relative;
  display:      inline-block;
  flex-shrink:  0;
  width:        38px;
  height:       21px;
}

.a11y-checkbox {
  position:   absolute;
  width:       1px;
  height:      1px;
  padding:     0;
  margin:     -1px;
  overflow:   hidden;
  clip:       rect(0,0,0,0);
  white-space: nowrap;
  border:      0;
}

.a11y-toggle-thumb {
  position:      absolute;
  inset:         0;
  border-radius: 21px;
  background:    #ddd;
  transition:    background 0.2s;
}

.a11y-toggle-thumb::after {
  content:       '';
  position:      absolute;
  top:           3px;
  left:          3px;
  width:         15px;
  height:        15px;
  border-radius: 50%;
  background:    #fff;
  box-shadow:    0 1px 3px rgba(0,0,0,.2);
  transition:    transform 0.2s;
}

.a11y-checkbox:checked + .a11y-toggle-thumb {
  background: #c8102e;
}

.a11y-checkbox:checked + .a11y-toggle-thumb::after {
  transform: translateX(17px);
}

.a11y-checkbox:focus-visible + .a11y-toggle-thumb {
  outline:        2px solid #c8102e;
  outline-offset: 2px;
}

/* Footer / Reset */
.a11y-footer {
  padding: 10px 15px 13px;
}

.a11y-reset {
  width:       100%;
  padding:     7px;
  border:      1.5px solid #e8e8e8;
  border-radius: 7px;
  background:  none;
  font-size:   12px;
  font-family: 'Roboto', sans-serif;
  color:       #aaa;
  cursor:      pointer;
  letter-spacing: 0.04em;
  transition:  border-color 0.15s, color 0.15s;
}

.a11y-reset:hover {
  border-color: #c8102e;
  color:        #c8102e;
}

.a11y-reset:focus-visible {
  outline:        2px solid #c8102e;
  outline-offset: 2px;
}

/* ── Small screen ─────────────────────────────────────────── */
@media (max-width: 380px) {
  #a11y-wrapper { right: 10px; }
  #a11y-panel   { width: calc(100vw - 24px); right: -10px; }
  #myBtn        { right: 10px !important; bottom: 10px !important; }
}