/* Barrierefreiheits-Panel */
.a11y-panel__trigger {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  background: transparent;
  color: var(--anthracite-muted);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.a11y-panel__trigger:hover {
  border-color: var(--surface-border-hover);
  color: var(--midnight);
  background: var(--linen);
}

.a11y-panel__trigger .a11y-panel__icon {
  display: block;
  width: 1.375rem;
  height: 1.375rem;
  background-color: currentColor;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
}

@media (min-width: 1024px) {
  .site-header__inner .nav {
    margin-left: auto;
  }
}

@media (max-width: 1023px) {
  .site-header__inner .a11y-panel__trigger {
    margin-left: 0;
    margin-right: 0;
  }
}

.a11y-panel {
  position: fixed;
  inset: 0;
  z-index: 350;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: calc(var(--header-height) + 0.5rem) 1rem 1rem;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: visibility 0.45s var(--ease-soft), opacity 0.45s var(--ease-soft);
}

.a11y-panel.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.a11y-panel:not(.is-open) {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.a11y-panel__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  opacity: 0;
  transition: opacity 0.45s var(--ease-soft);
}

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

.a11y-panel__dialog {
  position: relative;
  width: 100%;
  max-width: 22rem;
  max-height: calc(100vh - var(--header-height) - 2rem);
  overflow: auto;
  background: var(--cream);
  border: 1px solid var(--surface-border);
  border-radius: 4px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.18);
  color: var(--text-body);
  transform: translateY(-0.75rem);
  opacity: 0;
  transition: transform 0.55s var(--ease-calm), opacity 0.45s var(--ease-soft);
}

.a11y-panel.is-open .a11y-panel__dialog {
  transform: translateY(0);
  opacity: 1;
}

.a11y-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--surface-border);
}

.a11y-panel__title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--text-heading);
  margin: 0;
  line-height: 1.25;
}

.a11y-panel__close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  background: transparent;
  color: var(--anthracite-muted);
  cursor: pointer;
}

.a11y-panel__close svg {
  width: 1rem;
  height: 1rem;
}

.a11y-panel__body {
  padding: 1rem 1.25rem 1.25rem;
}

.a11y-panel__section {
  margin: 0 0 1.25rem;
  padding: 0;
  border: 0;
}

.a11y-panel__label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 0.65rem;
}

.a11y-panel__font-group {
  display: flex;
  gap: 0.35rem;
}

.a11y-panel__font-btn {
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.5rem;
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  background: transparent;
  color: var(--text-body);
  font-weight: 600;
  cursor: pointer;
}

.a11y-panel__font-btn.is-active {
  border-color: var(--accent);
  background: var(--surface-accent-soft);
  color: var(--text-heading);
}

.a11y-panel__radio {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.9375rem;
  cursor: pointer;
}

.a11y-panel__radio input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.a11y-panel__reset {
  width: 100%;
  margin-top: 0.5rem;
}

.a11y-panel__footer {
  margin: 1rem 0 0;
  font-size: 0.875rem;
}

.a11y-panel__footer a {
  color: var(--accent);
}

@media (max-width: 1023px) {
  .a11y-panel {
    position: fixed;
    inset: auto 0 0 0;
    top: var(--header-height);
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    visibility: visible;
    opacity: 1;
    pointer-events: none;
    transition: max-height 0.55s var(--ease-calm);
  }

  .a11y-panel.is-open {
    max-height: 85vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    pointer-events: auto;
  }

  .a11y-panel__backdrop {
    display: none;
  }

  .a11y-panel__dialog {
    max-width: none;
    width: 100%;
    max-height: none;
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: none;
    transform: none;
    opacity: 1;
    transition: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .a11y-panel,
  .a11y-panel__backdrop,
  .a11y-panel__dialog {
    transition: none;
  }
}

/* Dark scheme panel surfaces */
html[data-a11y-scheme="dark"] .a11y-panel__dialog {
  background: #1e293b;
}

html[data-a11y-scheme="dark"] .finder-modal__dialog,
html[data-a11y-scheme="dark"] .pdf-modal__dialog {
  background: #1e293b;
  color: var(--text-body);
}

html[data-a11y-scheme="dark"] .finder-modal__body,
html[data-a11y-scheme="dark"] .pdf-modal__body {
  background: #0f172a;
}

html[data-a11y-scheme="dark"] .finder-option label {
  background: #1e293b;
  color: var(--text-body);
}

html[data-a11y-scheme="dark"] .finder-option input:checked + label {
  background: var(--surface-accent-soft);
  color: var(--text-heading);
}
