/* ===== Parish News Specific Styles ===== */

/* --- Summary Stats (Dynamic Banner) --- */
.summary-stats-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    max-width: 900px;
    margin: 0 auto;
}

.stat-pill {
    background: var(--panel);
    border: 1px solid var(--line);
    padding: 10px 22px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px -5px rgba(18, 11, 34, 0.05);
}

.stat-pill .num {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--violet); /* Deep purple to match theme */
}

.stat-pill .lbl {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Make summary look great on mobile phones */
@media (max-width: 600px) {
    .summary-stats-container { gap: 10px; }
    .stat-pill {
        padding: 12px 8px;
        width: calc(50% - 5px); /* Forces 2x2 grid */
        justify-content: center;
        border-radius: 16px;
        flex-direction: column;
        gap: 2px;
    }
    .stat-pill .num { font-size: 18px; line-height: 1.1; }
    .stat-pill .lbl { font-size: 11px; text-align: center; }
}

/* --- Year Selector Carousel Container --- */
.year-carousel-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    max-width: 100%;
    margin: 0 auto;
}

.year-selector-container {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 8px 4px; /* Room for button shadow */
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
    
    /* Restrict width to force scrolling on all devices */
    max-width: calc(100vw - 120px); 
}

/* Tablet/Desktop width restriction */
@media (min-width: 768px) {
    .year-selector-container { max-width: 500px; }
}

/* Hide scrollbar for Chrome/Safari */
.year-selector-container::-webkit-scrollbar {
    display: none;
}

/* Prevent year buttons from wrapping or shrinking */
.year-selector-container .year-btn {
    flex-shrink: 0;
}

/* --- Carousel Arrow Buttons --- */
.year-nav-btn {
    background: #ffffff;
    border: 1px solid var(--line);
    color: var(--ink);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(18, 11, 34, 0.04);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.year-nav-btn:hover {
    background: var(--line);
    transform: scale(1.05);
}

.year-nav-btn:active {
    transform: scale(0.95);
}

/* --- 1. Year Selector Buttons (Matches gallery.css perfectly) --- */
.year-btn {
    border: none;
    background: transparent;
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-family: 'Space Grotesk', sans-serif; 
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    outline: none;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    color: inherit;
    transition: all 0.3s ease;
}

.year-btn:hover {
    background: rgba(0,0,0,0.1);
}

.year-btn.active {
    background: var(--primary-color, #0056b3); 
    color: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

/* --- News Flex Grid (4 per row, centered) --- */
.news-flex-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 22px;
    max-width: var(--wrap-max);
    margin: 0 auto;
}

.news-flex-grid .lead-card {
    flex: 0 1 calc(25% - 16.5px);
    min-width: 240px; 
    display: flex;
    flex-direction: column;
}

.news-flex-grid .lead-card .body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 24px;
}

/* --- Button Container Fix --- */
.news-card-actions {
    display: flex;
    gap: 12px;
    margin-top: auto; 
    padding-top: 18px;
    flex-wrap: wrap;
    align-items: center;
}

/* --- Force <button> to match <a> tag styles perfectly --- */
button.nav-cta {
    border: none !important; /* Strips the default black browser border */
    outline: none !important;
    font-family: inherit !important; /* Inherits Plus Jakarta Sans */
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    flex: 1; /* Makes English and Malayalam buttons equal width */
    padding: 11px 22px !important; /* Enforces exact padding from site.css */
}

/* --- Fullscreen Modal --- */
.pn-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.pn-modal.show {
    opacity: 1;
    visibility: visible;
}

.pn-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(18, 11, 34, 0.85); /* Matches --ink from site.css */
    backdrop-filter: blur(6px);
}

.pn-modal-content {
    position: relative;
    width: 95%;
    max-width: 1200px;
    height: 92vh;
    background: var(--panel);
    border-radius: 22px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.pn-modal.show .pn-modal-content {
    transform: translateY(0);
}

.pn-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
}

.pn-modal-actions {
    display: flex;
    gap: 12px;
}

.pn-modal-body {
    flex: 1;
    width: 100%;
    background: #e9ecef;
}

.pn-modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* --- 2. Tablet & Mobile Modal Responsiveness --- */
@media (max-width: 768px) {
    .pn-modal-content {
        width: 100%;
        height: 100svh;
        border-radius: 0;
    }
    
    .pn-modal-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 12px 16px;
    }

    .pn-modal-header h3 {
        font-size: 16px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 50%; 
    }

    /* Force hide text on mobile */
    .hide-mobile {
        display: none !important;
    }

    /* Convert buttons to perfect circular icons */
    .pn-modal-actions {
        gap: 12px;
    }
    
    .pn-modal-actions a, .pn-modal-actions button {
        padding: 0 !important;
        width: 40px;
        height: 40px;
        border-radius: 50% !important; /* Circle shape */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex: none;
        text-decoration: none;
    }

    /* THE FIX: Force the FontAwesome icons to be visible and correctly colored */
    .pn-modal-actions i {
        display: block !important;
        visibility: visible !important;
        font-size: 18px !important;
        margin: 0 !important;
        opacity: 1 !important;
    }

    /* Highly readable icon colors for the gradient buttons */
    .pn-modal-actions #modalDownloadBtn i,
    .pn-modal-actions #modalExternalBtn i {
        color: var(--violet, #6D28D9) !important; 
    }
    
    /* Highly readable icon color for the close button */
    .pn-modal-actions #modalCloseBtn i {
        color: var(--ink, #120B22) !important; 
    }

    /* THE FIX: Force mobile buttons to stay hidden if JavaScript says so */
    .pn-modal-actions a[style*="display: none"], 
    .pn-modal-actions button[style*="display: none"] {
        display: none !important;
    }   
}


/* --- 3. Mobile Grid Responsiveness (1 Item Per Row) --- */
@media (max-width: 600px) {
    .news-flex-grid {
        gap: 16px; 
    }
    .news-flex-grid .lead-card {
        flex: 0 1 100%; /* FORCES 1 CARD PER ROW */
        width: 100%;
        min-width: 0; 
    }
    .news-flex-grid .lead-card .body {
        padding: 20px 18px; 
    }
    .news-flex-grid .lead-card h4 {
        font-size: 20px !important; 
    }
}