/* --- VARIABLES & RESET --- */
:root {
    --polaris-gold: #D9A72E;
    --polaris-black: #000000;
    --polaris-white: #ffffff;
    --polaris-font: 'Outfit', sans-serif;
}

/* Lenis Smooth Scroll Recommended CSS */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

body {
    font-family: var(--polaris-font) !important;
    background-color: var(--polaris-white);
    color: var(--polaris-white);
    margin: 0;
    padding: 20px; /* The Frame */
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 20px 0;
    font-family: var(--polaris-font) !important;
    color: var(--polaris-white);
}

h5#modalRole {
  color: var(--polaris-white);
}

span.header-small {
    font-size: 30px;
}

.progress-amount {
  color: var(--polaris-white);
}

/* TYPOGRAPHY */
.polaris-wrapper h1 { font-weight: 800; font-size: 56px; line-height: 1.1; text-transform: uppercase; margin-bottom: 20px; color: white; }
.polaris-wrapper h2 { font-weight: 800; font-size: 40px; text-transform: uppercase; margin-bottom: 30px; color: white; text-align: center; }
.polaris-wrapper h3, .polaris-wrapper h4 { font-weight: 700; text-transform: uppercase; color: white; }

.polaris-wrapper p, .polaris-wrapper li {
    font-weight: 300; line-height: 1.6; font-size: 20px;
    max-width: 800px; margin-left: auto; margin-right: auto;
}

.polaris-border hr {
    border-color: var(--polaris-gold);
    width: 50%;
    margin-bottom: 30px;
}

p, li {
  color: var(--polaris-white);
  font-family: var(--polaris-font);
}

.text-gold { color: var(--polaris-gold); }
.text-center { text-align: center; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* BUTTONS */
.btn {
    background-color: var(--polaris-gold); color: var(--polaris-black);
    padding: 15px 40px; border-radius: 40px; text-decoration: none; font-weight: 800;
    display: inline-block; cursor: pointer; border: none; text-transform: uppercase; font-size: 18px;
    transition: all 0.3s ease;
}
.btn:hover { transform: scale(1.05); }

[type=button]:focus, [type=button]:hover, [type=submit]:focus, [type=submit]:hover, button:focus, button:hover {
    background-color: var(--polaris-gold) !important;
    color: var(--polaris-black) !important;
    transform: scale(1.05) !important;
}

/* --- MODAL STYLES (THE FIX) --- */
/* The Overlay */
.modal-overlay {
    display: none; /* Hidden by default */
    position: fixed; 
    z-index: 10000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.9);
    backdrop-filter: blur(4px);
    align-items: center; 
    justify-content: center;
}

/* The Content Box */
.modal-content {
    background-color: #000;
    border: 1px solid var(--polaris-gold);
    border-radius: 15px;
    position: relative;
    display: flex;
    width: 90%;
    max-width: 900px;
    height: auto;
    /* KEY FIX: Ensures modal fits in viewport */
    max-height: 85vh; 
    margin: 0 auto;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    overflow: hidden; 
}

/* Close Button */
.close-modal-icon {
    position: absolute;
    top: 15px; right: 20px; color: #fff; font-size: 28px; font-weight: bold; cursor: pointer; z-index: 10;
    background: rgba(0,0,0,0.5); width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; line-height: 1;
}

/* MEMBER MODAL LAYOUT */
#memberModal .modal-img-container {
    flex: 0 0 40%;
    position: relative;
    overflow: hidden;
    border-right: 1px solid #333;
    height: auto;
    border-radius: 15px 0 0 15px;
}
#memberModal .modal-img-container img { width: 100%; height: 100%; object-fit: cover; object-position: top; }

#memberModal .modal-text {
    flex: 1;
    padding: 40px;
    color: #ddd;
    /* KEY FIX: Enables scroll inside this panel */
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch; 
    border-radius: 0 15px 15px 0;
}

/* VIDEO MODAL SIZE */
.video-content-size { width: 100%; height: auto; aspect-ratio: 16/9; }

/* --- MENU STYLES --- */
.fullscreen-menu { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: #000; z-index: 9999; opacity: 0; pointer-events: none; padding: 80px 40px; transition: opacity 0.4s ease; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.fullscreen-menu.active { opacity: 1; pointer-events: all; }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; max-width: 1200px; margin: 0 auto; gap: 40px; height: 100%; align-items: start; padding-top: 60px; }
.menu-links { display: flex; flex-direction: column; }
.menu-links a { color: var(--polaris-gold); font-size: 40px; font-weight: 800; text-decoration: none; margin: 10px 0; text-transform: uppercase; transition: color 0.3s; }
.menu-links a:hover { color: #fff; }
.menu-video-container { width: 100%; aspect-ratio: 16/9; background: #111; border: 1px solid #333; display: flex; align-items: center; justify-content: center; background-size: cover; border-radius: 15px; }
.close-menu { position: absolute; top: 40px; right: 40px; color: white; font-size: 3rem; cursor: pointer; }

/* --- NAV & HERO --- */
.polaris-nav { position: fixed; top: 20px; left: 20px; right: 20px; padding: 10px; display: flex; justify-content: space-between; align-items: flex-start; z-index: 1000; pointer-events: none; will-change: transform; }
.nav-element { pointer-events: all; }
.menu-btn { background: var(--polaris-gold); border-radius: 50%; width: 60px; height: 60px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--polaris-black); font-size: 24px; transition: transform 0.2s; }
.menu-btn:hover { transform: scale(1.1); }

.hero-section { background-size: cover; background-position: top; background-blend-mode: overlay; min-height: 90vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 140px 20px 80px 20px; position: relative; border-radius: 30px; z-index: 5; }
.hero-logo { max-width: 280px; margin-bottom: 30px; }
.hero-list-container { text-align: left; display: inline-block; max-width: 850px; margin-bottom: 30px; }
.hero-list-container ul { list-style: none; padding: 0; }
.hero-list-container li { position: relative; padding-left: 25px; margin-bottom: 12px; }
.hero-list-container li::before { content: "•"; color: #fff; font-weight: bold; position: absolute; left: 0; }
.scroll-down-btn { position: absolute; bottom: -30px; left: 50%; transform: translateX(-50%); width: 60px; height: 60px; background: var(--polaris-gold); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--polaris-black); font-size: 24px; z-index: 20; box-shadow: 0 5px 15px rgba(0,0,0,0.3); cursor: pointer; }

/* --- SECTIONS --- */
.video-interstitial { background-color: transparent; width: 100%; position: relative; z-index: 10; margin-bottom: -100px; pointer-events: none; }
.intro-video { pointer-events: all; width: 85%; max-width: 1000px; margin: 0 auto; aspect-ratio: 16/9; background-color: #111; background-size: cover; border-radius: 20px; box-shadow: 0 30px 60px rgba(0,0,0,0.5); border: 4px solid #fff; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; margin-top: 40px; transform: scale(0.95) translateY(20px); z-index: -1; }
.large-play-btn { width: 90px; height: 90px; background: rgba(255,255,255,0.9); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 35px; color: var(--polaris-black); cursor: pointer; transition: transform 0.3s; }
.site-wrapper { background-color: var(--polaris-black); border-radius: 30px; overflow: hidden; position: relative; z-index: 5; padding-top: 50px; padding-bottom: 40px; z-index: 100; }
.polaris-section { padding: 100px 20px; text-align: center; }

.timeline-section { background-size: contain; background-repeat: no-repeat; background-position: center top; }
.timeline { position: relative; max-width: 1000px; margin: 0 auto; }
.timeline::after { content: ''; position: absolute; width: 2px; background-color: rgba(212, 175, 55, 0.3); top: 0; bottom: 0; left: 50%; margin-left: -1px; }
.timeline-item { padding: 10px 50px; position: relative; width: 50%; box-sizing: border-box; margin-bottom: 60px; }
.timeline-item.left { left: 0; text-align: right; }
.timeline-item.right { left: 50%; text-align: left; }
.star-icon { position: absolute; width: 40px; height: 40px; top: 10px; right: -20px; background-color: #000; border-radius: 50%; z-index: 10; display: flex; align-items: center; justify-content: center; border: 2px solid #000; }
.timeline-item.right .star-icon { left: -20px; }
.star-svg { width: 28px; height: 28px; fill: transparent; stroke: var(--polaris-gold); stroke-width: 2; transition: fill 0.6s ease; }
.timeline-item.active .star-svg { fill: var(--polaris-gold); }
.timeline-content h3 { color: var(--polaris-gold); font-size: 1.4rem; margin-bottom: 15px; }

.initiatives-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 40px; margin-top: 50px; max-width: 1200px; margin-left: auto; margin-right: auto; }
.video-card { background-color: #111; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; position: relative; cursor: pointer; border: 1px solid #333; transition: transform 0.3s ease; }
.video-card:hover { transform: translateY(-5px); border-color: var(--polaris-gold); }
.video-card video { width: 100%; height: 100%; object-fit: cover; opacity: 0.8; }
.play-overlay { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: var(--polaris-gold); font-size: 40px; pointer-events: none; }
.video-title { color: white; font-size: 1.2rem; margin-top: 15px; font-weight: 600; text-align: center; }

.academy-video-row { display: flex; justify-content: center; gap: 20px; max-width: 1000px; margin: 0 auto 40px auto; flex-wrap: wrap; }
.academy-vid-wrapper { background: #111; border: 1px solid #333; border-radius: 12px; overflow: hidden; position: relative; cursor: pointer; transition: transform 0.3s ease, border-color 0.3s; }
.academy-vid-wrapper:hover { transform: translateY(-5px); border-color: var(--polaris-gold); }
.academy-vid-wrapper.horizontal { flex: 2; aspect-ratio: 16 / 9; min-width: 300px; }
.academy-vid-wrapper.vertical { flex: 1; aspect-ratio: 9 / 16; min-width: 150px; max-width: 300px; }
.academy-vid-wrapper video, .academy-vid-wrapper img { width: 100%; height: 100%; object-fit: cover; opacity: 0.9; }
.stars-text-section { text-align: center; max-width: 900px; margin: 0 auto; }

.board-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; margin-top: 50px; max-width: 1200px; margin-left: auto; margin-right: auto; }
.board-member { background: #fff; border-radius: 60px 0 60px 0; overflow: hidden; text-align: left; cursor: pointer; transition: transform 0.3s ease; position: relative; height: 420px; }
.board-member:hover { transform: translateY(-10px); }
.board-img { height: 100%; width: 100%; background-color: #ccc; object-fit: cover; display: block; }
.board-info { position: absolute; bottom: 0; left: 0; width: 100%; background: linear-gradient(to top, rgba(255,255,255,1) 15%, rgba(255,255,255,0.8) 40%, rgba(255,255,255,0) 100%); padding: 30px 25px 20px 25px; display: flex; flex-direction: column; justify-content: flex-end; min-height: 40%; }
.board-info h4 { color: #000; font-size: 1.5rem; margin-bottom: 5px; font-weight: 800; text-transform: uppercase; line-height: 1; }
.board-info span { color: #222; font-size: 1rem; text-transform: uppercase; font-weight: 600; }

.progress-section { border-top: 1px solid #111; }
.progress-description { margin-bottom: 40px !important; }
.progress-track { width: 100%; max-width: 800px; margin: 0 auto; height: 50px; border: 2px solid #fff; border-radius: 50px; overflow: hidden; }
.progress-fill { height: 100%; background-color: var(--polaris-gold); }
.progress-header { max-width: 800px; margin: 0 auto 10px auto; display: flex; justify-content: space-between; align-items: flex-end; }
.progress-amount { font-size: 1.4rem; font-weight: 800; }

.polaris-footer { background-color: #000; padding: 80px 40px 60px 40px; color: #fff; }
.org-cards-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 40px; margin-bottom: 80px; }
.org-card { background: #fff; width: 300px; padding: 40px 20px; border-radius: 15px; min-height: 200px; display: flex; align-items: center; justify-content: center; margin-bottom: 20px; }
.org-card.dark { background: #292929; }
.org-logo { max-width: 100%; height: auto; }
.footer-lower { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 40px; margin-top: 40px; }
.footer-left { flex: 1; max-width: 400px; }
.footer-right { background-color: #111; padding: 40px; border-radius: 20px; width: 100%; max-width: 450px; }
.footer-external-link { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 18px; margin-bottom: 10px; }
.footer-external-link i { font-size: 14px; color: var(--polaris-gold); }
.contact-item { display: flex; align-items: center; gap: 15px; margin-bottom: 20px; font-size: 18px; word-break: break-word; overflow-wrap: break-word; }
.contact-item a { color: var(--polaris-white); text-decoration: none; }
.social-icons { margin-top: 30px; display: flex; gap: 20px; font-size: 24px; }
.nav-donate-btn { background: var(--polaris-gold); color: var(--polaris-black); padding: 15px 35px; border-radius: 35px; font-weight: 700; text-transform: capitalize; cursor: pointer; border: none; transition: all 0.3s ease; font-size: 18px; }
.footer-copyright { margin-top:60px; font-size:14px; color:#666; display:flex; justify-content:space-between; }

/* --- VIDEO MODAL STYLES --- */

/* 1. The Container */
#videoModal .modal-content {
    width: 90%;
    max-width: 1000px;
    /* Force 16:9 Aspect Ratio for ALL video types (YouTube or File) */
    aspect-ratio: 16 / 9;
    height: auto; /* Let aspect ratio determine height */
    background-color: #000;
    padding: 0;
    overflow: hidden;
    /* Ensure inner player fills space */
    display: flex; 
    flex-direction: column;
    justify-content: center;
}

/* 2. The Inner Wrapper (Target the div created by JS) */
#modalPlayerContainer {
    width: 100%;
    height: 100%;
    display: flex;
}

/* 3. The Player Elements (YouTube & File) */
#videoModal iframe, 
#videoModal video {
    width: 100%;
    height: 100%;
    border: none;
    object-fit: contain; /* Ensures video fits within the 16:9 box */
    display: block;
}

/* --- MOBILE RESPONSIVE --- */
@media screen and (max-width: 768px) {
    /* 1. Global Sizing */
    body { padding: 10px; } 
    .polaris-wrapper h1 { font-size: 36px; }
    h2 { font-size: 30px !important; }
    h3 { font-size: 22px !important; }
    p, li { font-size: 16px !important; }
    
    .hero-list-container { text-align: left; }
    .menu-grid { grid-template-columns: 1fr; }
    .fullscreen-menu { padding: 40px 20px; }
    
    /* 2. Modal Stack (KEY FIX) */
    .modal-content {
        flex-direction: column; /* Stack image on top of text */
        width: 95%;
        max-height: 85vh; /* Keep it contained */
    }

    /* 3. Member Image (Restored Rectangle) */
    #memberModal .modal-img-container {
        flex: none; /* Reset flex */
        width: 100%;
        /* 3:4 Portrait Ratio for headshots */
        aspect-ratio: 3 / 4; 
        width: 200px; /* Optional: limit width if you prefer smaller */
        margin: 15px auto 15px auto; /* Center it */
        border-right: none;
        overflow: hidden;
        border-radius: 15px;
    }

    #memberModal .modal-text {
        flex: 1; /* Fill remaining height */
        padding: 25px;
        /* Ensure scrolling happens here */
        overflow-y: auto; 
        border-radius: 0 0 15px 15px;
    }

    .video-content-size { width: 100%; height: auto; }

    /* 4. Footer & Misc */
    .timeline-item { width: 100%; padding-left: 70px; text-align: left; }
    .timeline-item.left, .timeline-item.right { left: 0; }
    .timeline::after { left: 30px; }
    .star-icon { left: 10px !important; right: auto; }
    .timeline p, .timeline h3 { text-align: left; }
    .site-wrapper { padding-top: 0; }
    .polaris-section { padding: 50px 20px; text-align: center; }
    .intro-video { pointer-events: all; width: 100%; }
    .video-interstitial { margin-bottom: 0; }
    .initiatives-grid { grid-template-columns: auto; }
    .footer-lower { flex-direction: column; }
    .footer-copyright { flex-direction: column; gap: 15px; text-align: center; }
    .polaris-footer { background-color: #000; padding: 80px 10px 60px 10px; color: #fff; }
    .footer-right { padding: 30px; }
    span.header-small { font-size: 20px; }
    .menu-links a { color: var(--polaris-gold); font-size: 20px; }
    .progress-amount { font-size: 14px; font-weight: 800; }
    .polaris-nav { padding: 10px 0px; }
    .contact-item { font-size: 14px; }
    .menu-grid button.btn { width: 100%; }
    .progress-header { display: block; }
    .progress-header span.progress-amount, .progress-header .text-gold { display: block; width: 100%; }
    .menu-video { display: none; }
}

/* --- NEW LAYOUT STYLES --- */

.academy-grid-layout {
    display: grid;
    /* 1.4fr for left, 1fr for right gives a nice balance */
    grid-template-columns: 1.4fr 1fr; 
    gap: 40px;
    align-items: start; /* Aligns content to top */
    max-width: 1200px;
    margin: 0 auto;
}

.academy-left-col {
    display: flex;
    flex-direction: column;
    gap: 30px; /* Space between video and text */
}

/* Adjusting the specific video wrappers for this layout */
.academy-left-col .academy-vid-wrapper.horizontal {
    width: 100%;
    aspect-ratio: 16 / 9;
    flex: none; /* Disable previous flex settings */
}

.academy-right-col .academy-vid-wrapper.vertical {
    width: 100%;
    /* Mobile aspect ratio */
    aspect-ratio: 9 / 16; 
    flex: none;
    height: 100%; /* Allows it to be tall */
    max-width: none; /* Remove previous width limit */
}

/* Text alignment overrides to match screenshot */
.left-aligned-text {
    text-align: left;
    margin: 0;
    padding: 0;
}

.left-aligned-text h2 {
    text-align: left;
    margin-bottom: 15px;
    /* Ensuring the gold color from screenshot applies */
    color: var(--polaris-gold); 
    line-height: 1;
}

.left-aligned-text {
    text-align: left;
    margin: 0;
    padding: 0;
    margin-top: 50px;
    width: 400px;
    max-width: 100%;
}

#donateModal .modal-content {
    background-color: #000;
    border: 1px solid var(--polaris-gold);
    border-radius: 15px;
    position: relative;
    display: flex;
    width: auto;
    max-width: 900px;
    height: auto;
    max-height: 85vh;
    margin: 0 auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

/* --- MOBILE RESPONSIVE --- */
@media screen and (max-width: 900px) {
    .academy-grid-layout {
        grid-template-columns: 1fr; /* Stack them */
        gap: 30px;
    }
    
    /* On mobile, maybe you want the text centered again? 
       If not, remove this block to keep it left aligned. */
    .left-aligned-text, 
    .left-aligned-text h2, 
    .left-aligned-text p {
        text-align: center; 
    }
    
    .academy-right-col .academy-vid-wrapper.vertical {
        max-width: 400px; /* Limit width on mobile so it's not huge */
        margin: 0 auto;
    }

    .left-aligned-text {
        text-align: left;
        margin: 0;
        padding: 0;
        margin-top: inherit;
        width: 100%;
        max-width: 100%;
    }
}

/* --- MOBILE FIX FOR ACADEMY GRID --- */
@media screen and (max-width: 768px) {

    /* 1. Disable Grid, Switch to Vertical Flex Column */
    .academy-grid-layout {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 30px;
        margin: 0;
        padding: 0;
        box-sizing: border-box; /* Ensures padding doesn't increase width */
    }

    /* 2. Force Columns to be full width of container */
    .academy-left-col, 
    .academy-right-col {
        width: 100% !important;
        max-width: 100% !important;
        display: block;
        padding: 0;
    }

    /* 3. Fix Video Wrappers to stop overflowing */
    .academy-vid-wrapper,
    .academy-vid-wrapper.horizontal,
    .academy-vid-wrapper.vertical {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important; /* Let height adjust naturally */
        flex: none !important;
        margin-bottom: 20px;
    }

    /* 4. Specific adjustment for the Vertical Video on mobile */
    /* We limit the width slightly so it doesn't take up the entire vertical scroll height */
    .academy-right-col .academy-vid-wrapper.vertical {
        max-width: 280px !important; /* Prevents it from being too huge */
        margin-left: auto;
        margin-right: auto;
        aspect-ratio: 9 / 16;
    }

    /* 5. Fix Text Container Alignment & Padding */
    .stars-text-section.left-aligned-text {
        width: 100%;
        max-width: 100%;
        text-align: center !important; /* Center text usually looks better on mobile */
        padding: 0 10px; /* Add slight breathing room */
        box-sizing: border-box;
    }

    .stars-text-section.left-aligned-text h2 {
        text-align: center !important;
        font-size: 32px; /* Adjust font size if it's breaking words */
    }

    .stars-text-section.left-aligned-text p {
        text-align: center !important;
    }

    .academy-vid-wrapper.horizontal {
        flex: 2;
        aspect-ratio: 16 / 9;
        min-width: 100% !important;
        width: 100% !important;
        margin-bottom: 50px;
    }
}

@media screen and (max-width: 768px) {
    .polaris-nav {
        padding: 10px 0px;
        padding-top: 0;
    }

    .menu-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        max-width: 1200px;
        margin: 0 auto;
        gap: 0px;
        height: 100%;
        align-items: start;
        padding-top: 60px;
    }

    .menu-grid div:nth-child(3) {
        margin-top: 0 !important;
    }

    #memberModal .modal-img-container {
        flex: none;
        width: 100%;
        aspect-ratio: 3 / 4;
        position: relative;
        overflow: hidden;
        width: 200px;
        margin: auto;
        background: transparent;
        margin: 15px auto 15px auto; /* Center it */
    }

    #memberModal .modal-img-container img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        overflow: hidden;
        border-radius: 15px;
    }
}

.mobile-scroll-indicator {
    display: none;
}