/* --- Global Styles & Variables --- */
:root {
    --primary-color: #8B0000; /* Dark Red */
    --secondary-color: #FFD700; /* Gold */
    --background-light: #FFF8E1; /* Light Cream */
    --background-dark: #FFFFFF;
    --text-color: #333333;
    --heading-font: 'Lora', serif;
    --body-font: 'Roboto', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--body-font);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1280px; /* New, wider setting */
    margin: 0 auto;
    padding: 0 20px;
}

h1, h2, h3 {
    font-family: var(--heading-font);
    color: var(--primary-color);
    margin-bottom: 20px;
}

h2 {
    font-size: 2.5rem;
    text-align: center;
}

.section-subtitle {
    text-align: center;
    max-width: 600px;
    margin: -15px auto 30px auto;
    font-size: 1.1rem;
    color: #666;
}

.content-section {
    padding: 80px 0;
    background-color: var(--background-dark);
}

.content-section-alt {
    padding: 80px 0;
    background-color: var(--background-light);
}

.cta-button {
    display: inline-block;
    background-color: var(--primary-color);
    color: #fff;
    padding: 12px 25px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.cta-button:hover {
    background-color: #6e0000;
    transform: translateY(-2px);
}

/* --- Header & Navbar --- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: rgba(255, 255, 255, 0.9);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: background-color 0.3s;
}

.nav-logo {
    font-family: var(--heading-font);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    position: relative; /* Needed for the ::after pseudo-element */
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    padding: 5px 0;
    transition: color 0.3s;
}

/* The growing underline effect */
.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--primary-color);
    transition: width 0.3s ease-in-out;
}

/* Apply the underline effect on hover AND when the link is active */
.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Make the active link text stand out */
.nav-link.active {
    color: var(--primary-color);
}

.hamburger {
    display: none;
    cursor: pointer;
}

.bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    background-color: var(--primary-color);
    transition: all 0.3s ease-in-out;
}

/* --- Hero Section --- */
.hero-section {
    /* We are now setting the background image on the outer container */
    max-height: 700px;
    overflow: hidden;
    padding-top: 80px;
    background-image: linear-gradient(rgba(60, 45, 30, 0.6), rgba(60, 45, 30, 0.6)), url('images/temple-bg.jpg');
    background-size: cover;
    background-position: center;
    color: #fff;
    /* Remove the fixed height to allow the aspect ratio to take over */
}

/* This new container will force the 16:9 aspect ratio */
.hero-inner {
    position: relative;
    width: 100%;
    /* The magic number for 16:9 aspect ratio (9 / 16 = 0.5625 or 56.25%) */
    padding-top: 56.25%; 
    height: 0;
}

/* We must position the content to be on top of the new inner container */
.hero-content {
    padding-bottom: 5%;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 20px;
}

.hero-content h1 {
    font-size: 3.5rem;
    margin-bottom: 10px;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
}

.hero-content p {
    font-size: 1.5rem;
    margin-bottom: 30px;
    color: var(--secondary-color);
}

/* --- History Section --- */
.history-content {
    display: flex;
    align-items: center;
    gap: 40px;
}

.history-image {
    width: 40%;
    max-width: 400px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.history-content p {
    flex: 1;
}

.history-text {
    flex: 1; /* This makes the text block take up the remaining available space */
}

/* Styling for the paragraphs within the History section text block */
.history-text p {
    /* 1. Justify the text for clean left and right edges */
    text-align: justify;

    /* 2. Increase line spacing for better readability */
    line-height: 1.8; /* Increased from the default for more "air" between lines */

    /* 3. Enhance font for a more classic, readable feel */
    font-family: var(--heading-font); /* Using the elegant 'Lora' serif font */
    font-size: 1.1rem; /* Slightly larger text (approx 17.6px) */
    color: #444; /* A softer black that's easier on the eyes for long text */
    
    /* 4. Add clear spacing BETWEEN each paragraph */
    margin-bottom: 1.5rem; /* Default is usually 1rem, this adds more separation */
}

/* Ensure the last paragraph doesn't have extra space at the bottom */
.history-text p:last-child {
    margin-bottom: 0;
}

/* --- Card Layout (Poojas, Festivals) --- */
.card-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
}

.card {
    background: var(--background-dark);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    padding: 25px;
    width: 300px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.card h3 {
    font-size: 1.5rem;
}

.card .card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 15px;
}

/* --- Booking & Administration --- */
.booking-info {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
    background: #fff;
    padding: 30px;
    border-radius: 10px;
}
.booking-info ol {
    text-align: left;
    margin: 20px auto;
    padding-left: 40px;
}
.booking-info .cta-button {
    margin: 10px;
}

.admin-list {
    text-align: center;
    font-size: 1.1rem;
}
.admin-list p {
    margin-bottom: 10px;
}

/* --- Contact Section --- */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: flex-start;
}

.contact-details p {
    margin-bottom: 15px;
    font-size: 1.1rem;
}
.contact-details i {
    color: var(--primary-color);
    margin-right: 15px;
    width: 20px;
}
.contact-details a {
    color: var(--text-color);
    text-decoration: none;
}
.contact-details a:hover {
    text-decoration: underline;
}
.contact-map iframe {
    border-radius: 10px;
}

/* --- Footer --- */
footer {
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 20px;
}

/* --- Responsive Media Queries --- */
@media (max-width: 768px) {
    h2 { font-size: 2rem; }
    .hero-content h1 { font-size: 2.5rem; }
    .hero-content p { font-size: 1.2rem; }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px; /* Adjust based on navbar height */
        flex-direction: column;
        background-color: #fff;
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-item {
        margin: 1.5rem 0;
    }

    .hamburger {
        display: block;
    }

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

    .nav-menu {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2rem;
        
        background-color: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(5px); /* Optional: creates a frosted glass effect */

        /* Start hidden and fade in */
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.35s ease, visibility 0.35s ease;
    }

    .nav-menu.active {
        opacity: 1;
        visibility: visible;
    }

    .nav-item {
        /* Remove margin from original design if any */
        margin: 0; 
    }

    .nav-link {
        font-size: 2rem; /* Make links much larger and easier to tap */
    }
    
    /* Remove the underline effect on mobile for a cleaner look */
    .nav-link::after {
        display: none;
    }

    .history-content {
        flex-direction: column;
    }
    .history-image {
        width: 100%;
        max-width: 350px;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    .hero-section {
        background-image: linear-gradient(rgba(60, 45, 30, 0.6), rgba(60, 45, 30, 0.6)), url('images/temple-bg-mobile.jpg');
        height: auto; /* Let height be determined by content */
        padding-top: 100px;  /* Space below the navbar */
        padding-bottom: 60px; /* Space above the next section */
        
        /* Ensure background image looks good in this new taller container */
        background-position: center center; 
    }

    /* 2. Undo the desktop aspect-ratio and positioning tricks */
    .hero-inner {
        position: static;
        padding-top: 0;
        height: auto;
    }

    .hero-content {
        position: static;
        height: auto;
        /* We can keep flexbox to center the items nicely */
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    /* 3. The font-size rules we already established */
    .hero-content h1 {
        font-size: 2.3rem;
        line-height: 1.2;
        margin-bottom: 12px;
    }

    .mantra-line {
        display: flex;
        align-items: center;
        gap: 0 1rem;
    }

    .mantra-subtitle {
        flex-direction: column;
        gap: 0.2rem;
        margin-bottom: 25px; /* Added slightly more margin for balance */
    }

    .mantra-subtitle span {
        font-size: 1.1rem;
    }

    .hero-content .cta-button {
        font-size: 0.9rem;
        padding: 10px 20px;
    }

    .navbar {
        padding: 0.5rem 0.5rem; /* Reduced from 1rem 2rem */
    }

    /* 2. Style the logo specifically for mobile */
    .nav-logo {
        font-size: 1.5rem; /* Significantly reduced from 1.8rem */
        white-space: nowrap; /* Guarantees the text will not wrap to a new line */
        overflow: hidden; /* Hides any part of the text that still overflows */
        text-overflow: ellipsis; /* Shows "..." if text is still too long */
        padding-left: 0.5rem;
    }
}

/* --- Pooja Modal Styles --- */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place even when scrolling */
    z-index: 2000; /* Sit on top of everything */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0, 0, 0, 0.6); /* Black background with opacity */
    animation: fadeIn 0.3s ease-in-out;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto; /* 5% from the top and centered */
    padding: 30px;
    border: 1px solid #888;
    width: 80%;
    max-width: 700px; /* Max width for larger screens */
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    animation: slideIn 0.4s ease-out;
}

/* The Close Button (x) */
.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
}

/* Styling for the Pooja List Table */
.pooja-list table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}
.pooja-list th, .pooja-list td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}
.pooja-list th {
    background-color: var(--background-light);
    color: var(--primary-color);
    font-family: var(--heading-font);
}

/* Payment Info section inside modal */
.payment-info {
    margin-top: 30px;
    background-color: #fff9e6;
    padding: 20px;
    border-radius: 5px;
    border-left: 5px solid var(--secondary-color);
}
.payment-info h3 {
    margin-top: 0;
}
.payment-info ul {
    list-style: none;
    padding: 0;
}
.payment-info li {
    margin-bottom: 5px;
}

/* Animation for Modal */
@keyframes fadeIn {
    from { background-color: rgba(0, 0, 0, 0); }
    to { background-color: rgba(0, 0, 0, 0.6); }
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* --- Hide/Show Logo Logic --- */

/* This style will be applied by JavaScript to hide the logo */
#nav-logo-link.logo-hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px); /* Optional: subtle slide-up effect */
}

/* This adds the smooth transition effect to the logo */
#nav-logo-link {
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

/* --- Mantra Subtitle Styling --- */
.mantra-subtitle {
    display: flex;
    flex-wrap: wrap; 
    justify-content: center;
    align-items: center;
}

.mantra-line {
    display: flex; /* Make phrases and separator align horizontally */
    align-items: center;
    gap: 0 1.5rem; /* Space between text and Om on desktop */
}

/* THE MAGIC: This adds the missing middle separator on DESKTOP ONLY */
.mantra-line:first-child::after {
    content: 'ॐ';
    color: var(--secondary-color);
    font-weight: bold;
    font-size: 1.7rem;
    line-height: 1; 
    margin-right: 1.5rem; /* Give it space on both sides */
}

/* Style for each part of the mantra text */
.mantra-subtitle span {
    font-size: 1.7rem;
    letter-spacing: 1px;
}

/* Style for the Om separator text that is in the HTML */
.mantra-separator {
    color: var(--secondary-color);
    font-weight: bold;
    font-size: 1.7rem;
    line-height: 1; 
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .mantra-subtitle {
        flex-direction: column; /* Stack the two lines vertically */
        gap: 0.2rem; /* Small gap between the two lines */
        margin-bottom: 20px;
    }
    
    .mantra-line {
        gap: 0 1rem; /* Adjust space between text and Om on mobile */
    }

    /* THE MAGIC REVERSED: Hide the desktop-only middle separator on mobile */
    .mantra-line:first-child::after {
        content: ''; /* Remove the character */
        margin: 0;   /* Remove the space */
    }

    /* Set the font size for ALL text inside the mantra on mobile */
    .mantra-subtitle span {
        font-size: 1.1rem;
    }
}

footer a {
    color: var(--secondary-color); /* Use the theme's gold color */
    text-decoration: none; /* Remove the default underline */
    font-weight: 500;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #fff; /* Make it brighter on hover */
    text-decoration: underline; /* Add underline on hover for clarity */
}