/**
 * GelecekSosyalizm — cleanup.css
 * ---------------------------------------------------------------
 * Amaç: style.css içindeki tekrarlayan `!important` zincirlerini
 * specificity (ve yükleme sırası) yoluyla nötralize etmek.
 *
 * Bu dosya style.css'TEN SONRA enqueue edilmelidir. Aynı specificity
 * söz konusu olduğunda son yüklenen kazanır; bu dosyada ayrıca
 * `html body ...` / `body.single-post ...` gibi ek class/element
 * sayıları kullanılarak specificity'yi artırıyoruz, bu sayede
 * style.css'teki !important'lara gerek kalmadan override yapılabilir.
 *
 * Kullanılan token'lar: css/tokens.css'ten gelir (--space-*).
 *
 * ÖNEMLİ: style.css HENÜZ DEĞİŞTİRİLMEDİ. Bu dosya yan-yana çalışır;
 * style.css'teki !important kuralları olduğu yerde duruyor ama bu
 * dosyadaki kurallar ya onlarla EŞDEĞER ya da DAHA YÜKSEK specificity'ye
 * sahip; ileride style.css'ten !important'lar kademeli kaldırılabilir.
 * ============================================================== */

/* ========================================================
   1) KONSOLIDE MOBILE BLOK — <= 768px
   --------------------------------------------------------
   Replaces (kısmen): style.css:3696-3970 (550px), 3972-4019 (480px),
   4022-4158 (320px), 4999-5025 (768px), 4770-4791 (1024px)
   Bu dosyada tek bir base @media (max-width: 768px) bloğu var,
   küçük viewport özelleştirmeleri sonra geliyor. Tüm width/padding
   sıfırlama kuralları !important olmadan, ama daha spesifik
   selector'larla yazıldı.
   ======================================================== */
@media (max-width: 768px) {

    /* Replaces: style.css:3697-3713, 3973-3988, 4023-4038, 4999-5013
       — .site-main / .content-area / .sidebar full width reset */
    html body .site-main,
    html body.single-post .site-main {
        padding: var(--space-3, 12px);
        gap: var(--space-3, 12px);
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
    }

    html body .site-main > .content-area,
    html body .site-main > .sidebar {
        width: 100%;
        max-width: 100%;
        padding-left: 0;
        padding-right: 0;
        margin-left: 0;
        margin-right: 0;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    html body .site-main > .sidebar {
        margin-top: var(--space-5, 24px);
    }

    /* Replaces: style.css:3783-3789, 3990-3996, 4041-4047
       — .single-post container */
    html body.single-post article.single-post,
    html body .content-area > .single-post {
        padding: var(--space-1, 4px);
        margin: 0;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Replaces: style.css:3841-3853, 3998-4009, 4103-4113
       — .single-post .entry-content full width */
    html body.single-post .single-post .entry-content,
    html body .single-post article .entry-content {
        padding: var(--space-2, 8px);
        font-size: 16px;
        line-height: 1.6;
        text-align: justify;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        overflow-x: hidden;
    }

    /* Replaces: style.css:3855-3861, 4115-4119, 3686-3690
       — entry-content içindeki img genişliği. style.css'te
       width: calc(100% - 16px) !important şeklinde idi.
       Aslında margin'i ayarlayıp width:auto bırakmak daha doğru. */
    html body .single-post .entry-content img:not(.alignleft):not(.alignright):not(.aligncenter) {
        margin: var(--space-2, 10px) var(--space-1, 5px);
        width: auto;
        max-width: calc(100% - var(--space-2, 10px));
        height: auto;
        border-radius: 4px;
        box-sizing: border-box;
        display: block;
    }

    /* Replaces: style.css:3863-3870, 4011-4018
       — entry-content paragrafları */
    html body .single-post .entry-content p {
        margin-bottom: var(--space-4, 16px);
        word-wrap: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
        width: 100%;
        overflow-x: hidden;
    }

    /* Replaces: style.css:545-584
       — WP-Block embed iframe/blockquote tam genişlik */
    html body .entry-content .wp-block-embed,
    html body .entry-content figure.wp-block-embed-wordpress {
        margin: var(--space-4, 15px) 0;
        padding: var(--space-2, 10px);
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }

    html body .entry-content .wp-block-embed .wp-block-embed__wrapper,
    html body .entry-content .wp-block-embed__wrapper > *,
    html body .entry-content figure.wp-block-embed-wordpress blockquote {
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }

    /* Replaces: style.css:5019-5024 — post-card full width */
    html body .post-card,
    html body .post-card .post-card-content {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Replaces: style.css:1930-1973
       — .single-pdf mobile grid stacking */
    html body .single-pdf .pdf-content {
        display: block;
        grid-template-columns: none;
        gap: 0;
        margin-bottom: var(--space-5, 30px);
    }

    html body .single-pdf .pdf-content .pdf-cover {
        margin-bottom: var(--space-4, 20px);
        text-align: center;
        width: 100%;
        order: 1;
        padding: 0 var(--space-2, 10px);
    }

    html body .single-pdf .pdf-content .pdf-info {
        padding: 0 var(--space-3, 15px);
        width: 100%;
        order: 2;
        display: block;
    }

    html body .single-pdf .entry-header {
        padding-left: var(--space-3, 15px);
        margin-bottom: var(--space-4, 20px);
    }
}

/* ========================================================
   2) KÜÇÜK MOBİL — <= 550px (sadece ek ince ayar)
   Replaces: style.css:3696-3970 küçük detaylar
   ======================================================== */
@media (max-width: 550px) {
    html body .single-post .entry-content img:not(.alignleft):not(.alignright):not(.aligncenter) {
        margin: var(--space-2, 10px) var(--space-1, 5px);
        max-width: calc(100% - var(--space-2, 10px));
    }

    html body .single-post .entry-title {
        font-size: 1.5rem;
        line-height: 1.2;
    }
}

/* ========================================================
   3) ÇOK KÜÇÜK MOBİL — <= 320px
   Replaces: style.css:4022-4158
   ======================================================== */
@media (max-width: 320px) {
    html body.single-post article.single-post,
    html body .content-area > .single-post {
        padding: var(--space-1, 3px);
    }

    html body .single-post .entry-content {
        padding: var(--space-1, 3px);
        font-size: 15px;
        line-height: 1.5;
    }

    html body .single-post .entry-title {
        font-size: 1.3rem;
    }
}

/* ========================================================
   4) HEADER MOBILE-SEARCH-TOGGLE VISIBILITY
   --------------------------------------------------------
   Replaces: style.css:854-899 (768px), 1834-1838 (769px),
             4955-4978 (769px masaüstü gizle)
   Specificity: 4 sınıf > style.css'teki 3 sınıf + !important
   ======================================================== */
@media (min-width: 769px) {
    html body .site-header .header-right .header-top-row .mobile-search-toggle,
    html body .header-top-row .mobile-search-toggle,
    html body header.site-header .mobile-search-toggle,
    html body #mobile-search {
        display: none;
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
        width: 0;
        height: 0;
        padding: 0;
        margin: 0;
    }

    html body .site-header .header-right .menu-toggle {
        display: none;
    }

    html body .site-header .header-right .search-form {
        display: flex;
    }
}

@media (max-width: 768px) {
    html body .site-header .header-right .menu-toggle {
        display: flex;
        visibility: visible;
        opacity: 1;
    }
}

/* ========================================================
   5) WP IMAGE ALIGNMENT (alignleft / alignright)
   --------------------------------------------------------
   Replaces: style.css:5096-5152
   Orijinal: float + width + margin'da yedi adet !important
   Çözüm: daha spesifik selector (article.single-post zinciri)
   ile aynı kuralları !important'sız uygulamak.
   ======================================================== */
html body article.single-post .entry-content img.alignright,
html body article.single-post .entry-content figure.alignright,
html body article.single-post .entry-content figure.wp-block-image.alignright {
    float: right;
    clear: right;
    width: auto;
    max-width: 50%;
    margin: 0 0 var(--space-5, 1.5em) var(--space-5, 1.5em);
    display: block;
}

html body article.single-post .entry-content img.alignleft,
html body article.single-post .entry-content figure.alignleft,
html body article.single-post .entry-content figure.wp-block-image.alignleft {
    float: left;
    clear: left;
    width: auto;
    max-width: 50%;
    margin: 0 var(--space-5, 1.5em) var(--space-5, 1.5em) 0;
    display: block;
}

/* figure içindeki img kendisi tam doldursun */
html body article.single-post .entry-content figure.alignright > img,
html body article.single-post .entry-content figure.alignleft > img,
html body article.single-post .entry-content figure.wp-block-image.alignright > img,
html body article.single-post .entry-content figure.wp-block-image.alignleft > img {
    width: 100%;
    max-width: 100%;
    margin: 0;
    display: block;
}

@media screen and (max-width: 600px) {
    html body article.single-post .entry-content img.alignright,
    html body article.single-post .entry-content img.alignleft,
    html body article.single-post .entry-content figure.alignright,
    html body article.single-post .entry-content figure.alignleft,
    html body article.single-post .entry-content figure.wp-block-image.alignright,
    html body article.single-post .entry-content figure.wp-block-image.alignleft {
        float: none;
        max-width: 100%;
        margin: var(--space-3, 15px) auto;
    }
}

/* ========================================================
   6) SINGLE-PDF ENTRY-CONTENT LINKLER
   --------------------------------------------------------
   Replaces: style.css:3195-3205
   Orijinal: color/text-decoration/font-weight'te !important
   ======================================================== */
html body article.single-pdf .entry-content a,
html body .single-pdf article .entry-content a {
    color: #0066cc;
    text-decoration: underline;
    font-weight: normal;
}

html body article.single-pdf .entry-content a:hover,
html body .single-pdf article .entry-content a:hover {
    color: #004499;
    text-decoration: underline;
}

/* ========================================================
   7) BLOCKQUOTE PARAGRAF MARGIN'LARI
   --------------------------------------------------------
   Replaces: style.css:2700-2710
   ======================================================== */
html body .single-post .entry-content blockquote p {
    margin: 0;
}

html body .single-post .entry-content blockquote p + p {
    margin-top: var(--space-2, 8px);
}

/* ========================================================
   8) FIGCAPTION FONT BOYUTU
   --------------------------------------------------------
   Replaces: style.css:5082-5092
   ======================================================== */
html body .wp-caption .wp-caption-text,
html body .gallery-caption,
html body .entry-content figcaption {
    font-size: 0.85em;
    line-height: 1.4;
    margin-top: var(--space-1, 5px);
    color: #666;
    text-align: center;
    font-style: italic;
}

/* ========================================================
   9) PRINT — sidebar/header gizle
   Replaces: style.css:4173-4181
   ======================================================== */
@media print {
    html body .site-header,
    html body .sidebar,
    html body .social-share,
    html body .related-posts,
    html body .contact-modal {
        display: none;
    }
}

/* ========================================================
   10) DESKTOP DROPDOWN MENÜ — focus-within ve hover
   Replaces: style.css:337-342
   ======================================================== */
html body .desktop-menu li:hover > ul,
html body .desktop-menu li:focus-within > ul {
    display: block;
    max-height: none;
    overflow: visible;
}

/* ===============================================================
   MIGRATION GUIDE — Uzun vadeli temizlik adımları
   ===============================================================
   Bu dosya geçici bir köprü; nihai hedef style.css'i sadeleştirmek.
   Adımlar (her birini ayrı PR olarak yapın):

   1) DOĞRULAMA
      - cleanup.css'i style.css'ten SONRA enqueue edin (functions.php
        içindeki wp_enqueue_style sırasına dikkat).
      - Tüm sayfa tiplerini kontrol edin:
        anasayfa, single-post (resim alignleft/right'lı), single-pdf,
        single-kitap, archive, search, 404, print preview.

   2) STYLE.CSS'TEN !IMPORTANT KALDIRMA (kademeli)
      a. style.css:3696-3970 (550px bloğu): cleanup.css'in mobile bloğu
         devraldı. !important'ları silebilirsiniz.
      b. style.css:3972-4019 (480px) ve 4022-4158 (320px): aynı şekilde.
      c. style.css:4999-5025 (mobile genişlik eşitleme): tamamen
         silinebilir, cleanup.css karşılıyor.
      d. style.css:5096-5152 (image alignment): selector'ları korunarak
         !important'lar silinebilir; cleanup.css yedek.
      e. style.css:3195-3205 (single-pdf linkler): !important'lar
         silinebilir.

   3) MOBILE BLOKLARI KONSOLIDE ET (style.css'te)
      Mevcut style.css'te 5 ayrı `@media (max-width: 768px)` bloğu var
      (satır 310, 538, 848, 1841, 3696-3970'in alt-blokları, 4999).
      Hepsini tek bir bloğa toplayın. Sıra:
        max-width:1024 → 768 → 600 → 550 → 480 → 320 → 768 landscape
      Mobile-first dönüşüm (min-width) daha modern olurdu ama riskli.

   4) :ROOT BLOĞU
      style.css:10-18 satırlarındaki :root, tokens.css'i ezmesin diye
      ya silinmeli ya da tokens.css'ten SONRA değil ÖNCE yüklenmeli.
      Şu an style.css daha sonra yüklendiği için tokens.css'in eski
      isimler için verdiği alias'lar style.css tarafından üzerine
      yazılıyor; bu da geriye dönük uyumluluk açısından şu an sorun
      değil ama uzun vadede :root'un sadece tokens.css'te olması ideal.

   5) GLOBAL `*` RESET (style.css:21-25)
      Modern modern-base.css zaten box-sizing veriyor. style.css'teki
      * reset kaldırılabilir, ama önce bağımlılıkları doğrulayın.

   6) BU DOSYAYI TASFİYE ET
      Tüm yukarıdaki adımlar tamamlanınca cleanup.css'in çoğu satırı
      gereksizleşir. O zaman cleanup.css silinip ilgili kurallar
      style.css'e (veya component-bazlı dosyalara) taşınır.
   =============================================================== */
