:root {
    --bg-dark: #121212;
    --bg-card: #1e1e1e;
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --accent: #8e44ad; /* Modern Purple */
    --accent-hover: #9b59b6;
    --nav-bg: #000000;
    --danger: #e74c3c;
    --success: #2ecc71;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    line-height: 1.6;
}

/* --- Typography --- */
h1, h2, h3, h4 { 
    color: #fff; 
    font-weight: 300; 
}

a { 
    color: var(--accent); 
    text-decoration: none; 
    transition: 0.3s; 
}

a:hover { 
    color: var(--accent-hover); 
}

/* --- Layout --- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

/* --- Navigation --- */
nav {
    background: var(--nav-bg);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #333;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center; /* Center items vertically */
    gap: 20px;
}

nav a {
    color: var(--text-main);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9rem;
    padding-bottom: 5px; /* Space for the border */
}

nav a:hover { 
    color: var(--accent); 
}

/* Active Page Indicator */
nav a.active {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
}

/* Admin Button Style */
nav a.admin-link {
    color: var(--danger) !important;
    border: 1px solid var(--danger);
    padding: 5px 10px;
    border-radius: 4px;
    margin-left: 20px; 
    transition: all 0.3s ease;
    border-bottom: 1px solid var(--danger); /* Override standard active border */
}

nav a.admin-link:hover {
    background: var(--danger);
    color: white !important;
}

/* --- Cards (Classes, Admin, Sponsors) --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    position: relative; /* Added for Ribbon positioning */
    overflow: hidden; /* Added to clip Ribbon */
}

.intro {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 30px;
}

/* --- Forms (Contact & Admin) --- */
input, textarea, select {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    background: #2b2b2b;
    border: 1px solid #444;
    color: #fff;
    border-radius: 4px;
    box-sizing: border-box; /* Ensures padding doesn't break width */
}

input:focus, textarea:focus {
    border-color: var(--accent);
    outline: none;
}

button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 1rem;
    border-radius: 4px;
    transition: background 0.3s;
}

button:hover { 
    background: var(--accent-hover); 
}

button:disabled {
    background: #555;
    cursor: not-allowed;
}

.contact-form {
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-card);
    padding: 30px;
    border-radius: 8px;
}

/* --- Gallery Styles --- */
.gallery-grid {
    display: grid;
    /* Responsive grid: min column width 250px */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.gallery-item {
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-5px); /* Lift effect */
    box-shadow: 0 8px 12px rgba(0,0,0,0.5);
}

.gallery-item a {
    display: block;
    cursor: zoom-in; /* Indicates lightbox */
}

.gallery-item img {
    width: 100%;
    height: 250px; /* Fixed height for uniformity */
    object-fit: cover; /* Crops image cleanly */
    display: block;
}

/* --- History/Timeline Styles --- */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

/* The vertical line */
.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 20px; /* Adjust based on padding of history-item */
    width: 2px;
    background: #333;
    z-index: -1;
}

.history-item {
    margin-bottom: 30px;
    padding-left: 20px; /* Space for the line */
}

/* --- Utilities (Alerts) --- */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    text-align: center;
}

.alert.success {
    background-color: var(--success);
    color: #fff;
}

.alert.error {
    background-color: var(--danger);
    color: #fff;
}

/* --- Masonry / Chaotic Gallery Layout --- */
.gallery-masonry {
    /* Default: 3 columns */
    column-count: 3;
    column-gap: 20px;
    margin-top: 20px;
}

/* Override standard gallery-item for Masonry */
.gallery-masonry .gallery-item {
    /* Prevent images from being split across columns */
    break-inside: avoid;
    margin-bottom: 20px;
    
    /* Reset specific styles from uniform grid */
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
}

.gallery-masonry .gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0,0,0,0.5);
}

.gallery-masonry .gallery-item img {
    width: 100%;
    /* IMPORTANT: height: auto allows the natural chaotic shape */
    height: auto !important; 
    display: block;
}

/* Responsive: 2 columns on tablets */
@media (max-width: 900px) {
    .gallery-masonry {
        column-count: 2;
    }
}

/* Responsive: 1 column on phones */
@media (max-width: 600px) {
    .gallery-masonry {
        column-count: 1;
    }
}

/* --- "New" Ribbon Styles --- */
.ribbon {
    position: absolute;
    top: 20px;
    right: -35px; /* Pulls it off the edge so it spans the corner */
    transform: rotate(45deg);
    background: #ff6b6b; /* Bright Red/Pink */
    color: white;
    padding: 5px 40px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 10;
    pointer-events: none; /* Let clicks pass through to the card */
    
    /* The Pulse Animation */
    animation: pulse-ribbon 2s infinite ease-in-out;
}

@keyframes pulse-ribbon {
    0% { transform: rotate(45deg) scale(1); box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7); }
    50% { transform: rotate(45deg) scale(1.05); box-shadow: 0 0 0 10px rgba(255, 107, 107, 0); }
    100% { transform: rotate(45deg) scale(1); box-shadow: 0 0 0 0 rgba(255, 107, 107, 0); }
}

/* =========================================
   MOBILE NAVIGATION ADDITIONS
   ========================================= */

/* 1. Mobile-Specific Elements (Hidden on Desktop) */
.nav-brand, .menu-toggle {
    display: none; 
}

/* 2. Update Nav Container for Flex Spacing */
nav .container {
    display: flex;
    justify-content: center; /* Desktop: Centered Menu */
    align-items: center;
}

/* 3. Responsive Media Query (Tablets & Phones) */
@media (max-width: 768px) {
    
    /* Change container to spread items (Brand Left, Burger Right) */
    nav .container {
        justify-content: space-between;
    }

    /* Show the Brand Name */
    .nav-brand {
        display: block;
        font-weight: bold;
        font-size: 1.3rem;
        color: #fff;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    /* Show the Hamburger Icon */
    .menu-toggle {
        display: flex;
        flex-direction: column;
        gap: 5px;
        cursor: pointer;
        padding: 5px;
    }

    .menu-toggle span {
        width: 25px;
        height: 3px;
        background-color: var(--text-main);
        border-radius: 2px;
        transition: 0.3s;
    }

    /* Transform the List (<ul>) into a Dropdown */
    nav ul {
        display: none; /* Hidden by default */
        flex-direction: column;
        position: absolute;
        top: 100%; /* Push directly below navbar */
        left: 0;
        width: 100%;
        background-color: var(--nav-bg); /* Use theme variable */
        border-bottom: 2px solid var(--accent);
        padding: 10px 0;
        box-shadow: 0 4px 6px rgba(0,0,0,0.5);
    }

    /* The 'Active' class is toggled via JS to show menu */
    nav ul.active {
        display: flex;
    }

    /* Spacing for mobile links */
    nav ul li {
        width: 100%;
        text-align: center;
        margin: 0;
    }

    nav ul li a {
        display: block;
        padding: 15px;
        border-bottom: 1px solid #222;
        font-size: 1.1rem;
    }
    
    /* Hide the border on the last item */
    nav ul li:last-child a {
        border-bottom: none;
    }

    /* Adjust Admin Button on mobile */
    nav a.admin-link {
        margin-left: 0;
        display: inline-block;
        margin-top: 10px;
        margin-bottom: 10px;
    }
}

/* =========================================
   MOBILE PROFILE TWEAKS
   ========================================= */

/* Base styles for the profile card (replaces inline styles) */
.profile-card {
    position: relative;
    padding: 40px; /* Default desktop padding */
    text-align: left;
}

.profile-header {
    text-align: center;
    margin-bottom: 30px;
}

.profile-title {
    margin: 0;
    font-size: 2.5rem;
    color: var(--accent);
}

.profile-actions {
    margin-top: 40px;
    text-align: center;
}

/* Make the image responsive - DESKTOP SETTINGS */
.header-photo {
    width: 500px;        /* Forces 500px width on desktop */
    max-width: 100%;     /* Prevents overflow if screen is somehow smaller than 500px */
    height: auto;        /* Maintains aspect ratio */
    display: block;
    margin: 0 auto;
}

/* --- MOBILE PROFILE OVERRIDES --- */
@media (max-width: 600px) {
    /* Reduce container padding so content touches edges more */
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Drastically reduce card padding */
    .profile-card {
        padding: 20px 15px; 
    }

    /* Shrink the big title */
    .profile-title {
        font-size: 1.8rem;
    }

    /* Stack buttons vertically for easier tapping */
    .profile-actions {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .profile-actions a, 
    .profile-actions button {
        width: 100%; /* Full width buttons */
        margin-left: 0 !important; /* Remove the desktop margin */
    }
    
    /* Adjust the photo for mobile so it fits the screen */
    .header-photo {
        width: auto;       /* Reset the forced 500px width */
        max-height: 300px; /* Cap the height on phone so it doesn't dominate the screen */
    }
}