/* --- VARIABLES --- */
:root {
    --primary-red: #d91616;
    --primary-red-hover: #ff3333;
    --dark-bg: #050202;
    --card-bg: #0a0a0a;
    --text-light: #ffffff;
    --text-muted: #8a8a8a;
    --border-dark: rgba(255, 255, 255, 0.08);
    --font-heading: 'Cinzel', serif;
    --font-body: 'Montserrat', sans-serif;
}

/* --- RESET & BASE --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--dark-bg);
    color: var(--text-light);
    font-family: var(--font-body);
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* --- NAVIGATION --- */
nav {
    position: absolute;
    top: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 60px;
    z-index: 100;
    background: linear-gradient(to bottom, rgba(0,0,0,0.9) 0%, transparent 100%);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-img {
    height: 45px;
    width: 45px;
    object-fit: contain;
}

.nav-logo-text h1 {
    font-family: var(--font-heading);
    font-size: 22px;
    letter-spacing: 3px;
    color: var(--text-light);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.nav-logo-text p {
    font-size: 9px;
    color: var(--primary-red);
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 600;
}

.nav-links {
    display: flex;
    gap: 35px;
}

.nav-links a {
    font-family: var(--font-heading);
    font-size: 13px;
    letter-spacing: 2px;
    color: #a0a0a0;
    transition: all 0.3s ease;
    padding-bottom: 5px;
    font-weight: 600;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--text-light);
}

.nav-links a.active {
    border-bottom: 2px solid var(--primary-red);
}

.nav-actions {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 10px 25px;
    font-family: var(--font-heading);
    font-size: 11px;
    letter-spacing: 2px;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.3s ease;
    background: transparent;
    text-transform: uppercase;
    font-weight: 600;
}

.btn-discord-nav {
    border: 1px solid var(--border-dark);
    color: var(--text-light);
    background: rgba(255,255,255,0.03);
}

.btn-discord-nav:hover {
    border-color: var(--text-light);
    background: rgba(255,255,255,0.1);
}

.btn-login {
    border: 1px solid var(--primary-red);
    color: var(--primary-red);
    background: rgba(217, 22, 22, 0.05);
}

.btn-login:hover {
    background: rgba(217, 22, 22, 0.2);
    box-shadow: 0 0 10px rgba(217, 22, 22, 0.5);
}

/* --- HERO SECTION --- */
.hero {
    position: relative;
    min-height: 90vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 8%;
    /* Normal dark castle background */
    background: url('../public/hero/castle.png') no-repeat center center;
    background-size: cover;
    background-color: var(--dark-bg); 
}

.hero::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 40%;
    background: linear-gradient(to bottom, transparent 0%, var(--dark-bg) 100%);
    z-index: 1;
    pointer-events: none;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        url('../public/hero/particles.png'),
        url('../public/hero/embers.png'),
        url('../public/hero/fog.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-blend-mode: screen; 
    mix-blend-mode: screen; 
    z-index: 1;
    pointer-events: none;
    opacity: 0.8;
}

/* --- NEW IMAGE LIGHTNING LAYER --- */
#lightning-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Update this line right here with the new clean name: */
    background: url('../public/hero/castle-lightning.png') no-repeat center center/cover;
    opacity: 0; 
    z-index: 1;
    pointer-events: none;
    mix-blend-mode: screen; 
    -webkit-mask-image: radial-gradient(circle at center, black 45%, transparent 75%);
    mask-image: radial-gradient(circle at center, black 45%, transparent 75%);
}

/* The double-flash animation */
.is-flashing {
    animation: flash-image 1.5s ease-out;
}

@keyframes flash-image {
    0% { opacity: 0; }
    5% { opacity: 1; }
    10% { opacity: 0; }
    15% { opacity: 0.5; }
    20% { opacity: 0; }
    25% { opacity: 1; }
    30% { opacity: 0; }
    100% { opacity: 0; }
}

.hero-content {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 60px;
}

.hero-text {
    max-width: 650px;
}

.hero-text h2 {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 22px;
    line-height: 1.6;
    color: #cccccc;
    margin-bottom: 45px;
}

.hero-text h2 span {
    color: var(--primary-red);
    font-weight: 600;
}

.hero-buttons {
    display: flex;
    gap: 20px;
}

.btn-main-discord {
    border: 1px solid var(--primary-red);
    background: rgba(217, 22, 22, 0.15);
    color: var(--text-light);
    padding: 16px 35px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    box-shadow: 0 0 20px rgba(217, 22, 22, 0.3);
}

.btn-main-discord:hover {
    background: rgba(217, 22, 22, 0.3);
    box-shadow: 0 0 30px rgba(217, 22, 22, 0.6);
}

.btn-events {
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-light);
    padding: 16px 35px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.6);
    font-size: 13px;
}

.btn-events:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.8);
}

.hero-image-container {
    flex-shrink: 0;
    position: relative;
    padding-right: 50px;
}

.hero-image-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(217,22,22,0.4) 0%, transparent 60%);
    z-index: -1;
    filter: blur(25px);
}

.hero-shield {
    width: 450px;
    height: auto;
    object-fit: contain;
}

/* --- STATS SECTION --- */
.stats-container {
    position: relative;
    z-index: 3;
    max-width: 1000px;
    margin: -50px auto 50px auto;
    background: url('../public/hero/section-bg.png') no-repeat center center/cover;
    background-color: rgba(8, 8, 8, 0.9);
    background-blend-mode: multiply;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    padding: 35px 0;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}

.stat-box {
    flex: 1;
    text-align: center;
    border-right: 1px solid rgba(255, 255, 255, 0.03);
    position: relative;
}

.stat-box:last-child {
    border-right: none;
}

.stat-box::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 30%;
    height: 40%;
    width: 2px;
    background: var(--primary-red);
    opacity: 0.6;
    box-shadow: 0 0 10px var(--primary-red);
}

.stat-box:first-child::before { 
    display: none; 
}

.stat-box i {
    color: var(--primary-red);
    font-size: 22px;
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(217, 22, 22, 0.5);
}

.stat-box h3 {
    font-family: var(--font-heading);
    font-size: 40px;
    font-weight: 400;
    margin-bottom: 5px;
    color: #eaeaea;
}

.stat-box p {
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

/* --- SCROLL INDICATOR --- */
.scroll-indicator {
    position: relative;
    z-index: 3;
    text-align: center;
    margin-bottom: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.mouse-icon {
    width: 24px;
    height: 36px;
    border: 2px solid var(--text-muted);
    border-radius: 12px;
    position: relative;
}

.mouse-icon::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 6px;
    background-color: var(--text-muted);
    border-radius: 2px;
    animation: scroll 2s infinite;
}

@keyframes scroll {
    0% { transform: translate(-50%, 0); opacity: 1; }
    100% { transform: translate(-50%, 15px); opacity: 0; }
}

.scroll-indicator span {
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--primary-red);
    text-transform: uppercase;
    font-weight: 700;
}

/* --- UPCOMING EVENTS --- */
.events-section {
    position: relative;
    z-index: 3;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 50px 100px 50px;
    background: url('../public/hero/footer-texture.png') repeat-x bottom center;
}

.events-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    position: relative;
    padding-bottom: 20px;
}

.events-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 12px;
    background: url('../public/hero/divider.png') repeat-x center;
    opacity: 0.5;
}

.events-header h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    letter-spacing: 3px;
    color: #e0e0e0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.events-header h3::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--primary-red);
    transform: rotate(45deg);
    box-shadow: 0 0 5px var(--primary-red);
}

.view-all {
    font-size: 11px;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    position: relative;
    z-index: 2;
}

.view-all:hover {
    color: var(--text-light);
}

.events-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.event-card {
    background: var(--card-bg);
    border: 1px solid var(--border-dark);
    border-radius: 6px;
    display: flex;
    align-items: center;
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.event-card:hover {
    transform: translateY(-5px);
    border-color: rgba(217, 22, 22, 0.4);
    box-shadow: 0 8px 20px rgba(0,0,0,0.8), 0 0 15px rgba(217, 22, 22, 0.1);
}

.event-img {
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 30px;
    color: rgba(255,255,255,0.2);
    border-right: 1px solid var(--border-dark);
}

.bg-zulrah { background: linear-gradient(135deg, #2a0b0b, #0a0a0a); }
.bg-tob { background: linear-gradient(135deg, #1b0a1a, #0a0a0a); }
.bg-cox { background: linear-gradient(135deg, #0e1a0a, #0a0a0a); }

.event-info {
    padding: 15px 20px;
    flex: 1;
}

.event-date {
    color: var(--primary-red);
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 6px;
}

.event-title {
    font-family: var(--font-heading);
    font-size: 16px;
    margin-bottom: 12px;
    color: #f0f0f0;
}

.event-host {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.event-card-full {
    justify-content: center;
    text-align: center;
    flex-direction: column;
    border: 1px solid var(--primary-red);
    background: rgba(217, 22, 22, 0.05);
    gap: 12px;
}

.event-card-full:hover {
    background: rgba(217, 22, 22, 0.15);
    border-color: var(--primary-red-hover);
    box-shadow: 0 8px 20px rgba(0,0,0,0.8), 0 0 20px rgba(217, 22, 22, 0.3);
}

.mini-shield {
    height: 40px;
    width: 40px;
    object-fit: contain;
}

.event-card-full span {
    font-size: 11px;
    letter-spacing: 1.5px;
    color: #a0a0a0;
    text-transform: uppercase;
    font-weight: 600;
}

.event-card-full strong {
    display: block;
    color: var(--primary-red);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 14px;
    margin-top: 4px;
    letter-spacing: 1px;
}
/* =========================
   MOBILE RESPONSIVE FIXES
========================= */

@media screen and (max-width: 900px) {
    /* Navbar: Stack logo, links, and buttons vertically */
    nav {
        flex-direction: column !important;
        gap: 15px;
        padding: 15px 20px !important;
        position: relative !important;
    }

    .nav-links {
        justify-content: center;
        gap: 15px;
        flex-wrap: wrap;
    }

    .nav-actions {
        width: 100%;
        justify-content: center;
    }

    /* Hero Section: Stack text and shield image */
    .hero-content {
        flex-direction: column !important;
        text-align: center;
        padding: 120px 20px 40px 20px !important;
    }

    .hero-text {
        max-width: 100% !important;
    }

    .hero-shield {
        max-width: 220px !important;
        margin: 30px auto 0 auto !important;
    }

    .hero-buttons {
        justify-content: center;
    }

    /* Page Containers & Wrappers: Reduce huge padding on mobile */
    .achievements-container,
    .events-page-container,
    .gallery-container,
    .ranks-container {
        padding: 15px !important;
    }

    .achievements-wrapper,
    .calendar-wrapper,
    .gallery-wrapper,
    .ranks-wrapper {
        padding: 20px 15px !important;
    }

    /* Calendar Grid Adjustments for smaller screens */
    .calendar-grid {
        gap: 4px !important;
    }

    .calendar-cell {
        min-height: 90px !important;
        padding: 6px !important;
    }

    .cell-event-title {
        font-size: 7px !important;
    }

    .cell-event-sub, .cell-event-time {
        font-size: 6px !important;
    }
}

/* =========================
   TRUE MOBILE RESPONSIVE REFLOW
========================= */

@media screen and (max-width: 900px) {
    /* Navigation */
    nav {
        flex-direction: column !important;
        align-items: center !important;
        gap: 12px;
        padding: 15px !important;
        position: relative !important;
    }

    .nav-logo {
        flex-direction: column;
        text-align: center;
    }

    .nav-links {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
        width: 100%;
    }

    .nav-links a {
        font-size: 11px;
        padding: 5px 8px;
    }

    .nav-actions {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    /* Hero Section */
    .hero-content {
        flex-direction: column !important;
        text-align: center;
        padding: 100px 15px 40px 15px !important;
    }

    .hero-text {
        max-width: 100% !important;
    }

    .hero-text h2 {
        font-size: 24px !important;
        line-height: 1.3;
    }

    .hero-shield {
        max-width: 180px !important;
        margin: 25px auto 0 auto !important;
    }

    .hero-buttons {
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
    }

    /* Page Containers */
    .achievements-container,
    .events-page-container,
    .gallery-container,
    .ranks-container {
        padding: 10px !important;
    }

    .achievements-wrapper,
    .calendar-wrapper,
    .gallery-wrapper,
    .ranks-wrapper {
        padding: 15px 10px !important;
    }

    /* Grids: Force single-column stacking to prevent pinching */
    .achievements-grid,
    .gallery-grid,
    .ranks-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    /* Calendar Mobile Optimization */
    .calendar-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .calendar-grid {
        gap: 2px !important;
    }

    .calendar-day-header {
        font-size: 8px !important;
        letter-spacing: 1px;
        padding-bottom: 6px;
    }

    .calendar-cell {
        min-height: 75px !important;
        padding: 4px !important;
    }

    .calendar-date-num {
        font-size: 10px !important;
    }

    .cell-event-title {
        font-size: 6px !important;
    }

    .cell-event-sub, .cell-event-time {
        font-size: 5px !important;
    }
}

@media screen and (max-width: 600px) {
    /* Home Stats Boxes */
    .stats-container {
        grid-template-columns: 1fr !important;
        padding: 0 15px;
        margin: 20px auto !important;
    }

    header h1 {
        font-size: 28px !important;
        letter-spacing: 3px !important;
    }
    
    header p {
        font-size: 11px !important;
        letter-spacing: 1px !important;
        padding: 0 10px;
    }
}