/*
Theme Name: AG Theme 1
Text Domain: ag-theme-1
Description: Custom WordPress theme for the local parish website nova.zupa-krusevo.org.
Author: Vilim Zovko
Version: 1.0.3
*/

/* ==========================================================================
   1. CSS Variables & Design System Token
   ========================================================================== */
:root {
    /* Color Palette */
    --color-primary: #0F1E36;    /* Deep Navy Blue */
    --color-primary-light: #1A3159; 
    --color-secondary: #C5A03A;  /* Gold Accent */
    --color-secondary-hover: #DAB95B;
    
    --color-bg-main: #FFFFFF;    /* Pure White */
    --color-bg-alt: #F7F7F5;     /* Pearl / Alabaster background for sections */
    --color-text-main: #2D3748;  /* Charcoal for readability */
    --color-text-muted: #718096;
    
    --color-border: #E2E8F0;

    /* Typography */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Outfit', sans-serif;
    
    /* Spacing & Layout */
    --container-max: 1200px;
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 4rem;
    --space-xl: 6rem;
    
    /* Transitions & Shadows */
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.3s ease-in-out;
    --shadow-sm: 0 2px 4px rgba(15, 30, 54, 0.05);
    --shadow-md: 0 4px 12px rgba(15, 30, 54, 0.08);
    --shadow-lg: 0 10px 25px rgba(15, 30, 54, 0.12);
    --border-radius: 8px;
}

/* ==========================================================================
   THEME SWITCHER OVERRIDES
   ========================================================================== */
[data-theme="burgundy"] {
    --color-primary: #4A0E17;
    --color-primary-light: #5E121D;
    --color-secondary: #D4AF37;
    --color-secondary-hover: #E3C153;
}

[data-theme="marian"] {
    --color-primary: #1E4E79; 
    --color-primary-light: #2A6CA6;
    --color-secondary: #F4A460;
    --color-secondary-hover: #F8B478;
}

[data-theme="dark"] {
    --color-primary: #1a1a1a;
    --color-primary-light: #2a2a2a;
    --color-secondary: #D4AF37;
    --color-bg-main: #1e1e1e;
    --color-bg-alt: #121212;
    --color-text-main: #E2E8F0;
    --color-text-muted: #A0AEC0;
    --color-border: #333333;
}

/* ==========================================================================
   2. Reset & Typography Base
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--color-text-main);
    background-color: var(--color-bg-main);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--color-primary);
    margin-top: 0;
    margin-bottom: var(--space-sm);
    font-weight: 600;
    line-height: 1.2;
}

h1 { font-size: 3rem; }
h2 { font-size: 2.25rem; }
h3 { font-size: 1.75rem; }

p {
    margin-top: 0;
    margin-bottom: var(--space-sm);
}

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

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

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

/* ==========================================================================
   3. Layout Utilities
   ========================================================================== */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-sm);
}

.section {
    padding: var(--space-lg) 0;
}

.section--alt {
    background-color: var(--color-bg-alt);
}

/* ==========================================================================
   4. Components
   ========================================================================== */

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-body);
    font-weight: 500;
    text-align: center;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
}

.btn--primary {
    background-color: var(--color-primary);
    color: #fff;
}
.btn--primary:hover {
    background-color: var(--color-primary-light);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn--gold {
    background-color: var(--color-secondary);
    color: var(--color-primary);
}
.btn--gold:hover {
    background-color: var(--color-secondary-hover);
    color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Cards (for news, bulletins, mass times) */
.card {
    background-color: var(--color-bg-main);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: var(--space-md);
    transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
    border: 1px solid var(--color-border);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card--glass {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Masonry Grid (CSS Grid implementation for varying heights if needed, or simple grid) */
.masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-md);
    align-items: start;
}

/* ==========================================================================
   5. Site Header Minimal Setup
   ========================================================================== */
.site-header {
    background-color: var(--color-primary);
    color: #fff;
    padding: var(--space-sm) 0;
}

.site-header a {
    color: #fff;
}

.site-header a:hover {
    color: var(--color-secondary);
}

.site-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 1.5rem; /* Better distance between logo and text */
}

.site-branding-text {
    display: flex;
    flex-direction: column;
}

.site-branding .site-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    margin: 0;
}

.site-description {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.8);
    margin: 0;
}

/* Custom Logo Constraints */
.site-branding .custom-logo {
    max-height: 70px;
    width: auto;
    display: block;
}

/* Primary Navigation Minimal Default */
.main-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: var(--space-sm);
}

.main-navigation a {
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   6. Gutenberg Block Overrides (Full Control Strategy)
   ========================================================================== */
   
/* Strip all legacy background colors and images from single posts/pages */
.content-area .has-background,
.content-area .wp-block-group,
.content-area .wp-block-cover {
    background-image: none !important;
    background-color: transparent !important;
}

/* Ensure text is visible in case previous theme used white text on dark bg */
.content-area .has-text-color {
    color: inherit !important;
}

/* Reset cover block overlays */
.content-area .wp-block-cover__background,
.content-area .wp-block-cover__inner-container {
    background: transparent !important;
    color: var(--color-text-main) !important;
}

/* Add some clean default spacing for blocks */
.content-area > * {
    margin-bottom: 1.5rem;
}

/* ==========================================================================
   7. Responsive Navigation (Mobile Menu)
   ========================================================================== */

/* Hide the hamburger button on desktop */
@media screen and (min-width: 768px) {
    .menu-toggle {
        display: none;
    }
}

/* Mobile menu styling and toggling */
@media screen and (max-width: 767px) {
    .site-header-inner {
        flex-wrap: wrap;
    }
    
    .menu-toggle {
        display: block;
        background: transparent;
        color: #fff;
        border: 1px solid rgba(255,255,255,0.5);
        padding: 0.5rem 1rem;
        cursor: pointer;
        border-radius: var(--border-radius);
    }
    
    .main-navigation ul {
        display: none; /* Hidden by default on mobile */
        flex-direction: column;
        width: 100%;
        margin-top: 1rem;
        list-style: none;
        padding: 0;
    }
    
    /* Shown when JS adds the toggled class */
    .main-navigation ul.toggled {
        display: flex;
    }
    
    .main-navigation a {
        padding: 0.5rem 0;
        display: block;
    }

    /* Sub-menu on mobile (permanently visible when menu is open) */
    .main-navigation .sub-menu {
        display: flex;
        flex-direction: column;
        padding-left: 1rem;
        background-color: rgba(0, 0, 0, 0.1);
        width: 100%;
    }
}

/* ==========================================================================
   7.1 Dropdown Menus (Desktop)
   ========================================================================== */
@media screen and (min-width: 768px) {
    .main-navigation ul {
        display: flex;
        gap: var(--space-md);
        list-style: none;
        margin: 0;
        padding: 0;
    }
    
    .main-navigation li {
        position: relative;
    }
    
    /* Hide sub-menu by default */
    .main-navigation .sub-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        background-color: var(--color-primary);
        min-width: 220px;
        z-index: 99999;
        box-shadow: 0 8px 16px rgba(0,0,0,0.2);
        padding: 0.5rem 0;
        border-radius: 4px;
    }
    
    /* Show sub-menu on hover */
    .main-navigation li:hover > .sub-menu {
        display: block;
    }
    
    .main-navigation .sub-menu li {
        width: 100%;
    }
    
    .main-navigation .sub-menu a {
        padding: 0.5rem 1rem;
        display: block;
        color: #fff;
        font-size: 0.95rem;
    }
    
    .main-navigation .sub-menu a:hover {
        background-color: var(--color-secondary);
        color: var(--color-primary);
    }
}

/* ==========================================================================
   8. Footer Layout
   ========================================================================== */
.site-footer {
    background-color: var(--color-primary);
    color: rgba(255, 255, 255, 0.7);
    padding-top: var(--space-lg);
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
}

.site-footer::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 60%;
    background: url('./assets/images/elijah-bg.png') no-repeat right center;
    background-size: contain;
    opacity: 0.15; 
    mix-blend-mode: screen; 
    pointer-events: none;
    z-index: 0;
}

.site-footer a {
    color: var(--color-secondary);
}

.site-footer a:hover {
    color: #fff;
}

.footer-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-md);
    padding-bottom: var(--space-lg);
    position: relative;
    z-index: 1;
}

.footer-title {
    color: #fff;
    font-size: 1.25rem;
    margin-bottom: 1rem;
    font-family: var(--font-heading);
}

.site-bottom {
    background-color: var(--color-primary-light);
    padding: 1.5rem 0;
    text-align: center;
    font-size: 0.85rem;
}

.site-bottom p {
    margin: 0;
}

.footer-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-menu li {
    margin-bottom: 0.5rem;
}

/* ==========================================================================
   9. Custom Page Templates (Contact)
   ========================================================================== */
.contact-layout {
    display: grid;
    grid-template-columns: 1fr; /* Mobile stacks vertically */
    gap: var(--space-lg);
}

@media screen and (min-width: 992px) {
    .contact-layout {
        grid-template-columns: 1fr 1fr; /* 50/50 split on large desktop screens */
        align-items: stretch;
    }
}

.contact-content-column {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.contact-info-block p {
    margin-bottom: 0.25rem;
}

/* ==========================================================================
   10. Dynamic Vanilla JS Slider
   ========================================================================== */
.dynamic-slider-container {
    position: relative;
    width: 100%;
    margin: 1.5rem 0 0 0;
}

.dynamic-slider-track {
    position: relative;
    width: 100%;
    height: 550px; /* Enforces absolute fixed height so slider never jumps */
}

/* All slides sit on top of each other */
.dynamic-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%; /* Spans the full track height */
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    pointer-events: none; /* Can't interact with hidden slides */
    display: flex;
    flex-direction: column;
}

/* Text limits for robust fixed heights */
.slider-text-content {
    color: var(--color-text-main);
    line-height: 1.6;
    font-size: 1.15rem; /* Increased text size */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 8; /* Allowed more text to show gracefully */
    -webkit-box-orient: vertical;
}

/* Fallback for when text contains inner P tags */
.slider-text-content p {
    margin-bottom: 0.5rem;
}

/* The active slide is visible and clickable */
.dynamic-slide.active {
    position: relative;
    opacity: 1;
    pointer-events: auto;
    z-index: 2;
}

/* Dot Navigation */
.slider-dots {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 1rem;
    margin-bottom: 2rem;
}

.slider-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--color-border);
    cursor: pointer;
    transition: var(--transition-fast);
}

.slider-dot.active {
    background-color: var(--color-secondary);
    transform: scale(1.2);
}
