/**
 * NDE Eğitim — Erişilebilirlik (a11y) Stilleri
 *
 * Plugin'in tamamında geçerli temel a11y stilleri:
 * - .nde-sr-only utility class (görsel olarak gizli, screen reader okur)
 * - :focus-visible iyileştirmeleri (klavye kullanıcıları için belirgin outline)
 * - .nde-skip-link skip-to-content desteği
 * - prefers-reduced-motion için animasyon bypass
 *
 * @since 1.4.46
 */

/* ───────────────────────── Screen reader only ───────────────────────── */
.nde-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ───────────────────────── Skip link ───────────────────────── */
.nde-skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #1B3A5C;
    color: #fff;
    padding: 8px 16px;
    text-decoration: none;
    font-weight: 600;
    border-bottom-right-radius: 4px;
    z-index: 100000;
    transition: top .15s ease-out;
}
.nde-skip-link:focus {
    top: 0;
    outline: 2px solid #fff;
    outline-offset: -4px;
}

/* ───────────────────────── Focus visible iyileştirmeleri ─────────────── */
/* Klavye kullanıcıları için belirgin outline. Tıklama (mouse) durumunda
 * göstermez; sadece klavye Tab navigasyonunda. */
.nde-dcard a:focus-visible,
.nde-dcard button:focus-visible,
.nde-btn:focus-visible,
.nde-soru-card input:focus-visible,
.nde-soru-card label:focus-visible,
.nde-dtable a:focus-visible,
.nde-dtable button:focus-visible,
.nde-cert-btn:focus-visible {
    outline: 2px solid #1B3A5C;
    outline-offset: 2px;
    border-radius: 3px;
}

/* Form input'ları için focus ring */
.nde-dcard input:focus-visible,
.nde-dcard select:focus-visible,
.nde-dcard textarea:focus-visible {
    outline: 2px solid #1B3A5C;
    outline-offset: 1px;
    border-color: #1B3A5C;
}

/* Sınav cevap seçenekleri için focus — checkbox/radio label */
.nde-soru-options label:focus-within,
.nde-soru-options input:focus-visible + span,
.nde-secenek:focus-within {
    outline: 2px solid #1B3A5C;
    outline-offset: 2px;
    background-color: rgba(27, 58, 92, 0.05);
}

/* ───────────────────────── Reduced motion ───────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ───────────────────────── High contrast ───────────────────────── */
@media (prefers-contrast: more) {
    .nde-btn,
    .nde-dcard {
        border-width: 2px;
    }
    .nde-timer {
        border: 2px solid currentColor;
    }
}

/* ───────────────────────── Sınav timer aria-live announce ──────────── */
/* Görünmez ama screen reader'a kritik durumları bildirir (son 5 dk, son 1 dk) */
#nde-timer-announce {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0,0,0,0) !important;
}

/* ───────────────────────── Fieldset semantic reset ──────────────────── */
/* Radio grupları için <fieldset>+<legend> kullanılıyor — default browser
 * stillerini kaldırıp inline akış görünümünü koru. Screen reader yine
 * "<legend metin>, X seçenekten Y" diye okur. */
.nde-fieldset {
    border: 0;
    padding: 0;
    margin: 0;
}
.nde-fieldset > legend {
    padding: 0;
    margin: 0 0 .5rem;
    font-size: inherit;
    font-weight: 600;
    color: inherit;
    width: 100%;
}

/* ───────────────────────── Form hata/başarı alanları ────────────────── */
/* aria-live ile bağlı hata div'leri için stil yardımcısı (yapı bozulmasın
 * diye opsiyonel — mevcut .nde-error / .nde-success class'larıyla uyumlu). */
.nde-error[aria-live],
.nde-success[aria-live] {
    /* Boşken yer kaplamasın ama transition için yumuşak görün */
    min-height: 0;
}
