/*
Theme Name: Deeoiman
Theme URI: https://deeoiman.com
Author: Deeoiman Team
Author URI: https://deeoiman.com
Description: A world-class, feature-packed, ultra-customizable Islamic WordPress theme for Quran, Hadith, and Dua blogs. Features Hijri Date & Prayer Times top bar, Audio Recitations, WhatsApp/Telegram Share, Reading Progress Bar, Related Posts, and Rich SEO Schema.
Version: 1.5.3
Requires at least: 5.9
Tested up to: 6.6
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: deeoiman
Tags: islamic, quran, hadith, dua, blog, two-columns, custom-menu, featured-images, rtl-language-support, dark-mode, responsive-layout, custom-colors, widgets, theme-options, grid-layout, seo-friendly
*/

/* ==========================================================================
   1. Design System & CSS Variables
   ========================================================================== */
:root {
    /* Color Palette */
    --color-primary: #0F382C;
    --color-primary-light: #185242;
    --color-primary-dark: #09241B;
    --color-accent: #D4AF37;
    --color-accent-hover: #B8952B;
    --color-accent-light: #F9F3DE;
    
    --color-bg: #FAF8F5;
    --color-surface: #FFFFFF;
    --color-surface-elevated: #FFFFFF;
    --color-border: #E8E2D5;
    
    --color-text-main: #1C2826;
    --color-text-muted: #5A6B66;
    --color-text-light: #879994;
    
    /* Category Colors */
    --cat-quran-bg: #E8F5E9;
    --cat-quran-color: #1B5E20;
    --cat-hadith-bg: #E3F2FD;
    --cat-hadith-color: #0D47A1;
    --cat-dua-bg: #FFF8E1;
    --cat-dua-color: #F57F17;
    --cat-default-bg: #EFEBE9;
    --cat-default-color: #4E342E;

    /* Dynamic Customizer Defaults */
    --logo-max-width: 220px;
    --logo-max-height: 60px;
    --card-image-height: 220px;
    --single-featured-height: 380px;
    --container-max-width: 1240px;

    /* Typography */
    --font-latin: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-arabic: 'Amiri', 'Noto Naskh Arabic', 'Traditional Arabic', serif;
    
    /* Reader Font Size Scale */
    --content-font-size: 1.125rem;
    --arabic-font-size: 1.75rem;
    
    /* Effects & Shadows */
    --shadow-sm: 0 2px 8px rgba(15, 56, 44, 0.05);
    --shadow-md: 0 4px 20px rgba(15, 56, 44, 0.08);
    --shadow-lg: 0 12px 32px rgba(15, 56, 44, 0.12);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Overrides */
body.dark-mode {
    --color-bg: #091210;
    --color-surface: #121F1B;
    --color-surface-elevated: #1A2C27;
    --color-border: #233832;
    
    --color-text-main: #E9F1EE;
    --color-text-muted: #9EB2AB;
    --color-text-light: #6E857E;
    
    --color-accent-light: #2A2410;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
    
    --cat-quran-bg: #1B382B;
    --cat-quran-color: #81C784;
    --cat-hadith-bg: #1A2F4C;
    --cat-hadith-color: #64B5F6;
    --cat-dua-bg: #3E2D12;
    --cat-dua-color: #FFB74D;
}

/* ==========================================================================
   2. Reset & Base Styles
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-family: var(--font-latin);
    background-color: var(--color-bg);
    color: var(--color-text-main);
    line-height: 1.6;
    scroll-behavior: smooth;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text-main);
    transition: background-color var(--transition-normal), color var(--transition-normal);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--color-primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

body.dark-mode a {
    color: var(--color-accent);
}

a:hover {
    color: var(--color-accent);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Scroll Reading Progress Bar */
#reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-accent) 0%, #FFF5C0 100%);
    width: 0%;
    z-index: 2000;
    transition: width 0.1s ease-out;
}

/* Back to Top Button */
.back-to-top-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-primary);
    color: var(--color-accent);
    border: 2px solid var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast), background-color var(--transition-fast);
    z-index: 1500;
}

.back-to-top-btn.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top-btn:hover {
    background: var(--color-primary-light);
    transform: translateY(-3px);
}

@media (max-width: 600px) {
    .back-to-top-btn {
        bottom: 18px;
        right: 18px;
        width: 42px;
        height: 42px;
        font-size: 1rem;
    }
}

/* ==========================================================================
   3. Top Bar (Hijri Calendar & Prayer Times)
   ========================================================================== */
.top-bar {
    background-color: var(--color-primary-dark);
    color: #D1E0DA;
    font-size: 0.85rem;
    padding: 8px 0;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
}

.top-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.top-bar-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.hijri-badge {
    color: var(--color-accent);
    font-weight: 700;
}

.prayer-times-inline {
    display: flex;
    gap: 16px;
}

.prayer-time-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.prayer-time-chip strong {
    color: #FFFFFF;
}

@media (max-width: 768px) {
    .top-bar-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 6px;
    }
    .prayer-times-inline {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px 12px;
        font-size: 0.8rem;
    }
}

/* ==========================================================================
   4. Container & Layout
   ========================================================================== */
.container {
    width: 100%;
    max-width: var(--container-max-width, 1200px);
    margin: 0 auto;
    padding: 0 20px;
}

.container-narrow {
    max-width: 860px;
}

.site-main {
    flex: 1;
    padding: 40px 0 80px 0;
}

.layout-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
}

@media (min-width: 992px) {
    .layout-grid.has-sidebar {
        grid-template-columns: 1fr 340px;
    }

    body.sidebar-left .layout-grid.has-sidebar {
        grid-template-columns: 340px 1fr;
    }

    body.sidebar-left .layout-grid.has-sidebar .content-area {
        order: 2;
    }

    body.sidebar-left .layout-grid.has-sidebar .widget-area {
        order: 1;
    }
}

/* ==========================================================================
   5. Header & Navigation
   ========================================================================== */
.site-header {
    background-color: var(--color-surface-elevated);
    border-bottom: 1px solid var(--color-border);
    position: static;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

body.has-sticky-header .site-header {
    position: sticky;
    top: 0;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 80px;
    padding: 10px 0;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.custom-logo-link img {
    max-width: var(--logo-max-width) !important;
    max-height: var(--logo-max-height) !important;
    width: auto;
    height: auto;
    object-fit: contain;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    color: var(--color-accent);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    border: 1px solid var(--color-accent);
    box-shadow: var(--shadow-sm);
}

.brand-text-wrapper {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-primary);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

body.dark-mode .brand-title {
    color: var(--color-text-main);
}

.brand-tagline {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Navigation Links */
.main-nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 20px;
    align-items: center;
}

.nav-link {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-main);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.nav-link:hover, .nav-link.active {
    background-color: var(--color-bg);
    color: var(--color-primary);
}

body.dark-mode .nav-link:hover {
    color: var(--color-accent);
}

/* Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-btn {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all var(--transition-fast);
    position: relative;
}

.action-btn:hover {
    background-color: var(--color-primary);
    color: var(--color-accent);
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

.mobile-menu-toggle {
    display: none;
}

@media (max-width: 868px) {
    .main-nav {
        display: none;
        position: absolute;
        top: 80px;
        left: 0;
        right: 0;
        background: var(--color-surface);
        border-bottom: 1px solid var(--color-border);
        padding: 20px;
        box-shadow: var(--shadow-lg);
    }
    
    .main-nav.is-open {
        display: block;
    }
    
    .nav-list {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
}

/* Bismillah Header */
.bismillah-banner {
    text-align: center;
    padding: 24px 0 8px 0;
}

.bismillah-text {
    font-family: var(--font-arabic);
    font-size: 2.2rem;
    color: var(--color-primary);
    direction: rtl;
    line-height: 1.4;
}

body.dark-mode .bismillah-text {
    color: var(--color-accent);
}

/* ==========================================================================
   6. Hero Banner & Post Cards
   ========================================================================== */
.hero-section {
    background: linear-gradient(135deg, var(--color-primary) 0%, #154D3D 100%);
    border-radius: var(--radius-lg);
    padding: 40px;
    color: #FFFFFF;
    margin-bottom: 40px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--color-accent-light);
    border: 1px solid var(--color-accent);
    color: var(--color-primary);
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
}

body.dark-mode .hero-badge {
    color: var(--color-accent);
}

.hero-title {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 16px;
    color: #FFFFFF;
}

.hero-description {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.85);
    max-width: 650px;
    margin-bottom: 24px;
}

.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 28px;
}

.post-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-accent);
}

.card-image-wrap {
    position: relative;
    width: 100%;
    height: var(--card-image-height);
    overflow: hidden;
    background: var(--color-bg);
}

.card-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

.post-card:hover .card-image-wrap img {
    transform: scale(1.04);
}

.card-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 0.85rem;
}

.category-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.category-badge.cat-quran {
    background-color: var(--cat-quran-bg);
    color: var(--cat-quran-color);
}

.category-badge.cat-hadith {
    background-color: var(--cat-hadith-bg);
    color: var(--cat-hadith-color);
}

.category-badge.cat-dua {
    background-color: var(--cat-dua-bg);
    color: var(--cat-dua-color);
}

.category-badge.cat-default {
    background-color: var(--cat-default-bg);
    color: var(--cat-default-color);
}

.post-date {
    color: var(--color-text-muted);
}

.card-title {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 12px;
    color: var(--color-text-main);
}

.card-title a {
    color: inherit;
}

.card-title a:hover {
    color: var(--color-primary-light);
}

body.dark-mode .card-title a:hover {
    color: var(--color-accent);
}

.card-excerpt {
    font-size: 0.95rem;
    color: var(--color-text-muted);
    margin-bottom: 20px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
    font-size: 0.85rem;
    color: var(--color-text-light);
}

/* ==========================================================================
   7. Islamic Boxes with Audio & Action Buttons
   ========================================================================== */
.quran-box {
    background: linear-gradient(to bottom, var(--color-surface), var(--color-bg));
    border: 2px solid var(--color-accent);
    border-radius: var(--radius-md);
    padding: 30px;
    margin: 30px 0;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.quran-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--color-border);
}

.surah-tag {
    background: var(--color-primary);
    color: var(--color-accent);
    padding: 4px 14px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
}

.arabic-text {
    font-family: var(--font-arabic);
    font-size: var(--arabic-font-size);
    line-height: 2.2;
    text-align: right;
    direction: rtl;
    color: var(--color-primary);
    margin-bottom: 20px;
}

body.dark-mode .arabic-text {
    color: #E2F0EC;
}

.translation-text {
    font-size: var(--content-font-size);
    color: var(--color-text-main);
    font-style: italic;
    line-height: 1.7;
    margin-bottom: 16px;
}

.dua-card-box {
    background-color: var(--color-surface);
    border-left: 5px solid var(--color-accent);
    border-radius: var(--radius-sm);
    padding: 24px;
    margin: 28px 0;
    box-shadow: var(--shadow-sm);
}

.dua-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

body.dark-mode .dua-title {
    color: var(--color-accent);
}

.transliteration {
    font-size: 1rem;
    color: var(--color-text-muted);
    margin-bottom: 12px;
    font-weight: 500;
}

/* Action Bar with Audio and Copy */
.content-box-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-top: 16px;
}

.btn-action {
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text-main);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
}

.btn-action:hover {
    background-color: var(--color-primary);
    color: var(--color-accent);
    border-color: var(--color-primary);
}


/* Share Buttons (WhatsApp & Telegram) */
.share-btn-wa {
    background-color: #25D366;
    color: #FFFFFF !important;
    border: none;
}
.share-btn-wa:hover {
    background-color: #1EBE5D;
}

.share-btn-tg {
    background-color: #229ED9;
    color: #FFFFFF !important;
    border: none;
}
.share-btn-tg:hover {
    background-color: #1A8CBF;
}

/* ==========================================================================
   9. Widgets & Related Posts
   ========================================================================== */
.widget-area .widget {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 28px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

.widget-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--color-accent);
}

body.dark-mode .widget-title {
    color: var(--color-text-main);
}

.widget ul {
    list-style: none;
}

.widget ul li {
    padding: 10px 0;
    border-bottom: 1px dashed var(--color-border);
    font-size: 0.95rem;
}

/* Related Posts Section */
.related-posts-section {
    margin-top: 50px;
    padding-top: 40px;
    border-top: 2px solid var(--color-border);
}

.related-section-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-primary);
    margin-bottom: 24px;
}

body.dark-mode .related-section-title {
    color: var(--color-accent);
}

/* ==========================================================================
   10. Footer & Toast
   ========================================================================== */
.site-footer {
    background-color: var(--color-primary-dark);
    color: #E9F1EE;
    padding: 60px 0 30px 0;
    border-top: 3px solid var(--color-accent);
    margin-top: auto;
}

.footer-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-brand .brand-title {
    color: #FFFFFF;
}

.footer-brand .brand-tagline {
    color: var(--color-accent);
}

.footer-heading {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-accent);
    margin-bottom: 18px;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: #C2D6CF;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--color-accent);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #8CA89E;
}

.toast-notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--color-primary);
    color: var(--color-accent);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-accent);
    box-shadow: var(--shadow-lg);
    font-weight: 600;
    transform: translateY(100px);
    opacity: 0;
    transition: all var(--transition-normal);
    z-index: 4000;
}

.toast-notification.show {
    transform: translateY(0);
    opacity: 1;
}

/* ==========================================================================
   11. Article Content Typography
   ========================================================================== */
.entry-content {
    font-size: var(--content-font-size);
    color: var(--color-text-main);
    line-height: 1.8;
}

.entry-content > * + * {
    margin-top: 1.2em;
}

.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6 {
    font-weight: 800;
    color: var(--color-primary);
    line-height: 1.3;
    margin-top: 1.6em;
}

body.dark-mode .entry-content h1,
body.dark-mode .entry-content h2,
body.dark-mode .entry-content h3,
body.dark-mode .entry-content h4,
body.dark-mode .entry-content h5,
body.dark-mode .entry-content h6 {
    color: var(--color-text-main);
}

.entry-content h2 { font-size: 1.65rem; }
.entry-content h3 { font-size: 1.4rem; }
.entry-content h4 { font-size: 1.2rem; }

.entry-content p {
    margin-bottom: 0;
}

.entry-content a {
    text-decoration: underline;
    text-decoration-color: var(--color-accent);
    text-underline-offset: 2px;
}

.entry-content ul,
.entry-content ol {
    padding-left: 1.5em;
}

.entry-content li + li {
    margin-top: 0.4em;
}

.entry-content blockquote {
    background: var(--color-accent-light);
    border-left: 4px solid var(--color-accent);
    border-radius: var(--radius-sm);
    padding: 18px 24px;
    font-style: italic;
    color: var(--color-text-main);
}

.entry-content img {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.entry-content figcaption {
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 8px;
}

.entry-content table {
    width: 100%;
    border-collapse: collapse;
}

.entry-content table th,
.entry-content table td {
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    text-align: left;
}

.entry-content table th {
    background: var(--color-bg);
    color: var(--color-primary);
}

.entry-content hr {
    border: none;
    border-top: 1px dashed var(--color-border);
}

.entry-content .page-links {
    margin-top: 2em;
    font-weight: 700;
}

.entry-content .page-links a {
    display: inline-block;
    padding: 4px 12px;
    margin: 0 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    text-decoration: none;
}

/* ==========================================================================
   12. Search Form
   ========================================================================== */
.search-form {
    display: flex;
    gap: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--color-bg);
}

.search-form .search-field {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 16px;
    font-size: 0.95rem;
    color: var(--color-text-main);
    outline: none;
    font-family: var(--font-latin);
}

.search-form .search-field::placeholder {
    color: var(--color-text-light);
}

.search-form button[type="submit"] {
    border: none;
    background: var(--color-primary);
    color: var(--color-accent);
    padding: 0 20px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color var(--transition-fast);
}

.search-form button[type="submit"]:hover {
    background: var(--color-primary-light);
}

/* ==========================================================================
   13. Social Links & Tag Cloud
   ========================================================================== */
.social-links {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.social-link {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--color-accent);
    color: var(--color-accent) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.social-link:hover {
    background: var(--color-accent);
    color: var(--color-primary-dark) !important;
    transform: translateY(-2px);
}

.tagcloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tagcloud a {
    display: inline-block;
    padding: 5px 14px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 50px;
    font-size: 0.8rem !important;
    color: var(--color-text-main);
    transition: all var(--transition-fast);
}

.tagcloud a:hover {
    background: var(--color-primary);
    color: var(--color-accent);
    border-color: var(--color-primary);
}

/* ==========================================================================
   14. Pagination
   ========================================================================== */
.pagination,
.nav-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-main);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.page-numbers.current {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-accent);
}

.page-numbers:hover:not(.current):not(.dots) {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-primary-dark);
}

.page-numbers.dots {
    border: none;
    background: transparent;
}

/* ==========================================================================
   15. Comments
   ========================================================================== */
.comments-area {
    margin-top: 50px;
    padding-top: 40px;
    border-top: 2px solid var(--color-border);
}

.comments-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--color-primary);
    margin-bottom: 24px;
}

body.dark-mode .comments-title {
    color: var(--color-accent);
}

.comment-list {
    list-style: none;
}

.comment-list .children {
    list-style: none;
    padding-left: 40px;
}

.comment-body {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
}

.comment-author.vcard {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.comment-author .avatar {
    border-radius: 50%;
    width: 40px;
    height: 40px;
}

.comment-author .fn {
    font-style: normal;
    font-weight: 700;
    color: var(--color-primary);
}

body.dark-mode .comment-author .fn {
    color: var(--color-text-main);
}

.comment-metadata {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-bottom: 10px;
}

.comment-metadata a {
    color: inherit;
}

.comment-content p {
    margin-bottom: 0.8em;
    color: var(--color-text-main);
    line-height: 1.7;
}

.comment-reply-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-primary-light);
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    color: var(--color-text-main);
    font-family: var(--font-latin);
    font-size: 0.95rem;
    margin-top: 6px;
}

.comment-form label {
    font-weight: 600;
    font-size: 0.9rem;
}

.comment-form p {
    margin-bottom: 18px;
}

.comment-form .form-submit input#submit {
    background: var(--color-primary);
    color: var(--color-accent);
    border: none;
    padding: 12px 28px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.comment-form .form-submit input#submit:hover {
    background: var(--color-primary-light);
}

.no-comments {
    color: var(--color-text-muted);
    font-style: italic;
}


/* ========================================================================
   Mobile-first performance & usability overrides
   Optimized for phones and narrow touch screens.
   ======================================================================== */
html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
}

/* Avoid expensive hover movement on touch devices. */
@media (hover: none) {
    .post-card:hover,
    .back-to-top-btn:hover,
    .action-btn:hover,
    .social-link:hover,
    .tagcloud a:hover {
        transform: none;
    }

    .post-card:hover .card-image-wrap img {
        transform: none;
    }
}

@media (max-width: 868px) {
    body:not(.has-sticky-header) .site-header {
        position: relative;
    }

    .site-header {
        z-index: 1000;
    }

    .main-nav {
        top: 100%;
    }

    body.mobile-nav-open {
        overflow: hidden;
    }

    .container {
        padding-left: 14px;
        padding-right: 14px;
    }

    /* Keep the top bar useful without consuming most of the first screen. */
    .top-bar {
        padding: 6px 0;
        font-size: 0.78rem;
    }

    .top-bar-inner {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 5px;
    }

    .top-bar-item {
        justify-content: center;
        min-height: 24px;
    }

    .prayer-times-inline {
        width: 100%;
        display: flex;
        flex-wrap: nowrap;
        justify-content: flex-start;
        align-items: center;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 8px;
        padding: 2px 2px 5px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        white-space: nowrap;
    }

    .prayer-times-inline::-webkit-scrollbar {
        display: none;
    }

    .prayer-times-inline > span:first-child {
        flex: 0 0 auto;
    }

    .prayer-time-chip {
        flex: 0 0 auto;
        padding: 4px 7px;
        border: 1px solid rgba(212, 175, 55, 0.22);
        border-radius: 6px;
    }

    /* Compact header; more content remains visible above the fold. */
    .header-inner {
        min-height: 64px;
        padding: 7px 0;
        gap: 8px;
    }

    .site-brand {
        min-width: 0;
        flex: 1 1 auto;
        gap: 8px;
    }

    .custom-logo-link img {
        max-width: min(var(--logo-max-width), 150px) !important;
        max-height: 48px !important;
    }

    .brand-icon {
        width: 40px;
        height: 40px;
        font-size: 19px;
        flex: 0 0 40px;
    }

    .brand-text-wrapper {
        min-width: 0;
    }

    .brand-title {
        font-size: 1.15rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .brand-tagline {
        display: none;
    }

    .header-actions {
        flex: 0 0 auto;
        gap: 6px;
    }

    .action-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    .main-nav {
        top: 100%;
        padding: 8px 14px 14px;
        max-height: calc(100dvh - 64px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .nav-list {
        gap: 4px;
    }

    .nav-link {
        display: flex;
        align-items: center;
        min-height: 46px;
        padding: 11px 12px;
        font-size: 1rem;
    }

    .bismillah-banner {
        padding: 14px 0 4px;
    }

    .bismillah-text {
        font-size: clamp(1.45rem, 7vw, 1.8rem);
        line-height: 1.45;
    }

    .site-main {
        padding: 24px 0 50px;
    }

    /* One predictable column on phones; prevents narrow/overflowing cards. */
    .post-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }

    .post-card {
        min-width: 0;
        content-visibility: auto;
        contain-intrinsic-size: 420px;
    }

    .card-image-wrap {
        height: clamp(155px, 48vw, 200px);
    }

    .card-content {
        padding: 18px;
    }

    .card-title {
        font-size: 1.18rem;
        line-height: 1.4;
    }

    .card-excerpt {
        font-size: 0.95rem;
        margin-bottom: 16px;
    }

    .card-footer {
        gap: 10px;
        flex-wrap: wrap;
    }

    .hero-section {
        padding: 24px 18px;
        margin-bottom: 24px;
        border-radius: 14px;
    }

    .hero-title {
        font-size: clamp(1.55rem, 7vw, 2rem);
        line-height: 1.25;
    }

    .hero-description {
        font-size: 1rem;
        line-height: 1.65;
        margin-bottom: 18px;
    }

    /* Quran/Dua content is the core mobile reading experience. */
    .quran-box {
        padding: 18px 14px;
        margin: 20px 0;
        border-width: 1px;
    }

    .quran-header {
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 16px;
    }

    .surah-tag {
        font-size: 0.8rem;
        padding: 5px 11px;
    }

    .arabic-text {
        font-size: clamp(1.4rem, 7vw, 1.65rem);
        line-height: 2.05;
        margin-bottom: 16px;
        overflow-wrap: anywhere;
    }

    .translation-text {
        font-size: 1rem;
        line-height: 1.7;
    }

    .dua-card-box {
        padding: 18px 16px;
        margin: 20px 0;
    }

    .dua-title {
        font-size: 1.05rem;
    }

    .transliteration {
        font-size: 0.98rem;
        line-height: 1.65;
    }

    .content-box-actions {
        justify-content: flex-start;
        gap: 8px;
    }

    .btn-action {
        min-height: 44px;
        padding: 9px 12px;
        font-size: 0.86rem;
    }

    /* Prevent Quran/blog images and tables from creating horizontal scrolling. */
    .entry-content {
        font-size: 1.05rem;
        line-height: 1.8;
        overflow-wrap: break-word;
    }

    .entry-content img {
        width: auto;
        max-width: 100%;
        height: auto;
        margin-left: auto;
        margin-right: auto;
    }

    .entry-content figure {
        max-width: 100%;
    }

    .entry-content table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .entry-content blockquote {
        padding: 14px 16px;
    }

    .entry-content h2 { font-size: 1.4rem; }
    .entry-content h3 { font-size: 1.25rem; }
    .entry-content h4 { font-size: 1.1rem; }

    .search-form .search-field {
        min-width: 0;
        font-size: 16px; /* Prevent iOS Safari auto-zoom on focus. */
    }

    .search-form button[type="submit"] {
        min-width: 48px;
        min-height: 46px;
        padding: 0 15px;
    }

    .widget-area .widget {
        padding: 20px;
        margin-bottom: 20px;
    }

    .related-posts-section {
        margin-top: 32px;
        padding-top: 28px;
    }

    .related-section-title {
        font-size: 1.3rem;
        margin-bottom: 18px;
    }

    .footer-inner {
        grid-template-columns: 1fr;
        gap: 28px;
        margin-bottom: 28px;
    }

    .site-footer {
        padding: 40px 0 24px;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        text-align: left;
    }

    .social-link {
        width: 44px;
        height: 44px;
    }

    .toast-notification {
        left: 14px;
        right: 14px;
        bottom: calc(14px + env(safe-area-inset-bottom));
        text-align: center;
        padding: 12px 16px;
    }

    .back-to-top-btn {
        bottom: calc(16px + env(safe-area-inset-bottom));
        right: 14px;
    }
}

@media (max-width: 380px) {
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .brand-title {
        font-size: 1.05rem;
    }

    .action-btn {
        width: 42px;
        min-width: 42px;
        height: 42px;
        min-height: 42px;
    }

    .quran-box {
        padding: 15px 12px;
    }

    .content-box-actions .btn-action {
        flex: 1 1 auto;
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
