/* --- ROOT VARIABLES & GENERAL STYLES --- */
:root {
    --primary-blue: #003366;
    --accent-gold: #ff9900;
    --light-bg: #f8f9fa;
    --white: #ffffff;
    --text-dark: #343a40;
    --text-light: #6c757d;
    --light-blue-bg: #eef7ff; /* Slightly softer blue */
    --border-color: #dee2e6;
    --success-green: #28a745;
    --danger-red: #dc3545;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Lato', sans-serif;
    line-height: 1.7;
    background-color: var(--light-bg);
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased; /* Smoother fonts */
}

.container {
    width: 90%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 0;
}

h1, h2, h3, h4 {
    font-family: 'Montserrat', sans-serif;
    color: var(--primary-blue);
    line-height: 1.3;
    font-weight: 700;
}

a {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: bold;
    position: relative;
    transition: color 0.3s;
}

/* --- REVISED: Modern Link Underline --- */
a:not(.cta-button) {
    background-image: linear-gradient(var(--accent-gold), var(--accent-gold));
    background-position: 0% 100%;
    background-repeat: no-repeat;
    background-size: 0% 2px;
    transition: background-size .3s;
}

a:hover:not(.cta-button) {
    color: var(--primary-blue);
    background-size: 100% 2px;
}

/* --- REVISED: Header & Navigation --- */
header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px); /* Glassmorphism effect */
    padding: 15px 5%;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 30px;
}

nav ul li a {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    color: var(--text-dark);
    background-image: linear-gradient(var(--primary-blue), var(--primary-blue)); /* Different underline for nav */
}

.cta-button {
    background-color: var(--accent-gold);
    color: var(--white);
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(255, 153, 0, 0.2);
    transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s;
}

.cta-button:hover {
    background-color: #e68a00;
    text-decoration: none;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 153, 0, 0.3);
}

/* --- REVISED: Animated Hamburger Menu --- */
.hamburger-menu {
    display: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
}

.hamburger-menu .bar {
    width: 25px;
    height: 3px;
    background-color: var(--primary-blue);
    border-radius: 5px;
    transition: all 0.3s ease-in-out;
}

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

/* --- REVISED: Hero Section --- */
.hero {
    background: linear-gradient(180deg, var(--light-blue-bg) 0%, var(--white) 100%);
    text-align: center;
    padding: 100px 20px;
    position: relative;
}

.hero h1 {
    font-size: 3.2em;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 15px;
}

.hero p {
    font-size: 1.2em;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto 30px auto;
}

.hero .cta-button {
    font-size: 1.2em;
    padding: 15px 30px;
}

/* --- NEW: Hero Animations & Scroll Indicator --- */
.hero-content > * {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s ease forwards;
}
.hero h1 { animation-delay: 0.2s; }
.hero p { animation-delay: 0.4s; }
.hero .cta-button { animation-delay: 0.6s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scroll-down-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
    color: var(--primary-blue);
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0) translateX(-50%); }
    40% { transform: translateY(-20px) translateX(-50%); }
    60% { transform: translateY(-10px) translateX(-50%); }
}


/* --- Content Sections --- */
section {
    padding: 80px 0;
}

.section-bg {
    background: var(--white);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    text-align: center;
    margin-bottom: 60px;
    font-size: 2.5em;
    position: relative;
    padding-bottom: 15px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background-color: var(--accent-gold);
    border-radius: 2px;
}

/* --- REVISED: Feature Cards --- */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    text-align: center;
}

.feature-card {
    background: var(--white);
    padding: 35px 25px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0, 51, 102, 0.05);
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 25px rgba(0, 51, 102, 0.1);
    border-color: var(--accent-gold);
}

.feature-card .icon {
    font-size: 3em;
    color: var(--accent-gold);
    margin-bottom: 20px;
}

.feature-card h3 {
    font-size: 1.5em;
    margin-bottom: 15px;
}

/* --- REVISED: "How It Works" Horizontal Timeline --- */
.how-it-works-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px 0;
    position: relative;
}

.step {
    text-align: center;
    flex: 1;
    padding: 0 20px;
    position: relative;
}

.step-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px auto;
    background: var(--accent-gold);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    font-weight: bold;
    font-family: 'Montserrat', sans-serif;
    border: 4px solid var(--light-bg);
    box-shadow: 0 0 0 3px var(--accent-gold);
    z-index: 2;
    position: relative;
}

.step h3 {
    margin-bottom: 10px;
}

.step p {
    color: var(--text-light);
}

/* Timeline Connector Line */
.how-it-works-container::before {
    content: '';
    position: absolute;
    top: 32px; /* Vertically center with the icons */
    left: 15%;
    right: 15%;
    height: 3px;
    background: repeating-linear-gradient(90deg, var(--accent-gold), var(--accent-gold) 6px, transparent 6px, transparent 12px);
    z-index: 1;
}


/* --- REVISED: Multi-Step Form Styles --- */
.competition-form {
    background: var(--white);
    padding: 40px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 51, 102, 0.1);
    overflow: hidden;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
}

input[type="text"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1em;
    font-family: 'Lato', sans-serif;
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input[type="text"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.15);
}

textarea {
    resize: vertical;
    min-height: 200px;
}

/* Progress Bar */
.progress-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    position: relative;
    width: 80%;
    margin-left: auto;
    margin-right: auto;
}
.progress-bar::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 4px;
    width: 100%;
    background-color: var(--border-color);
    z-index: 1;
}
.progress-bar .progress {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 4px;
    background-color: var(--accent-gold);
    z-index: 2;
    width: 0%;
    transition: width 0.4s ease;
}
.step-indicator {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--white);
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-family: 'Montserrat', sans-serif;
    z-index: 3;
    transition: background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease;
    border: 3px solid var(--border-color);
}
.step-indicator.active {
    background-color: var(--accent-gold);
    border-color: var(--accent-gold);
    color: var(--white);
    box-shadow: 0 0 10px rgba(255, 153, 0, 0.5);
}

/* Form Steps */
.form-step {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}
.form-step.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Form Group with Validation */
.form-group {
    position: relative;
    margin-bottom: 20px;
}
.validation-icon {
    position: absolute;
    right: 15px;
    top: 45px;
    font-size: 1.2em;
    display: none;
}
.validation-icon.valid {
    color: var(--success-green);
    display: inline;
}
.validation-icon.invalid {
    color: var(--danger-red);
    display: inline;
}

/* Word Counter */
.word-counter {
    text-align: right;
    font-size: 0.9em;
    color: var(--text-light);
    margin-top: 5px;
    height: 1.2em;
}
.word-counter.error {
    color: var(--danger-red);
    font-weight: bold;
}

/* Navigation Buttons */
.form-navigation-btns {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
}
.btn {
    padding: 12px 25px;
    font-size: 1em;
    font-weight: bold;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}
.btn-secondary {
    background-color: #6c757d;
    color: white;
}
.btn-primary {
    background-color: var(--primary-blue);
    color: white;
}
.form-submit-btn {
    width: auto;
    background-color: var(--success-green);
}
.form-submit-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Success Message */
.success-message {
    display: none;
    text-align: center;
    padding: 40px;
    animation: fadeIn 0.5s ease-in-out;
}
.success-message .icon {
    font-size: 4em;
    color: var(--success-green);
    margin-bottom: 20px;
}

/* --- REVISED: Judging Rubric Table (Desktop) --- */
.table-container {
    width: 100%;
    overflow-x: auto; /* A fallback for very wide screens, but our design avoids it */
}

.rubric-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.95em;
    box-shadow: 0 4px 20px rgba(0, 51, 102, 0.08);
    border-radius: 8px;
    overflow: hidden; /* Keeps the content within the rounded corners */
}

.rubric-table th,
.rubric-table td {
    padding: 15px 18px;
    text-align: left;
}

.rubric-table thead tr {
    background-color: var(--primary-blue);
    color: #ffffff;
    text-align: left;
    font-family: 'Montserrat', sans-serif;
}

.rubric-table tbody tr {
    border-bottom: 1px solid var(--border-color);
}

.rubric-table tbody tr:nth-of-type(even) {
    background-color: #f8f9fa;
}

.rubric-table tbody tr:last-of-type {
    border-bottom: 2px solid var(--accent-gold);
}

.rubric-table tbody tr:hover {
    background-color: #eef7ff;
}


/* --- Footer --- */
footer {
    background: var(--primary-blue);
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    padding: 40px 0;
    margin-top: 40px;
}
footer a {
    color: var(--white);
    font-weight: bold;
}

/* --- NEW: Animations on Scroll --- */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.reveal-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Mobile Responsive Styles --- */
@media (max-width: 992px) {
    /* Responsive Table Styles */
    .rubric-table thead {
        display: none; /* Hide desktop headers */
    }

    .rubric-table, .rubric-table tbody, .rubric-table tr, .rubric-table td {
        display: block; /* Stack everything */
        width: 100%;
        box-sizing: border-box;
    }

    .rubric-table tr {
        margin-bottom: 25px;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    }
    
    .rubric-table tbody tr:last-of-type {
        border-bottom: 1px solid var(--border-color); /* Reset border for mobile */
    }

    .rubric-table td {
        text-align: right;
        padding: 12px;
        padding-left: 50%;
        position: relative;
        border-bottom: 1px solid #f0f0f0;
    }

    .rubric-table tr td:last-child {
        border-bottom: 0;
    }

    /* Use data-label for mobile headers */
    .rubric-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        width: calc(50% - 25px);
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        color: var(--primary-blue);
    }

    /* Style the first cell as a "card title" */
    .rubric-table td:first-child {
        text-align: center;
        background-color: var(--light-blue-bg);
        font-size: 1.1em;
        padding: 15px;
        border-bottom: 2px solid var(--accent-gold);
    }
    .rubric-table td:first-child::before {
        display: none; /* Hide the "Criteria:" label from the title */
    }
}


@media (max-width: 768px) {
    .hamburger-menu {
        display: flex;
    }

    /* Fix for Hero Button on Mobile */
    .hero .cta-button {
        font-size: 1em; /* Make font slightly smaller */
        padding: 15px 20px; /* Reduce side padding */
    }

    nav ul {
        display: none; /* Controlled by JS */
        flex-direction: column;
        justify-content: flex-start; /* Align items to the top */
        position: fixed;
        top: 71px; /* Height of header */
        right: 0;
        width: 100%;
        height: calc(100vh - 71px);
        background-color: var(--white);
        padding-top: 20px;
        gap: 0; /* FIX 1: Reset the gap from the desktop style to 0 */
    }

    nav ul.nav-active {
        display: flex;
    }

    /* --- CORRECTED Mobile Nav Link Styling --- */
    nav ul li {
        width: 100%;
        text-align: center;
        margin: 0; /* Remove the margin from the list item */
        display: flex; /* Use flexbox for centering */
        justify-content: center;
    }

    /* Style for REGULAR links in the mobile nav */
    nav ul li a:not(.cta-button) {
        padding: 12px 0; /* FIX 2: Reduce padding for tighter spacing */
        display: block;  /* Make the entire area clickable */
        width: 100%;
    }

    /* Style for the BUTTON in the mobile nav */
    nav ul li a.cta-button {
        display: inline-block; /* Allow the button to size to its content */
        width: auto; /* Override the 100% width */
        padding: 12px 30px; /* Give it proper button padding */
        margin-top: 15px; /* Add some space above the button */
        color: var(--white) !important; /* Ensure text is white */
    }

    .hero h1 { font-size: 2.5em; }
    .section-title { font-size: 2em; }

    /* --- REVISED: Vertical Timeline on Mobile --- */
    .how-it-works-container {
        flex-direction: column;
        align-items: center;
        gap: 40px;
    }

    .step {
        max-width: 350px;
    }

    .how-it-works-container::before {
        /* Hide horizontal line on mobile */
        display: none;
    }
}