/* ================================================================
   Haberdijital — UX Enhancements
   Skill: frontend-design + ui-ux-pro-max
   ================================================================ */

/* ----------------------------------------------------------------
 * 1. OKUMA İLERLEME ÇUBUĞU
 * ---------------------------------------------------------------- */
#hd-reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--hd-red);
    z-index: 10000;
    transition: width .08s linear;
    pointer-events: none;
    transform-origin: left center;
}
/* Gölge — hafif derinlik hissi */
#hd-reading-progress::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 60px;
    height: 3px;
    background: rgba(255, 255, 255, .35);
    filter: blur(4px);
}

/* ----------------------------------------------------------------
 * 2. SKELETON LOADING
 * Skill: ui-ux-pro-max — "Skeleton screens for loading states"
 * ---------------------------------------------------------------- */
@keyframes hd-shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position: 600px 0; }
}

.hd-skeleton {
    background: linear-gradient(
        90deg,
        #ebebeb 25%,
        #f5f5f5 37%,
        #ebebeb 63%
    );
    background-size: 1200px 100%;
    animation: hd-shimmer 1.4s ease-in-out infinite;
    border-radius: var(--hd-radius);
}

/* Haber kartı iskeleti */
.hd-card-skeleton {
    background: var(--hd-bg-white);
    border-radius: var(--hd-radius-lg);
    overflow: hidden;
    padding: 0;
}
.hd-card-skeleton .sk-img {
    width: 100%;
    aspect-ratio: 16/9;
}
.hd-card-skeleton .sk-body { padding: 12px 14px; }
.hd-card-skeleton .sk-cat  { width: 60px;  height: 14px; margin-bottom: 10px; }
.hd-card-skeleton .sk-title-1 { width: 100%; height: 14px; margin-bottom: 7px; }
.hd-card-skeleton .sk-title-2 { width: 75%;  height: 14px; margin-bottom: 12px; }
.hd-card-skeleton .sk-meta  { width: 120px; height: 11px; }

/* Liste iskelet */
.hd-list-skeleton {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--hd-border-light);
}
.hd-list-skeleton .sk-thumb { width: 64px; height: 48px; flex-shrink: 0; }
.hd-list-skeleton .sk-content { flex: 1; }
.hd-list-skeleton .sk-line-1 { width: 90%; height: 12px; margin-bottom: 7px; }
.hd-list-skeleton .sk-line-2 { width: 55%; height: 10px; }

/* prefers-reduced-motion — skill kuralı */
@media (prefers-reduced-motion: reduce) {
    .hd-skeleton { animation: none; background: #ebebeb; }
}

/* ----------------------------------------------------------------
 * 3. YAZICI İÇİNDEKİLER (TOC)
 * ---------------------------------------------------------------- */
.hd-toc-wrap {
    background: #faf9f8;
    border: 1px solid var(--hd-border);
    border-left: 3px solid var(--hd-red);
    border-radius: var(--hd-radius-lg);
    padding: 18px 20px;
    margin: 28px 0;
    font-size: 14px;
}
.hd-toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    cursor: pointer;
    user-select: none;
}
.hd-toc-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .3px;
    text-transform: uppercase;
    color: var(--hd-secondary);
    display: flex;
    align-items: center;
    gap: 7px;
}
.hd-toc-toggle {
    font-size: 18px;
    color: var(--hd-text-light);
    transition: transform .2s;
    line-height: 1;
}
.hd-toc-wrap.collapsed .hd-toc-toggle { transform: rotate(-90deg); }
.hd-toc-wrap.collapsed .hd-toc-list  { display: none; }

.hd-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.hd-toc-list li { border-bottom: 1px solid var(--hd-border-light); }
.hd-toc-list li:last-child { border-bottom: none; }
.hd-toc-list a {
    display: block;
    padding: 7px 0 7px 12px;
    color: var(--hd-text);
    font-size: 13px;
    line-height: 1.4;
    transition: color .15s, padding-left .15s;
    position: relative;
}
.hd-toc-list a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--hd-red);
    border-radius: 2px;
    transition: height .15s;
}
.hd-toc-list a:hover { color: var(--hd-red); padding-left: 16px; }
.hd-toc-list a:hover::before { height: 16px; }
.hd-toc-list a.hd-toc-active { color: var(--hd-red); font-weight: 600; }
.hd-toc-list a.hd-toc-active::before { height: 16px; }

/* H3 girintisi */
.hd-toc-list .hd-toc-h3 a { padding-left: 24px; font-size: 12px; color: var(--hd-text-light); }
.hd-toc-list .hd-toc-h3 a:hover { padding-left: 28px; color: var(--hd-red); }

/* ----------------------------------------------------------------
 * 4. YÜZEN SOSYAL PAYLAŞIM
 * ---------------------------------------------------------------- */
#hd-float-share {
    position: fixed;
    left: 16px;
    top: 50%;
    transform: translateY(-50%) translateX(-80px);
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 500;
    opacity: 0;
    transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .25s;
    pointer-events: none;
}
#hd-float-share.visible {
    transform: translateY(-50%) translateX(0);
    opacity: 1;
    pointer-events: auto;
}
.hd-float-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: transform .15s, box-shadow .15s;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
    flex-shrink: 0;
    /* ui-ux-pro-max: 44px touch target gölgesi */
    position: relative;
}
.hd-float-btn::after {
    content: '';
    position: absolute;
    inset: -3px;
}
.hd-float-btn:hover {
    transform: scale(1.12);
    box-shadow: 0 4px 14px rgba(0,0,0,.25);
    color: #fff;
}
.hd-float-btn.fb { background: #1877f2; }
.hd-float-btn.tw { background: #1a1a1a; }
.hd-float-btn.wa { background: #25d366; }
.hd-float-btn.tg { background: #0088cc; }
.hd-float-btn.cp { background: var(--hd-secondary); }

/* Mobilde gizle — ekran dar */
@media (max-width: 1180px) {
    #hd-float-share { display: none; }
}

/* ----------------------------------------------------------------
 * 5. KATEGORİ RENK SİSTEMİ
 * PHP tarafı body'ye .hd-cat-{id} ekler
 * --cat-color değişkeni category.php, single.php'de kullanılır
 * ---------------------------------------------------------------- */
:root { --cat-color: var(--hd-red); }

/* Kategori başlık çubukları */
.hd-cat-head-bar  { border-left-color: var(--cat-color) !important; }
.hd-section-title { border-color: var(--cat-color) !important; color: var(--cat-color) !important; }
.hd-badge-cat     { background: var(--cat-color) !important; }

/* Navbar'da aktif kategori vurgusu */
.hd-nav-menu > .current-cat > a { color: var(--cat-color) !important; }

/* ----------------------------------------------------------------
 * 6. BLUR-UP GÖRSEL YÜKLEME
 * Skill: ui-ux-pro-max — "Reserve space for async content" (CLS önleme)
 * ---------------------------------------------------------------- */
img.hd-lazy-blur {
    filter: blur(12px);
    transform: scale(1.01);   /* CLS önle — blur kenarları gizlemek için */
    transition: filter .45s ease, transform .45s ease;
    will-change: filter, transform;
}
img.hd-lazy-blur.hd-loaded {
    filter: blur(0);
    transform: scale(1);
}

/* Aspect ratio koruyucu sarmalayıcı — CLS önleme */
.hd-img-wrap {
    position: relative;
    overflow: hidden;
    background: #e8e4df;
}
.hd-img-wrap::before {
    content: '';
    display: block;
}
/* Varsayılan 16:9 */
.hd-img-wrap.ratio-16-9::before { padding-top: 56.25%; }
.hd-img-wrap.ratio-4-3::before  { padding-top: 75%; }
.hd-img-wrap.ratio-3-4::before  { padding-top: 133.33%; }
.hd-img-wrap.ratio-1-1::before  { padding-top: 100%; }
.hd-img-wrap img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ----------------------------------------------------------------
 * 7. KART MİKRO-ETKİLEŞİMLERİ (güncelleme)
 * Skill: frontend-design — lift effect with transform/opacity only
 * ---------------------------------------------------------------- */
.hd-card {
    transition: box-shadow .2s, transform .2s;
    will-change: transform;
}
.hd-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.hd-card:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,.1);
}

/* Başlık altçizgi slide */
.hd-card-title a {
    background-image: linear-gradient(var(--cat-color, var(--hd-red)), var(--cat-color, var(--hd-red)));
    background-repeat: no-repeat;
    background-size: 0% 2px;
    background-position: 0 100%;
    transition: background-size .25s ease, color .15s;
    padding-bottom: 1px;
}
.hd-card:hover .hd-card-title a { background-size: 100% 2px; }

@media (prefers-reduced-motion: reduce) {
    .hd-card { transition: box-shadow .1s; }
    .hd-card:hover { transform: none; }
    .hd-card-title a { transition: color .1s; background-image: none; }
}

/* ----------------------------------------------------------------
 * 8. GALERİ SWIPE DESTEĞI
 * ---------------------------------------------------------------- */
.hd-gallery-slider {
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
    cursor: grab;
}
.hd-gallery-slider.dragging { cursor: grabbing; }

/* Lightbox geliştirmeleri */
.hd-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.92);
    z-index: 9990;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}
.hd-lightbox.open {
    opacity: 1;
    pointer-events: auto;
}
.hd-lightbox-inner {
    position: relative;
    max-width: min(1000px, 95vw);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.hd-lightbox-img {
    max-height: 80vh;
    max-width: 100%;
    object-fit: contain;
    border-radius: 4px;
    transition: opacity .2s;
}
.hd-lightbox-img.switching { opacity: 0; }

.hd-lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,.12);
    color: #fff;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 50%;
    width: 48px;   /* ui-ux-pro-max: 44px+ touch target */
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: background .15s, transform .15s;
    z-index: 1;
    backdrop-filter: blur(6px);
}
.hd-lb-nav:hover { background: rgba(255,255,255,.25); }
.hd-lb-nav:active { transform: translateY(-50%) scale(.92); }
.hd-lb-prev { left: -60px; }
.hd-lb-next { right: -60px; }
.hd-lb-close {
    position: absolute;
    top: -44px;
    right: 0;
    background: none;
    color: rgba(255,255,255,.7);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: color .15s;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hd-lb-close:hover { color: #fff; }

.hd-lb-caption {
    color: rgba(255,255,255,.75);
    font-size: 13px;
    text-align: center;
    margin-top: 12px;
    max-width: 600px;
}
.hd-lb-counter {
    color: rgba(255,255,255,.5);
    font-size: 11px;
    letter-spacing: .5px;
    margin-top: 6px;
}

@media (max-width: 768px) {
    .hd-lb-prev { left: 8px; }
    .hd-lb-next { right: 8px; }
    .hd-lb-close { top: -40px; right: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .hd-lightbox, .hd-lightbox-img { transition: none; }
}

/* ----------------------------------------------------------------
 * 9. CANLI ZAMAN DAMGASI
 * "X dakika önce" gösterimi için stil
 * ---------------------------------------------------------------- */
.hd-live-ts {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--hd-text-muted);
}
.hd-live-ts::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    animation: hd-pulse 2s infinite;
    flex-shrink: 0;
}
@keyframes hd-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .5; transform: scale(.8); }
}
/* Son 1 saatte yayınlandıysa yeşil nokta göster */
.hd-live-ts.hd-ts-old::before { background: #ccc; animation: none; }

@media (prefers-reduced-motion: reduce) {
    .hd-live-ts::before { animation: none; }
    @keyframes hd-pulse { }
}

/* ================================================================
   10. ARIA ETİKETLERİ & SEMANTİK HTML — GÖRSEL GÖSTERGELERİ
   Skill: ui-ux-pro-max — focus-visible, 44px touch, keyboard nav
   ================================================================ */

/* ----------------------------------------------------------------
 * Skip link — klavye kullanıcıları için
 * ---------------------------------------------------------------- */
.hd-skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    z-index: 99999;
    padding: 10px 18px;
    background: var(--hd-red, #cc0000);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    border-radius: 0 0 6px 0;
    transition: top .15s ease;
}
.hd-skip-link:focus {
    top: 0;
}

/* ----------------------------------------------------------------
 * 11. KLAVYE FOKUS STİLLERİ
 * :focus-visible — yalnızca klavye odağında görünür
 * ---------------------------------------------------------------- */

/* Global reset — fare odağını gizle */
*:focus:not(:focus-visible) {
    outline: none;
}

/* Klavye odak halkası — tüm etkileşimli elementler */
*:focus-visible {
    outline: 2px solid var(--hd-red, #cc0000);
    outline-offset: 3px;
    border-radius: 3px;
}

/* Linkler */
a:focus-visible {
    outline: 2px solid var(--hd-red, #cc0000);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Butonlar */
button:focus-visible,
.button:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--hd-red, #cc0000);
    outline-offset: 2px;
    border-radius: 4px;
    box-shadow: 0 0 0 4px rgba(204, 0, 0, .15);
}

/* Form elemanları */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--hd-red, #cc0000);
    outline-offset: 0;
    border-color: var(--hd-red, #cc0000);
    box-shadow: 0 0 0 3px rgba(204, 0, 0, .12);
}

/* Navigasyon menüsü */
.hd-nav a:focus-visible,
.hd-mobile-nav a:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
    border-radius: 3px;
    background: rgba(255, 255, 255, .15);
}

/* Kart linkleri — görünür focus halkası */
.hd-card:focus-within {
    outline: 2px solid var(--hd-red, #cc0000);
    outline-offset: 2px;
    border-radius: 8px;
}

/* İçindekiler (TOC) linkleri */
.hd-toc a:focus-visible {
    outline: 2px solid var(--hd-red, #cc0000);
    outline-offset: 2px;
    padding-left: 4px;
}

/* Sosyal paylaşım butonları */
.hd-share-btn:focus-visible,
.hd-float-share-btn:focus-visible {
    outline: 2px solid var(--hd-red, #cc0000);
    outline-offset: 3px;
    border-radius: 50%;
}

/* ----------------------------------------------------------------
 * ARIA genişletme göstergeleri
 * ---------------------------------------------------------------- */

/* aria-expanded="true" olan hamburger → X ikonuna dönüşür */
[aria-expanded="true"] .hd-icon-hamburger { display: none; }
[aria-expanded="false"] .hd-icon-close   { display: none; }
[aria-expanded="true"] .hd-icon-close    { display: inline-block; }

/* Dropdown oku — aria-expanded durumuna göre döner */
.hd-nav-item button[aria-expanded="true"] .hd-dropdown-arrow {
    transform: rotate(180deg);
}
.hd-nav-item button .hd-dropdown-arrow {
    transition: transform .2s ease;
    display: inline-block;
}

/* ----------------------------------------------------------------
 * Semantic HTML görsel vurgular
 * ---------------------------------------------------------------- */

/* <mark> etiketi — önemli bilgi */
mark.hd-highlight {
    background: rgba(255, 200, 0, .35);
    padding: 1px 4px;
    border-radius: 3px;
    color: inherit;
}

/* <abbr> — açıklama imleci */
abbr[title] {
    text-decoration: underline dotted;
    cursor: help;
}

/* <details> / <summary> — yerel açıklama */
details.hd-details > summary {
    cursor: pointer;
    list-style: none;
    padding: 10px 14px;
    background: #f5f5f5;
    border-radius: 6px;
    font-weight: 600;
    min-height: 44px;
    display: flex;
    align-items: center;
}
details.hd-details > summary::-webkit-details-marker { display: none; }
details.hd-details > summary::after {
    content: '+';
    margin-left: auto;
    font-size: 1.2em;
    color: var(--hd-red, #cc0000);
}
details.hd-details[open] > summary::after { content: '−'; }
details.hd-details > summary:focus-visible {
    outline: 2px solid var(--hd-red, #cc0000);
    outline-offset: 2px;
}

/* ----------------------------------------------------------------
 * aria-live bölgesi görsel geri bildirim
 * ---------------------------------------------------------------- */
[aria-live="polite"].hd-status-region,
[aria-live="assertive"].hd-status-region {
    min-height: 24px;
}

/* Yükleniyor durumu */
[aria-busy="true"] {
    opacity: .65;
    pointer-events: none;
}

/* ----------------------------------------------------------------
 * Sehir selaktor (editorial-tools.php)
 * ---------------------------------------------------------------- */
.hd-city-selector {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,.18);
    padding: 24px;
    width: min(480px, 94vw);
    max-height: 60vh;
    overflow-y: auto;
}

.hd-city-selector__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.hd-city-selector__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.hd-city-selector__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    line-height: 1;
    padding: 4px 8px;
    min-height: 44px;
    min-width: 44px;
}
.hd-city-selector__close:focus-visible {
    outline: 2px solid var(--hd-red, #cc0000);
    border-radius: 4px;
}

.hd-city-selector__grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hd-city-btn {
    padding: 6px 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: .82rem;
    cursor: pointer;
    min-height: 32px;
    transition: background .12s ease, color .12s ease;
}
.hd-city-btn:hover {
    background: #e5e7eb;
}
.hd-city-btn--active,
.hd-city-btn[aria-pressed="true"] {
    background: var(--hd-red, #cc0000);
    color: #fff;
    border-color: var(--hd-red, #cc0000);
}
.hd-city-btn:focus-visible {
    outline: 2px solid var(--hd-red, #cc0000);
    outline-offset: 2px;
}

.hd-city-selector__active {
    margin-top: 12px;
    font-size: .85rem;
    color: #555;
}

.hd-city-clear {
    background: none;
    border: none;
    color: var(--hd-red, #cc0000);
    cursor: pointer;
    font-size: .82rem;
    text-decoration: underline;
    padding: 0 4px;
}

/* Sehir widget */
.hd-city-widget select.hd-city-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: .9rem;
    min-height: 44px;
    background: #fff;
    cursor: pointer;
}
.hd-city-widget select.hd-city-select:focus-visible {
    outline: 2px solid var(--hd-red, #cc0000);
    border-color: var(--hd-red, #cc0000);
}

@media (prefers-reduced-motion: reduce) {
    .hd-nav-item button .hd-dropdown-arrow { transition: none; }
}

/* ================================================================
 * Koyu Arka Plan Üzerinde Odak Çizgisi
 * Üst bar select elemanları için beyaz outline
 * ================================================================ */
.hd-tb-city-select:focus-visible,
.hd-info-city select:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ================================================================
 * Son Dakika Bandı — Azaltılmış Hareket Desteği
 * ================================================================ */
@media (prefers-reduced-motion: reduce) {
    .hd-ticker-content {
        animation: none;
        transform: none;
    }
    .hd-breaking-dot {
        animation: none;
        opacity: 1;
    }
    .hd-slider-img {
        transition: none;
    }
}
