/* ============================================
   ALFAN CHURCH MANAGEMENT SYSTEM - STYLESHEET
   Responsive Design System
   ============================================ */

/* 1. CSS CUSTOM PROPERTIES */
:root {
    --primary-color: #0B1F3A;
    --accent-color: #C9A84C;
    --bg-color: #F8F5EF;
    --text-color: #333333;
    --text-main: #1a1a2e;
    --text-secondary: #6B6560;
    --text-muted: #94a3b8;
    --white: #FFFFFF;
    --black: #000000;
    --border-color: #e8e8e8;

    --font-heading: 'Cormorant Garamond', serif;
    --font-body: 'DM Sans', sans-serif;

    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 2rem;
    --spacing-xl: 4rem;

    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 15px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
}

/* 2. RESET & BASE */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--primary-color);
    margin-bottom: var(--spacing-md);
    line-height: 1.2;
}

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

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

ul { list-style: none; }

input, textarea, select, button {
    font-family: inherit;
    font-size: inherit;
}

/* 3. LAYOUT UTILITIES */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* 4. BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.8rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    z-index: 1;
    border: none;
    white-space: nowrap;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    letter-spacing: 0.02em;
}

/* Shimmer effect for buttons */
.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.25),
        transparent
    );
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: -1;
}

.btn:hover::before {
    left: 100%;
}

.btn:active {
    transform: translateY(-1px) scale(0.985) !important;
}

.btn-primary {
    background-color: var(--accent-color);
    color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(201, 168, 76, 0.2);
}

.btn-primary:hover {
    background-color: #e2c262;
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(201, 168, 76, 0.45);
}

.btn-secondary {
    background-color: transparent;
    color: var(--white);
    border: 2px solid rgba(255, 255, 255, 0.7);
}

.btn-secondary:hover {
    background-color: var(--white);
    color: var(--primary-color);
    border-color: var(--white);
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(255, 255, 255, 0.2);
}

/* ============================================
   5. HEADER & NAVIGATION
   ============================================ */
.main-header {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 0.9rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0,0,0,0.2);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.logo img {
    height: 48px;
}

/* Desktop Nav Links */
.nav-links {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav-links > li {
    position: relative;
}

.nav-links > li > a,
.nav-links > li > .dropdown-trigger {
    color: rgba(255,255,255,0.85);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.4rem 0;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: color var(--transition-fast);
    cursor: pointer;
    background: none;
    border: none;
}

.nav-links > li > a:hover,
.nav-links > li > .dropdown-trigger:hover {
    color: var(--accent-color);
}

/* Dropdown Styles */
.dropdown {
    position: absolute;
    top: calc(100% + 0.75rem);
    left: 0;
    background: var(--primary-color);
    min-width: 220px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    display: none;
    flex-direction: column;
    padding: 0.5rem 0;
    border-top: 3px solid var(--accent-color);
    list-style: none;
    margin: 0;
    z-index: 9999;
    border-radius: 0 0 8px 8px;
}

@media (min-width: 769px) {
    .dropdown::before {
        content: '';
        position: absolute;
        top: -0.75rem;
        left: 0;
        width: 100%;
        height: 0.75rem;
        background: transparent;
    }
}

.dropdown li {
    width: 100%;
}

.dropdown a {
    display: block;
    padding: 0.8rem 1.5rem;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.85);
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.dropdown a:hover {
    background: rgba(201, 168, 76, 0.15);
    color: var(--accent-color);
    padding-left: 1.9rem;
}

.has-dropdown:hover .dropdown,
.has-dropdown.open .dropdown {
    display: flex;
}

.nav-close-btn {
    display: none;
}

/* Hamburger Button */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    padding: 0.5rem;
    background: none;
    border: none;
    color: white;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: white;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.hamburger.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.hamburger.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ============================================
   6. HERO SECTION
   ============================================ */
.hero-section {
    background: linear-gradient(rgba(11, 31, 58, 0.7), rgba(11, 31, 58, 0.7)), url('../images/hero-bg.jpg') center/cover no-repeat;
    color: var(--white);
    text-align: center;
    padding: 8rem 1.25rem;
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
}

.hero-section h1 {
    color: var(--white);
    font-size: clamp(2.5rem, 6vw, 5rem);
    line-height: 1.1;
    margin-bottom: var(--spacing-md);
}

.hero-section .tagline {
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    margin-bottom: var(--spacing-lg);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0.9;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================
   7. COMMON LAYOUTS
   ============================================ */

/* Two-column grid used throughout the site */
.two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

/* Blog index layout */
.blog-index-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 3rem;
}

/* Blog card hover */
.blog-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg) !important;
}

/* ============================================
   8. FOOTER
   ============================================ */
.main-footer {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 0;
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: 3rem;
    padding: 5rem 0 2rem;
}

.footer-grid a {
    color: rgba(255,255,255,0.75);
    display: inline-block;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.footer-grid a:hover {
    color: var(--accent-color);
    transform: translateX(5px);
}

/* ============================================
   9. ANIMATIONS
   ============================================ */
.animate-up {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   9.1 SCROLL TRIGGERED REVEAL ANIMATIONS (Progressive Enhancement)
   ============================================ */
.js-enabled .reveal-on-scroll,
.js-enabled .reveal-on-scroll-left,
.js-enabled .reveal-on-scroll-right,
.js-enabled .reveal-on-scroll-scale {
    opacity: 0;
    will-change: transform, opacity;
    transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1),
                transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.js-enabled .reveal-on-scroll {
    transform: translateY(50px);
}

.js-enabled .reveal-on-scroll-left {
    transform: translateX(-60px);
}

.js-enabled .reveal-on-scroll-right {
    transform: translateX(60px);
}

.js-enabled .reveal-on-scroll-scale {
    transform: scale(0.92);
}

/* Revealed / Active State */
.js-enabled .reveal-on-scroll.active,
.js-enabled .reveal-on-scroll-left.active,
.js-enabled .reveal-on-scroll-right.active,
.js-enabled .reveal-on-scroll-scale.active {
    opacity: 1;
    transform: translate(0) scale(1);
}

/* Stagger delay classes */
.js-enabled .delay-100 { transition-delay: 100ms; }
.js-enabled .delay-150 { transition-delay: 150ms; }
.js-enabled .delay-200 { transition-delay: 200ms; }
.js-enabled .delay-300 { transition-delay: 300ms; }
.js-enabled .delay-400 { transition-delay: 400ms; }
.js-enabled .delay-500 { transition-delay: 500ms; }

/* ============================================
   9.2 LUXURY GRAPHICS & MICRO-INTERACTIONS
   ============================================ */

/* Moving ambient light glows */
.luxury-glow {
    will-change: transform;
    pointer-events: none;
}

@keyframes luxuryFloat1 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -25px) scale(1.08); }
    100% { transform: translate(0, 0) scale(1); }
}

@keyframes luxuryFloat2 {
    0% { transform: translate(0, 0) scale(1.08); }
    50% { transform: translate(-25px, 30px) scale(0.95); }
    100% { transform: translate(0, 0) scale(1.08); }
}

.glow-1, .glow-dark-1 {
    animation: luxuryFloat1 15s infinite ease-in-out;
}

.glow-2, .glow-dark-2 {
    animation: luxuryFloat2 18s infinite ease-in-out;
}

/* Premium Hover Zoom on Event Cards */
.event-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 45px rgba(11, 31, 58, 0.08);
}

.event-card:hover .event-card-img {
    transform: scale(1.065);
}

/* Shift arrow icon on hover for Learn More links */
.event-card-link:hover i {
    transform: translateX(4px);
}

/* Premium Page Header styling with animated moving gradient and particles */
.page-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #172c4f 50%, #201a4e 100%) !important;
    background-size: 200% 200% !important;
    animation: headerGradientMove 12s ease infinite !important;
    position: relative !important;
    overflow: hidden !important;
    padding: 3rem 0 3.2rem !important; /* Elegant compact spacing */
}

/* Floating dust particles background overlay */
.page-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: 
        radial-gradient(circle, rgba(255, 255, 255, 0.35) 1.2px, transparent 1.2px),
        radial-gradient(circle, rgba(201, 168, 76, 0.45) 2px, transparent 2px),
        radial-gradient(circle, rgba(255, 255, 255, 0.25) 2.5px, transparent 2.5px);
    background-size: 90px 90px, 140px 140px, 190px 190px;
    background-position: 0 0, 45px 70px, 95px 130px;
    animation: headerParticleDrift 25s infinite linear;
    pointer-events: none;
    z-index: 1;
    opacity: 0.95;
    will-change: transform;
}

/* Golden luxury gradient overlay */
.page-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 80% 20%, rgba(201, 168, 76, 0.12), transparent 45%),
                radial-gradient(circle at 15% 85%, rgba(11, 31, 58, 0.25), transparent 50%);
    pointer-events: none;
    z-index: 1;
}

/* Keep content above the particles and background */
.page-header > * {
    position: relative !important;
    z-index: 2 !important;
}

/* Subtle reveal on page load for the headers */
.page-header h1 {
    font-family: var(--font-heading);
    color: var(--white) !important;
    font-size: clamp(2.5rem, 5vw, 3.8rem) !important;
    line-height: 1.2 !important;
    margin-bottom: 1rem !important;
    animation: headerTextUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    letter-spacing: -0.01em !important;
}

.page-header p {
    color: rgba(255, 255, 255, 0.8) !important;
    font-size: clamp(1rem, 2vw, 1.2rem) !important;
    max-width: 700px;
    margin: 0.5rem auto 0 !important;
    line-height: 1.6 !important;
    animation: headerTextUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Breadcrumb links styling in page header */
.page-header a {
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.3s ease;
}
.page-header a:hover {
    color: var(--accent-color);
}

@keyframes headerGradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes headerParticleDrift {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-90px, -90px) rotate(360deg); }
}

@keyframes headerTextUp {
    0% { opacity: 0; transform: translateY(15px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ============================================
   10. ADMIN STYLES
   ============================================ */
.admin-sidebar {
    background-color: var(--primary-color);
    color: var(--white);
    min-height: 100vh;
    padding: var(--spacing-md);
}
.admin-sidebar a {
    color: var(--white);
    display: block;
    padding: var(--spacing-sm) 0;
}
.admin-sidebar a:hover {
    color: var(--accent-color);
}

/* ============================================
   11. PAGE-SPECIFIC HELPERS
   ============================================ */

/* Event cards */
.event-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* Scripture quote scaling */
.scripture-quote {
    font-size: clamp(1.4rem, 3vw, 2.5rem);
}

/* Gallery headers */
.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 4rem;
    flex-wrap: wrap;
    gap: 1rem;
}

/* ============================================
   12. RESPONSIVE BREAKPOINTS
   ============================================ */

/* Large desktops (1400px+): subtle tweaks */
@media (min-width: 1400px) {
    .container { max-width: 1320px; }
}

/* --- Tablets (max 1024px) --- */
@media (max-width: 1024px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2.5rem;
        padding: 4rem 0 3rem;
    }

    .blog-index-grid {
        grid-template-columns: 1fr;
    }

    .blog-sidebar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }

    /* Sermon two-col becomes single */
    .sermon-two-col {
        grid-template-columns: 1fr !important;
    }
}

/* Navigation Overlay Backdrop */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 31, 58, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}
.nav-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* --- Tablet Portrait / Large Mobile (max 768px) --- */
@media (max-width: 768px) {
    /* Navigation: hide desktop links, show hamburger */
    .hamburger { display: flex; }

    .nav-links {
        display: flex;
        position: fixed;
        top: 0;
        right: -320px; /* Hidden offscreen by default */
        width: 320px;
        max-width: 85vw;
        height: 100vh;
        background: var(--primary-color);
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        gap: 0;
        z-index: 1001; /* Above the backdrop overlay */
        padding: 5rem 0 2rem;
        overflow-y: auto;
        transition: right 0.3s ease-in-out;
        box-shadow: -5px 0 25px rgba(0,0,0,0.25);
    }

    .nav-links.open {
        right: 0; /* Slide in */
    }

    /* Close button inside open menu */
    .nav-close-btn {
        display: block;
        position: absolute;
        top: 1.25rem;
        right: 1.25rem;
        background: none;
        border: none;
        color: white;
        font-size: 2rem;
        cursor: pointer;
        line-height: 1;
    }

    .nav-links > li {
        width: 100%;
        text-align: left;
        border-bottom: 1px solid rgba(255,255,255,0.06);
    }

    .nav-links > li > a,
    .nav-links > li > .dropdown-trigger {
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
        justify-content: space-between;
        align-items: center;
        color: white;
        display: flex;
        width: 100%;
    }

    /* Mobile dropdown */
    .dropdown {
        position: static !important;
        box-shadow: none !important;
        background: rgba(255,255,255,0.05) !important;
        border-top: none !important;
        border-radius: 0 !important;
        min-width: 100% !important;
        display: none !important;
    }

    .has-dropdown.open .dropdown {
        display: flex !important;
    }

    .dropdown li {
        border-bottom: 1px solid rgba(255,255,255,0.03);
    }

    .dropdown a {
        color: rgba(255,255,255,0.85) !important;
        text-align: left !important;
        padding: 0.8rem 2.5rem !important; /* Indent sublinks */
        font-size: 0.95rem !important;
    }

    /* Donate button in mobile nav */
    .navbar > .btn {
        display: none; /* will be shown inside mobile menu only */
    }

    .mobile-donate-link {
        border-bottom: none !important; /* Remove horizontal border under button */
        margin-top: 2.5rem !important;
        margin-bottom: 2.5rem !important;
    }

    .mobile-donate-link a.btn-primary {
        color: #ffffff !important; /* White text color */
        background-color: var(--accent-color) !important;
    }
    
    .mobile-donate-link a.btn-primary:hover,
    .mobile-donate-link a.btn-primary:active,
    .mobile-donate-link a.btn-primary:focus {
        color: #ffffff !important;
        background-color: #d1b462 !important;
    }

    /* Hero adjustments */
    .hero-section {
        padding: 1.5rem 1.25rem 3.5rem 1.25rem;
        min-height: 60vh !important;
    }

    /* Two-column grids go single column */
    .two-col-grid,
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns: 2fr 1fr"],
    div[style*="grid-template-columns: 1fr 300px"] {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }

    /* Scripture quote */
    div[style*="font-size: 2.5rem"][style*="font-style: italic"] {
        font-size: 1.5rem !important;
    }

    /* About page adjustments */
    div[style*="font-size: 3rem"][style*="margin: 1rem 0"] {
        font-size: 2.2rem !important;
    }

    /* Footer */
    .main-footer {
        padding: 0 1.5rem;
    }
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 3rem 0 0.75rem;
    }
    .footer-bottom {
        margin-top: 1rem !important;
    }

    /* Events tabs flex wrap */
    .events-tabs {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    /* Blog comment grid */
    div[style*="grid-template-columns: 1fr 1fr"][style*="gap: 1.5rem"] {
        grid-template-columns: 1fr !important;
    }

    /* Section padding override */
    section { padding: 4rem 0; }
}

/* --- Small Mobile (max 480px) --- */
@media (max-width: 480px) {
    .container { padding: 0 1rem; }

    .hero-section {
        padding-top: 1rem;
        min-height: 55vh !important;
    }

    .hero-section h1 { font-size: 2.2rem; }
    .hero-section .tagline { font-size: 1rem; }

    .hero-actions { flex-direction: column; align-items: stretch; }
    .hero-actions .btn { width: 100%; justify-content: center; }

    /* About header font scale */
    h1[style*="font-size: 4rem"] { font-size: 2.5rem !important; }
    h2[style*="font-size: 3rem"] { font-size: 1.8rem !important; }
    h2[style*="font-size: 3.5rem"] { font-size: 2rem !important; }
    h2[style*="font-size: 2.5rem"] { font-size: 1.7rem !important; }

    /* Sermon grid goes vertical on small screens */
    div[style*="grid-template-columns: repeat(auto-fill, minmax(350px, 1fr))"],
    div[style*="grid-template-columns: repeat(auto-fill, minmax(300px, 1fr))"] {
        grid-template-columns: 1fr !important;
    }

    /* Page header headings */
    .page-header h1 { font-size: 2rem !important; }
    .page-header p { font-size: 1rem !important; }

    /* Devotion filter box stack */
    .filter-box {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-box form {
        width: 100%;
        flex-wrap: wrap;
    }

    .filter-box input[type="text"] {
        width: 100% !important;
    }

    /* RSVP modal */
    .modal-content {
        padding: 1.75rem 1.25rem;
        margin: 1rem;
    }

    /* Blog sidebar stacks */
    .blog-sidebar {
        grid-template-columns: 1fr !important;
    }

    /* Donation CTA */
    h2[style*="font-size: 3.5rem"] { font-size: 1.8rem !important; }

    /* Footer brand img */
    .footer-brand img { height: 50px !important; }

    /* Sermons filter bar */
    div[style*="display: flex"][style*="gap: 1rem"][style*="flex-wrap: wrap"] {
        flex-direction: column;
    }

    /* Gallery filter buttons wrap */
    div[style*="display: flex; gap: 1rem"] span {
        font-size: 0.8rem;
        padding: 0.4rem 1rem;
    }

    section { padding: 3rem 0; }
}
