/* =========================
   GLOBAL
========================= */
*{
    margin:0;
    padding:0;
    box-sizing:border-box;
    font-family:'Segoe UI',Tahoma,Geneva,Verdana,sans-serif;
}

html{scroll-behavior:smooth;}
body{overflow-x:hidden;background:#fff;color:#222;}
img{max-width:100%;}

/* =========================
   HERO + NAVIGATION
========================= */
.hero-banner{
    position:relative;
    width:100%;
    min-height:450px;
    height:55vh;
    background:url('../images/bg.png') no-repeat center center/cover;
    display:flex;
    flex-direction:column;
}

.hero-banner::before{
    content:'';
    position:absolute;
    inset:0;
    background:rgba(0,0,0,.45);
    z-index:1;
}

.header-nav{
    position:fixed;
    top:0;
    left:0;
    width:100%;
    min-height:76px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:18px clamp(20px,4vw,40px);
    z-index:1000;
    background:transparent;
    transition:background .35s ease,backdrop-filter .35s ease,padding .35s ease;
}

.header-nav.scrolled{
    background:rgba(0,0,0,.72);
    backdrop-filter:blur(12px);
    -webkit-backdrop-filter:blur(12px);
    box-shadow:0 4px 15px rgba(0,0,0,.25);
}

.brand-title{
    display:flex;
    flex-direction:column;
    color:#fff;
    z-index:1002;
    min-width:0;
}

.brand-title .eng{font-size:clamp(1rem,2vw,1.35rem);font-weight:700;}
.brand-title .mal{font-size:clamp(.65rem,1.2vw,.8rem);opacity:.9;}

.nav-links{
    display:flex;
    justify-content:flex-end;
    align-items:center;
    gap:clamp(12px,2vw,20px);
    list-style:none;
}

.nav-links a{
    position:relative;
    color:#e0e0e0;
    text-decoration:none;
    font-size:.9rem;
    font-weight:500;
    white-space:nowrap;
}

.nav-links a::after{
    content:"";
    position:absolute;
    left:0;
    bottom:-6px;
    width:0;
    height:2px;
    background:#fff;
    transition:.3s;
}

.nav-links a:hover::after,
.nav-links a.active::after{width:100%;}

.nav-links a.active{color:#fff;font-weight:700;}

.menu-toggle{
    display:none;
    background:transparent;
    border:0;
    cursor:pointer;
    z-index:1002;
}

.menu-toggle span{
    display:block;
    width:27px;
    height:3px;
    margin:5px 0;
    background:#fff;
    border-radius:3px;
}

.center-content-wrapper{
    position:relative;
    z-index:2;
    flex:1;
    display:flex;
    justify-content:center;
    align-items:center;
    padding:100px 20px 40px;
}

.gallery-box{
    width:min(100%,1100px);
    border:2px solid rgba(255,255,255,.65);
    padding:clamp(18px,3vw,25px) clamp(20px,5vw,60px);
    background:rgba(255,255,255,.03);
    backdrop-filter:blur(2px);
}

.gallery-box h1{
    color:#fff;
    font-family:'Noto Serif Malayalam',serif;
    font-weight:700;
    font-size:clamp(1rem,2.5vw,1.85rem);
    line-height:1.6;
    letter-spacing:1px;
    text-align:center;
    text-shadow:2px 2px 8px rgba(0,0,0,.6);
}

/* =========================
   COMMON CONTENT
========================= */
#page-container{
    position:relative;
    width:100%;
    min-height:100vh;
}

.page{
    display:none;
    width:100%;
    opacity:0;
    transform:translateX(30px);
}

.page.active-page{
    display:block;
    opacity:1;
    transform:translateX(0);
    animation:pageIn .45s ease;
}

@keyframes pageIn{
    from{opacity:0;transform:translateX(30px);}
    to{opacity:1;transform:translateX(0);}
}

.section-heading{
    font-size:clamp(1.7rem,3vw,2.2rem);
    color:#222;
    margin-bottom:30px;
    position:relative;
    padding-bottom:10px;
    border-bottom:2px solid #e0e0e0;
}

.section-heading::after{
    content:'';
    position:absolute;
    bottom:-2px;
    left:0;
    width:80px;
    height:2px;
    background:#b71c1c;
}

.events-section,.committee-section,.contact-section,.about-section,.upadevathas-section{
    max-width:1200px;
    margin:clamp(45px,7vw,70px) auto;
    padding:0 clamp(16px,3vw,20px);
    scroll-margin-top:100px;
}

/* =========================
   EVENTS
========================= */
.events-grid{
    display:grid;
    grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);
    gap:clamp(25px,4vw,40px);
    align-items:start;
}

.video-container{
    position:relative;
    width:100%;
    aspect-ratio:16/9;
    border-radius:6px;
    overflow:hidden;
    box-shadow:0 4px 15px rgba(0,0,0,.1);
}

.video-container iframe{
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    border:0;
}

.event-description{
    font-family:'Noto Serif Malayalam',serif;
    color:#333;
    line-height:1.8;
    font-size:clamp(1rem,2vw,1.1rem);
}

.event-description h3{
    font-size:clamp(1.25rem,2.5vw,1.5rem);
    margin-bottom:15px;
    color:#b71c1c;
}

/* =========================
   STATS
========================= */
.stats{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:20px;
    margin:70px auto;
    max-width:1100px;
    padding:0 20px;
    text-align:center;
}

.stat{
    background:#fafafa;
    padding:clamp(22px,4vw,35px);
    border-radius:8px;
    box-shadow:0 5px 15px rgba(0,0,0,.08);
}

.stat h2{color:#b71c1c;font-size:clamp(1.8rem,4vw,2.4rem);}
.stat p{margin-top:10px;}

/* =========================
   COMMITTEE
========================= */
.committee-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:30px;
}

.committee-card{
    background:#f8f8f8;
    border-radius:8px;
    text-align:center;
    padding:30px 20px;
    box-shadow:0 5px 15px rgba(0,0,0,.08);
    transition:.3s;
}

.committee-card:hover{
    transform:translateY(-6px);
    box-shadow:0 10px 25px rgba(0,0,0,.15);
}

.committee-card h3{color:#b71c1c;margin-bottom:20px;font-size:1.5rem;}
.committee-card img{
    width:140px;
    height:180px;
    object-fit:cover;
    border-radius:8px;
    border:4px solid #fff;
    box-shadow:0 4px 10px rgba(0,0,0,.15);
    margin-bottom:18px;
}
.committee-card h4{font-size:1.2rem;color:#222;margin-bottom:10px;}
.committee-card p{color:#555;margin:6px 0;font-size:.95rem;}

/* =========================
   Upadevathas
========================= */
.upadevathas-grid{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr)); /* 4 cards in a row*/
    gap: 20px;
}

.upadevathas-card{
    background:#f8f8f8;
    border-radius:8px;
    text-align:center;
    padding:18px 14px;   
    box-shadow:0 5px 15px rgba(0,0,0,.08);
    transition:.3s;
}

.upadevathas-card:hover{
    transform:translateY(-6px);
    box-shadow:0 10px 25px rgba(0,0,0,.15);
}

.upadevathas-card h3{
    color:#b71c1c;margin-bottom:12px;font-size:1.2rem;}

.upadevathas-card img{
    width:105px;
    height:135px;
    object-fit:cover;
    border-radius:8px;
    border:3px solid #fff;
    box-shadow:0 4px 10px rgba(0,0,0,.15);
    margin-bottom:12px;
}
.upadevathas-card h4{font-size:1.05rem;color:#222;margin-bottom:6px;}
.upadevathas-card p{color:#555;margin:4px 0;font-size:.85rem;}

/* =========================
   CONTACT
========================= */
.contact-section{padding-bottom:60px;}
.contact-container{
    margin-top:40px;
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(340px,420px);
    gap:40px;
    align-items:stretch;
}
.contact-details{
    min-width:0;
    display:flex;
    flex-direction:column;
    justify-content:flex-start;
}
.contact-item{
    display:flex;
    align-items:center;
    gap:20px;
    margin-bottom:30px;
    min-width:0;
}
.contact-item img{width:32px;height:32px;object-fit:contain;flex:0 0 auto;}
.contact-item a{
    font-size:clamp(1rem,2.5vw,1.375rem);
    color:#008fb3;
    text-decoration:none;
    overflow-wrap:anywhere;
}
.contact-item a:hover{color:#b71c1c;}
.contact-location-details{margin-bottom:0;}
.contact-map{
    width:100%;
    min-height:225px;
    height:100%;
    overflow:hidden;
    border-radius:12px;
    border:1px solid rgba(0,0,0,.12);
    box-shadow:0 5px 14px rgba(0,0,0,.10);
    background:#f3f3f3;
}

.contact-map iframe{
    width:100%;
    height:100%;
    display:block;
    border:0;
}

/* =========================
   ABOUT
========================= */
.about-grid{
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(0,1.2fr);
    gap:40px;
    align-items:center;
}

.about-image img{
    width:100%;
    border-radius:10px;
    box-shadow:0 10px 25px rgba(0,0,0,.15);
}

.about-content h3{color:#b71c1c;font-size:clamp(1.5rem,3vw,2rem);margin-bottom:20px;}
.about-content p{font-size:clamp(1rem,2vw,1.08rem);line-height:1.9;margin-bottom:18px;color:#444;
        text-align:justify;text-justify: inter-word; overflow-wrap: break-word; word-break:normal; -webkit-hyphens: auto;-ms-hyphens: auto; hyphens: auto; word-spacing: 0.02em;}

/* =========================
   GALLERY
========================= */
#about-page{padding:40px 0 80px;}
#gallery-page{padding:110px 0 60px;}

.gallery-container{
    max-width:1200px;
    margin:0 auto;
    padding:0 20px;
    display:flex;
    flex-direction:column;
    gap:60px;
}

.gallery-row{
    display:grid;
    grid-template-columns:220px minmax(0,1fr);
    gap:30px;
    align-items:start;
}

.gallery-timeline-label{
    position:sticky;
    top:100px;
    padding-top:5px;
}

.gallery-timeline-label h3{font-size:1.4rem;color:#b71c1c;margin-bottom:5px;}
.photo-count{font-size:.85rem;color:#777;}

.gallery-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
    gap:15px;
}

.photo-item{
    aspect-ratio:4/3;
    overflow:hidden;
    border-radius:6px;
    box-shadow:0 2px 8px rgba(0,0,0,.06);
    background:#f5f5f5;
    cursor:pointer;
}

.photo-item img, .photo-item video {width:100%;height:100%;object-fit:cover;transition:transform .5s ease;}
.photo-item:hover img, .photo-item:hover video {transform:scale(1.05);}

/* A gallery section with only one YouTube item should not stretch the
   thumbnail across the entire row. Keep it the same compact tile style. */
.photo-item[data-youtube]{
    width:100%;
    max-width:320px;
}

@media (max-width:600px){
    .photo-item[data-youtube]{max-width:100%;}
}



/* LIGHTBOX */
.lightbox-overlay{
    display:none;
    position:fixed;
    z-index:9999;
    inset:0;
    background:rgba(0,0,0,.95);
    backdrop-filter:blur(8px);
    justify-content:center;
    align-items:center;
    opacity:0;
    transition:opacity .3s ease;
}
.lightbox-overlay.open{display:flex!important;opacity:1;}
.lightbox-content{
    max-width:90%;
    max-height:85vh;
    object-fit:contain;
    border-radius:4px;
    transform:scale(.95);
    transition:transform .3s ease;
    display: none; /*keeps them hidden until verified by JS*/
}
.lightbox-overlay.open .lightbox-content{transform:scale(1);}

/* YouTube lightbox player: keep the player large and responsive,
   while gallery thumbnails remain normal 4:3 tiles. */
.lightbox-youtube{
    width:min(900px,90vw);
    aspect-ratio:16/9;
    height:auto;
    max-width:90vw;
    max-height:85vh;
    border:0;
    background:#000;
    object-fit:initial;
}

.lightbox-youtube.active-media{
    display:block;
}

/*Adder helper class to show the selected media type */
.lightbox-content.active-media{
    display: block;
}

.lightbox-close{
    position:absolute;
    top:20px;
    right:25px;
    color:#fff;
    font-size:42px;
    cursor:pointer;
}


/* =========================
   DARSHAN
========================= */

#darshan-page {
    padding: 110px 0 60px;
}

.darshan-container {
    width: 92%;
    max-width: 1500px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

.darshan-container h2 {
    text-align: center;
    color: #333;
    margin-bottom: 24px;
}

/* Timing Cards - Keep Them Compact */

.timing-card {
    width: 100%;
    max-width: 640px;
    margin: 0 auto 20px;
    box-sizing: border-box;

    background: #f9f9f9;
    border-left: 4px solid #4a90e2;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,.05);
}

.timing-card.special {
    border-left-color: #e67e22;
    background: #fffaf5;
}

.timing-card h3 {
    margin-bottom: 12px;
    font-size: 1.15rem;
    color: #2c3e50;
}

.time-slots {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.slot {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    font-size: .98rem;
    color: #555;
}

.slot .label {
    font-weight: 600;
}

.slot .time {
    color: #111;
    text-align: right;
}



/* ==============================================
   SPECIAL FESTIVALS - COMPLETE DESIGN
============================================== */

#darshan-page .special-festivals-section {
    width: 100%;
    max-width: none;
    margin: 65px auto 45px;
    padding: 0 10px 35px;
    box-sizing: border-box;
}


/* ----------------------------------------------
   MAIN SECTION HEADING
---------------------------------------------- */

#darshan-page .special-festivals-heading {
    text-align: center;
    margin-bottom: 32px;
}

#darshan-page .special-festivals-heading h2 {
    color: #542f35;
    font-size: 30px;
    font-weight: 700;
    margin: 0 0 7px;
}

#darshan-page .special-festivals-heading h3 {
    color: #80665b;
    font-size: 17px;
    font-weight: 500;
    text-align: center;
    margin: 0;
}

#darshan-page .festival-heading-decoration {
    display: block;
    width: 90px;
    height: 3px;
    background: linear-gradient(
        to right,
        transparent,
        #b58b4b,
        transparent
    );
    margin: 17px auto 0;
}


/* ----------------------------------------------
   INTRODUCTORY INFORMATION BOX
---------------------------------------------- */

#darshan-page .festival-intro {
    width: 100%;
    max-width: 1050px;
    margin: 0 auto 45px;
    padding: 20px 30px;
    box-sizing: border-box;

    background: #f8f4ee;
    border-left: 5px solid #b58b4b;
    border-radius: 10px;

    box-shadow: 0 4px 15px rgba(65, 43, 32, 0.06);
}

#darshan-page .festival-intro ul {
    margin: 0;
    padding-left: 22px;
    list-style-type: disc;
}

#darshan-page .festival-intro li {
    color: #51413b;
    font-size: 15px;
    line-height: 1.9;
    padding-left: 5px;
    margin-bottom: 5px;
}

#darshan-page .festival-intro li::marker {
    color: #a77a3c;
}

#darshan-page .festival-intro li:last-child {
    margin-bottom: 0;
}


/* ----------------------------------------------
   MONTH SECTION HEADING
---------------------------------------------- */

#darshan-page .festival-month-heading {
    text-align: center;
    margin-bottom: 28px;
}

#darshan-page .festival-month-heading h3 {
    color: #542f35;
    font-size: 25px;
    font-weight: 700;
    text-align: center;
    margin: 0 0 6px;
}

#darshan-page .festival-month-heading p {
    color: #88766a;
    font-size: 15px;
    text-align: center;
    margin: 0;
}


/* ----------------------------------------------
   MONTH GRID
---------------------------------------------- */

#darshan-page .festival-month-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px;
    align-items: stretch;
}


/* ----------------------------------------------
   INDIVIDUAL MONTH CARDS
---------------------------------------------- */

#darshan-page .festival-month-card {
    width: 100%;
    min-height: 175px;
    padding: 23px 22px;
    box-sizing: border-box;

    background: #fffdf9;
    border: 1px solid #eadfce;
    border-radius: 12px;

    box-shadow: 0 4px 14px rgba(65, 43, 32, 0.07);

    transition: transform 0.25s ease,
                box-shadow 0.25s ease,
                border-color 0.25s ease;
}

#darshan-page .festival-month-card:hover {
    transform: translateY(-5px);
    border-color: #c5a36c;
    box-shadow: 0 9px 22px rgba(65, 43, 32, 0.12);
}


/* Month Name */

#darshan-page .festival-month-card h4 {
    color: #693b36;
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin: 0;
}


/* Decorative Underline */

#darshan-page .month-decoration {
    display: block;
    width: 48px;
    height: 2px;
    background: #b58b4b;
    border-radius: 5px;
    margin: 13px auto 17px;
}


/* Festival List */

#darshan-page .festival-month-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#darshan-page .festival-month-card li {
    position: relative;
    padding-left: 19px;
    margin-bottom: 8px;

    color: #68574e;
    font-size: 14px;
    line-height: 1.7;
}

#darshan-page .festival-month-card li::before {
    content: "✦";
    position: absolute;
    left: 0;
    top: 0;
    color: #b58b4b;
    font-size: 12px;
}

#darshan-page .festival-month-card li:last-child {
    margin-bottom: 0;
}


/* ==============================================
   TABLET RESPONSIVENESS
============================================== */

@media (max-width: 1024px) {

    #darshan-page .darshan-container {
        width: 94%;
    }

    #darshan-page .festival-month-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }

    #darshan-page .festival-month-card {
        min-height: 160px;
        padding: 22px 18px;
    }

}


/* ==============================================
   MOBILE RESPONSIVENESS
============================================== */

@media (max-width: 700px) {

    #darshan-page .darshan-container {
        width: 96%;
        padding: 12px;
    }

    #darshan-page .special-festivals-section {
        margin-top: 42px;
        padding: 0 3px 25px;
    }

    #darshan-page .special-festivals-heading h2 {
        font-size: 24px;
    }

    #darshan-page .special-festivals-heading h3 {
        font-size: 14px;
    }

    #darshan-page .festival-intro {
        padding: 16px 18px;
        margin-bottom: 32px;
    }

    #darshan-page .festival-intro li {
        font-size: 13px;
        line-height: 1.8;
    }

    #darshan-page .festival-month-heading h3 {
        font-size: 21px;
    }

    #darshan-page .festival-month-heading p {
        font-size: 12px;
    }

    #darshan-page .festival-month-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 13px;
    }

    #darshan-page .festival-month-card {
        min-height: 145px;
        padding: 17px 11px;
    }

    #darshan-page .festival-month-card h4 {
        font-size: 18px;
    }

    #darshan-page .festival-month-card li {
        font-size: 12px;
        line-height: 1.65;
    }

}


/* ==============================================
   VERY SMALL MOBILE
============================================== */

@media (max-width: 350px) {

    #darshan-page .festival-month-grid {
        grid-template-columns: 1fr;
    }

}





/* =========================
   FOOTER
========================= */
.footer{
    margin-top:70px;
    background:#7d1414;
    color:#fff;
    padding:30px 20px;
    text-align:center;
    font-size:15px;
}
.footer p{margin:6px 0;}
.developer{margin-top:12px;font-size:14px;color:#f5d76e;}
.developer a{color:#f5d76e;text-decoration:none;font-weight:600;}
.developer a:hover{text-decoration:underline;}

/* =========================
   TABLET
========================= */
@media(max-width:900px){
    .hero-banner{min-height:420px;height:auto;}
    .events-grid,.about-grid{grid-template-columns:1fr;}
    .committee-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
    .upadevathas-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
    .stats{grid-template-columns:repeat(2,minmax(0,1fr));}
    .gallery-row{grid-template-columns:1fr;}
    .gallery-timeline-label{position:relative;top:auto;border-bottom:2px solid #f0f0f0;padding-bottom:8px;}
}

/* =========================
   MOBILE
========================= */
@media(max-width:700px){
    .hero-banner{min-height:420px;}

    .header-nav{
        min-height:68px;
        padding:12px 16px;
        flex-wrap:wrap;
    }

    .menu-toggle{display:block;}

    .nav-links{
        display:none;
        width:100%;
        flex-direction:column;
        align-items:stretch;
        gap:0;
        padding:12px 0 4px;
        order:3;
    }

    .nav-links.open{display:flex;}

    .nav-links li{width:100%;}

    .nav-links a{
        display:block;
        padding:13px 8px;
        font-size:1rem;
    }

    .nav-links a::after{display:none;}

    .header-nav:has(.nav-links.open){
        background:rgba(0,0,0,.92);
        backdrop-filter:blur(12px);
    }

    .brand-title{max-width:calc(100% - 55px);}
    .brand-title .mal{white-space:normal;}

    .center-content-wrapper{padding:100px 16px 35px;}
    .gallery-box{max-width:100%;}

    .events-section,.committee-section,.contact-section,.about-section,.upadevathas-section{
        margin:45px auto;
        padding:0 16px;
    }

    .stats{margin:45px auto;padding:0 16px;gap:12px;}
    .stat{padding:20px 10px;}
    .stat p{font-size:.9rem;}

    .upadevathas-grid{grid-template-columns:1fr;gap:14px;}
    .upadevathas-card{padding:18px 14px;}

    .committee-grid{grid-template-columns:1fr;}
    .committee-card{padding:25px 16px;}

    .contact-container{grid-template-columns:1fr;gap:18px;}
    .contact-map{height:190px;min-height:190px;}
    .contact-details{width:100%;}

    .contact-item{align-items:flex-start;gap:14px;margin-bottom:24px;}
    .contact-item img{width:28px;height:28px;}
    .contact-email-item a{
        white-space:nowrap;
        overflow:visible;
        text-overflow:clip;
        font-size:1rem;
        letter-spacing:-.35px;
    }

    .contact-map{
        height:225px;
        min-height:225px;
        touch-action:auto;
        -webkit-overflow-scrolling:touch;
    }

    .contact-map iframe{
        width:100%;
        height:100%;
        min-height:225px;
        pointer-events:auto;
        touch-action:auto;
    }

    #gallery-page,#darshan-page{padding-top:90px;}
    .gallery-container{padding:0 16px;gap:40px;}
    .gallery-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;}

    .slot{flex-direction:column;gap:3px;}
    .slot .time{text-align:left;}

    .lightbox-close{top:15px;right:18px;font-size:38px;}
    .lightbox-content{max-width:95%;max-height:80vh;}
}

@media(max-width:380px){
    .stats{grid-template-columns:1fr;}
    .gallery-grid{grid-template-columns:1fr;}
    .brand-title .eng{font-size:.92rem;}
    .brand-title .mal{font-size:.6rem;}
}


/* =========================
   EVENTS PAGE
========================= */
#events-page{
    padding:110px 0 70px;
}

.events-page-container{
    max-width:1050px;
    margin:0 auto;
    padding:0 20px;
}

.events-list{
    display:flex;
    flex-direction:column;
    gap:22px;
}

.event-card{
    display:grid;
    grid-template-columns:minmax(230px,38%) minmax(0,1fr);
    min-height:190px;
    background:#f8f8f8;
    border-radius:10px;
    overflow:hidden;
    box-shadow:0 5px 16px rgba(0,0,0,.09);
    border:1px solid rgba(0,0,0,.05);
    cursor:pointer;
    transition:transform .3s ease, box-shadow .3s ease;
}

.event-card:hover,
.event-card:focus-visible{
    transform:translateY(-5px);
    box-shadow:0 12px 28px rgba(0,0,0,.16);
    outline:none;
}

.event-card-media{
    position:relative;
    min-height:190px;
    background:#111;
    overflow:hidden;
}

.event-card-media img,
.event-card-media video,
.event-card-media iframe{
    width:100%;
    height:100%;
    position:absolute;
    inset:0;
    border:0;
    object-fit:cover;
}

.event-card-media iframe{
    pointer-events:none;
}

.event-card-content{
    padding:22px 24px;
    display:flex;
    flex-direction:column;
    align-items:flex-start;
}

.event-date{
    display:inline-block;
    color:#b71c1c;
    font-size:.8rem;
    font-weight:700;
    letter-spacing:.04em;
    text-transform:uppercase;
    margin-bottom:8px;
}

.event-card-content h3{
    font-family:'Noto Serif Malayalam',serif;
    font-size:clamp(1.15rem,2.4vw,1.5rem);
    color:#222;
    line-height:1.5;
    margin-bottom:10px;
}

.event-card-content p{
    font-family:'Noto Serif Malayalam',serif;
    color:#555;
    line-height:1.7;
    font-size:.96rem;
}

.event-open-text{
    margin-top:auto;
    padding-top:15px;
    color:#b71c1c;
    font-weight:700;
    font-size:.9rem;
}

.event-play-badge{
    position:absolute;
    left:50%;
    top:50%;
    transform:translate(-50%,-50%);
    width:52px;
    height:52px;
    border-radius:50%;
    background:rgba(0,0,0,.65);
    color:#fff;
    display:grid;
    place-items:center;
    padding-left:3px;
    font-size:1.1rem;
    pointer-events:none;
}

/* Full screen event details */
.event-viewer-overlay{
    position:fixed;
    z-index:10000;
    inset:0;
    display:none;
    opacity:0;
    background:rgba(0,0,0,.94);
    backdrop-filter:blur(8px);
    -webkit-backdrop-filter:blur(8px);
    transition:opacity .3s ease;
}

.event-viewer-overlay.open{
    display:block;
    opacity:1;
}

.event-viewer-scroll{
    width:100%;
    height:100%;
    overflow-y:auto;
    overscroll-behavior:contain;
    padding:80px 20px 40px;
}

.event-viewer-content{
    width:min(100%,1050px);
    margin:0 auto;
    color:#fff;
    opacity:0;
    transform:translateY(20px) scale(.985);
    transition:opacity .35s ease, transform .35s ease;
}

.event-viewer-overlay.open .event-viewer-content{
    opacity:1;
    transform:translateY(0) scale(1);
}

.event-viewer-close{
    position:fixed;
    z-index:2;
    top:16px;
    right:24px;
    width:48px;
    height:48px;
    border:0;
    border-radius:50%;
    background:rgba(255,255,255,.12);
    color:#fff;
    font-size:2.2rem;
    line-height:1;
    cursor:pointer;
    transition:background .25s ease, transform .25s ease;
}

.event-viewer-close:hover{
    background:rgba(255,255,255,.24);
    transform:rotate(90deg);
}

.event-full-inner{
    display:grid;
    grid-template-columns:minmax(0,1.15fr) minmax(280px,.85fr);
    gap:35px;
    align-items:start;
}

.event-full-media{
    width:100%;
    aspect-ratio:16/10;
    background:#111;
    border-radius:8px;
    overflow:hidden;
    box-shadow:0 12px 35px rgba(0,0,0,.35);
}

.event-full-media img,
.event-full-media video,
.event-full-media iframe{
    width:100%;
    height:100%;
    border:0;
    object-fit:contain;
    display:block;
}

.event-full-media img{
    object-fit:cover;
}

.event-full-text{
    padding:10px 0 25px;
}

.event-full-text h2{
    font-family:'Noto Serif Malayalam',serif;
    font-size:clamp(1.5rem,3vw,2.25rem);
    line-height:1.5;
    margin-bottom:18px;
}

.event-full-text p{
    font-family:'Noto Serif Malayalam',serif;
    color:#e4e4e4;
    line-height:1.9;
    margin-bottom:16px;
}

body.event-viewer-open{
    overflow:hidden;
}

@media(max-width:900px){
    .event-full-inner{
        grid-template-columns:1fr;
        gap:25px;
    }
}

@media(max-width:700px){
    #events-page{padding-top:90px;}

    .events-page-container{padding:0 16px;}

    .event-card{
        grid-template-columns:1fr;
        min-height:0;
    }

    .event-card-media{
        min-height:0;
        aspect-ratio:16/9;
    }

    .event-card-content{
        padding:18px;
    }

    .event-viewer-scroll{
        padding:75px 15px 30px;
    }

    .event-viewer-close{
        top:12px;
        right:14px;
        width:44px;
        height:44px;
    }

    .event-full-media{
        aspect-ratio:16/9;
    }
}

/* =========================
   MOBILE WIDTH / NAV FIX
========================= */
html,
body{
    width:100%;
    max-width:100%;
    overflow-x:clip;
}

.hero-banner,
#page-container,
.footer{
    width:100%;
    max-width:100%;
    overflow-x:clip;
}

/* More reliable than width:100% for a fixed element on mobile browsers */
.header-nav{
    left:0;
    right:0;
    width:auto;
}

@media(max-width:700px){
    .header-nav{
        flex-wrap:nowrap;
        align-items:flex-start;
    }

    .brand-title{
        flex:1 1 auto;
        padding-right:12px;
    }

    .menu-toggle{
        flex:0 0 auto;
        margin-top:4px;
    }

    .nav-links{
        position:absolute;
        left:0;
        right:0;
        top:100%;
        width:auto;
        background:rgba(0,0,0,.92);
        padding:12px 16px 8px;
    }

    .nav-links.open{
        display:flex;
    }

    /* When the menu is open, the links no longer change navbar width/height */
    .header-nav:has(.nav-links.open){
        background:rgba(0,0,0,.92);
    }
}


/* =========================
   AUTOMATIC EVENTS
========================= */
.recent-event-container{width:100%;}
.recent-event-media{position:relative;}
.recent-event-media img,
.recent-event-media video,
.recent-event-media iframe{
    width:100%;
    height:100%;
    position:absolute;
    inset:0;
    border:0;
    object-fit:cover;
}
/* Home-page media is intentionally interactive so YouTube and videos can be played here. */
.recent-event-media iframe{pointer-events:auto;}
.recent-event-media video{pointer-events:auto;}
.event-description .event-date{margin-bottom:10px;}
.recent-event-open{
    margin-top:18px;
    border:0;
    background:#b71c1c;
    color:#fff;
    padding:11px 18px;
    border-radius:5px;
    font-weight:700;
    cursor:pointer;
    transition:transform .25s ease, background .25s ease;
}
.recent-event-open:hover{background:#8f1515;transform:translateY(-2px);}
.no-events-message{color:#666;font-size:1rem;padding:20px 0;}

/* The generated event list grows naturally as events are added. */
.events-list{min-height:1px;}

@media(max-width:700px){
    #events-page{padding-top:90px;}
    .events-page-container{padding:0 16px;}
    .recent-event-open{width:100%;}
}

/* =========================
   POOJA OFFERING PAGE
========================= */
#pooja-page{
    padding:110px 0 70px;
}

.pooja-container{
    width:min(1180px,calc(100% - 40px));
    margin:0 auto;
}

.pooja-heading{
    text-align:center;
    margin-bottom:24px;
}

.pooja-booking-ribbon{
    width:100%;
    margin:0 auto 34px;
    padding:15px 22px;
    text-align:center;
    color:#fff;
    background:linear-gradient(135deg,#8f1515,#b71c1c,#8f1515);
    border-radius:8px;
    box-shadow:0 6px 16px rgba(127,20,20,.22);
    font-size:clamp(1.05rem,2vw,1.3rem);
    font-weight:700;
    letter-spacing:.2px;
}

.pooja-booking-ribbon a{
    color:#fff;
    text-decoration:none;
    white-space:nowrap;
}

.pooja-booking-ribbon a:hover{text-decoration:underline;}

.pooja-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
    gap:18px;
    align-items:stretch;
}

.pooja-card{
    position:relative;
    min-height:205px;
    overflow:hidden;
    border:1px solid rgba(127,20,20,.14);
    border-radius:14px;
    background:linear-gradient(145deg,#fff,#fffaf7);
    box-shadow:0 4px 12px rgba(0,0,0,.08);
    outline:none;
    cursor:pointer;
    transition:transform .35s ease,box-shadow .35s ease,border-color .35s ease,background .35s ease;
}

.pooja-card::before{
    content:"";
    position:absolute;
    inset:0;
    border-radius:inherit;
    background:linear-gradient(135deg,rgba(183,28,28,.08),rgba(230,126,34,.04));
    opacity:0;
    transition:opacity .35s ease;
    pointer-events:none;
}

.pooja-card-content{
    position:relative;
    z-index:1;
    min-height:205px;
    height:100%;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    padding:30px 22px;
    text-align:center;
}

.pooja-name{
    margin:0;
    max-width:100%;
    color:#222;
    font-family:'Noto Serif Malayalam',serif;
    font-size:clamp(1rem,1.7vw,1.18rem);
    font-weight:600;
    line-height:1.65;
    transition:transform .38s ease,color .38s ease;
}

.pooja-price{
    margin-top:14px;
    padding:8px 14px;
    border-radius:6px;
    background:#8f1515;
    color:#fff;
    font-size:1.05rem;
    font-weight:700;
    line-height:1.2;
    transition:transform .38s ease,background .38s ease,opacity .25s ease;
}

/*.pooja-description{
    position:absolute;
    left:22px;
    right:22px;
    top:78px;
    bottom:22px;
    margin:0;
    padding:0 4px;
    color:#666;
    font-size:.96rem;
    line-height:1.55;
    text-align:justify;
    text-justify:inter-word;
    opacity:0;
    transform:translateY(18px);
    overflow-y:auto;
    scrollbar-width:thin;
    transition:opacity .35s ease,transform .35s ease;
}*/



.pooja-description {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 76px;
  bottom: 16px;
  margin: 0;
  padding: 0 8px;
  box-sizing: border-box;
  color: #666;
  font-size: 0.92rem;
  line-height: 1.5;

  /* Spacing Fix: Clean left alignment eliminates artificial stretching gaps */
  text-align: left;
  
  /* Natural Malayalam Wrapping Fixes */
  white-space: normal;
  overflow-wrap: break-word; /* Allows breaking at safe points if a word is incredibly long */
  word-break: normal;        /* Respects standard language breaking rules */
  hyphens: none;
  -webkit-hyphens: none;

  /* Animation and State */
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .35s ease, transform .35s ease;

  /* Scrollbar Management */
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
}







/* A clicked/tapped card stays open until it is clicked/tapped again or reload. */
.pooja-card.pooja-open{
    transform:translateY(-5px);
    border-color:rgba(183,28,28,.48);
    box-shadow:0 12px 25px rgba(127,20,20,.17);
}

.pooja-card.pooja-open::before{opacity:1;}

/* The open state uses a dedicated top heading area and a separate description
   area, preventing long Malayalam names from colliding with the description. */
.pooja-card.pooja-open .pooja-name{
    position:absolute;
    top:14px;
    left:18px;
    right:18px;
    transform:none;
    color:#9b1b1b;
    font-size:clamp(.92rem,1.5vw,1.08rem);
    line-height:1.35;
}

.pooja-card.pooja-open .pooja-price{
    transform:translateY(-20px);
    opacity:0;
}

.pooja-card.pooja-open .pooja-description{
    opacity:1;
    transform:translateY(0);
}

/* Hover preview is deliberately limited to real mouse/trackpad devices.
   Touch devices use the clicked/tapped .pooja-open state only. */
@media (hover:hover) and (pointer:fine){
    .pooja-card:hover:not(.pooja-open),
    .pooja-card:focus-visible:not(.pooja-open){
        transform:translateY(-5px);
        border-color:rgba(183,28,28,.42);
        box-shadow:0 12px 25px rgba(127,20,20,.16);
    }

    .pooja-card:hover:not(.pooja-open)::before,
    .pooja-card:focus-visible:not(.pooja-open)::before{
        opacity:1;
    }

    .pooja-card:hover:not(.pooja-open) .pooja-name,
    .pooja-card:focus-visible:not(.pooja-open) .pooja-name{
        position:absolute;
        top:14px;
        left:18px;
        right:18px;
        transform:none;
        color:#9b1b1b;
        font-size:clamp(.92rem,1.5vw,1.08rem);
        line-height:1.35;
    }

    .pooja-card:hover:not(.pooja-open) .pooja-price,
    .pooja-card:focus-visible:not(.pooja-open) .pooja-price{
        transform:translateY(-20px);
        opacity:0;
    }

    .pooja-card:hover:not(.pooja-open) .pooja-description,
    .pooja-card:focus-visible:not(.pooja-open) .pooja-description{
        opacity:1;
        transform:translateY(0);
    }
}

@media(min-width:901px){
    /* Compact, clearly separated detail layout for laptop/desktop cards. */
    .pooja-card.pooja-open .pooja-name,
    .pooja-card:hover:not(.pooja-open) .pooja-name,
    .pooja-card:focus-visible:not(.pooja-open) .pooja-name{
        top:12px;
        font-size:clamp(.9rem,1.45vw,1.05rem);
        line-height:1.32;
    }

    .pooja-card.pooja-open .pooja-description,
    .pooja-card:hover:not(.pooja-open) .pooja-description,
    .pooja-card:focus-visible:not(.pooja-open) .pooja-description{
        top:76px;
        bottom:14px;
        line-height:1.5;
        text-align:justify;
        text-justify:inter-word;
    }
}

@media(max-width:900px) and (min-width:701px){
    .header-nav{padding-left:18px;padding-right:18px;}
    .nav-links{gap:10px;}
    .nav-links a{font-size:.78rem;}
    .brand-title .eng{font-size:1.05rem;}
    .brand-title .mal{font-size:.62rem;}
}

@media(max-width:900px){
    #pooja-page{padding-top:95px;}
    .pooja-container{width:min(100% - 32px,760px);}
    .pooja-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;}
}

@media(max-width:700px){
    #pooja-page{padding-top:90px;padding-bottom:50px;}
    .pooja-container{width:calc(100% - 28px);}
    .pooja-heading{margin-bottom:20px;}
    .pooja-booking-ribbon{margin-bottom:24px;padding:14px 12px;font-size:1.05rem;line-height:1.55;}
    .pooja-booking-ribbon span{display:block;}
    .pooja-grid{grid-template-columns:1fr;gap:16px;}
    .pooja-card,.pooja-card-content{min-height:220px;}
    .pooja-card-content{padding:24px 18px;}
    .pooja-card.pooja-open .pooja-name{top:20px;}
    .pooja-card.pooja-open .pooja-description{top:96px;bottom:18px;font-size:.9rem;}
}

@media(max-width:380px){
    .pooja-container{width:calc(100% - 20px);}
    .pooja-card,.pooja-card-content{min-height:210px;}
}

/* Event detail media: keep local videos and YouTube embeds in the same
   predictable responsive frame on desktop and mobile. */
.event-full-media-gallery{
    display:grid;
    grid-template-columns:minmax(0,1fr);
    gap:24px;
    width:100%;
}

.event-media-item{
    width:100%;
    margin:0;
}

.event-media-frame{
    width:100%;
    aspect-ratio:16/9;
    max-height:70vh;
    background:#111;
    border-radius:8px;
    overflow:hidden;
    display:flex;
    align-items:center;
    justify-content:center;
}

.event-media-frame video,
.event-media-frame iframe,
.event-media-frame img{
    display:block;
    width:100%;
    height:100%;
    max-width:100%;
    max-height:100%;
    border:0;
    object-fit:contain;
}

.event-media-frame iframe{
    aspect-ratio:16/9;
}

@media(max-width:700px){
    .event-media-frame{
        aspect-ratio:16/9;
        max-height:none;
    }
}


/* Accessibility: visible keyboard focus and reduced-motion support */
:where(a, button, [tabindex]):focus-visible {
    outline: 3px solid #d97706;
    outline-offset: 3px;
}

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

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