:root {
    --color-black: #050505;
    --color-dark-grey: #0a0a0a;
    --color-gold: #d4af37;
    --color-gold-light: #f4d06f;
    --color-gold-glow: rgba(212, 175, 55, 0.4);
    --color-gold-transparent: rgba(212, 175, 55, 0.1);
    --color-white: #ffffff;
    --color-text-grey: #a0a0a0;
    --glass-bg: rgba(15, 15, 15, 0.7);
    --glass-border: rgba(212, 175, 55, 0.2);
    --color-accent-glow: radial-gradient(circle, rgba(212, 175, 55, 0.15) 0%, transparent 70%);

    --font-heading: 'Oswald', sans-serif;
    --font-body: 'Montserrat', sans-serif;

    --transition-fast: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    width: 100%;
}

body {
    background-color: var(--color-black);
    background-image:
        radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.15) 0%, transparent 50%),
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 100% 100%, 40px 40px, 40px 40px;
    color: var(--color-white);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 2px;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-fast);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

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

.section-title {
    font-size: 3.5rem;
    color: var(--color-white);
    text-align: center;
    margin-bottom: 5rem;
    position: relative;
    /* Removed default opacity 0 to ensure visibility without JS */
    text-transform: uppercase;
    font-weight: 700;
}

.section-title span {
    color: var(--color-gold);
    text-shadow: 0 0 20px var(--color-gold-glow);
}

.section-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
    margin: 1.5rem auto 0;
}

.btn {
    display: inline-block;
    padding: 14px 36px;
    border: 1px solid var(--glass-border);
    color: var(--color-white);
    font-family: var(--font-heading);
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    background: var(--color-gold-transparent);
    backdrop-filter: blur(5px);
    transition: var(--transition-fast);
    border-radius: 4px;
    letter-spacing: 1px;
}

.btn:hover {
    background: var(--color-gold);
    color: var(--color-black);
    box-shadow: 0 0 30px var(--color-gold-glow);
    border-color: var(--color-gold);
    transform: translateY(-2px);
}

/* Animations */
@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-on-scroll {
    opacity: 1;
    /* Safety: Visible by default */
    transform: none;
    transition: none;
}

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

/* Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(5, 5, 5, 0.85);
    padding: 20px 0;
    z-index: 1000;
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--glass-border);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.logo-container img {
    height: 50px;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--color-white);
}

.logo-text span {
    color: var(--color-gold);
}

.nav-links {
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-links li {
    position: relative;
}

.nav-links a {
    color: #aaa;
    /* Softer grey for inactive */
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    /* Bold as per image */
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 5px 0;
    transition: all 0.3s ease;
    font-family: var(--font-heading);
    /* Ensure standard heading font */
}

/* Hover and Active Text Color */
.nav-links a:hover,
.nav-links a.active {
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* The Glowing Golden Bar */
.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -6px;
    /* Slightly lower */
    left: 50%;
    transform: translateX(-50%);
    /* Center it */
    width: 0;
    height: 3px;
    /* Softer thickness */
    /* Gradient specifically creating the 'bar' look with faded edges */
    background: linear-gradient(90deg, transparent 0%, var(--color-gold) 15%, var(--color-gold) 85%, transparent 100%);
    transition: width 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: 0 0 8px var(--color-gold);
    /* The Glow */
    border-radius: 2px;
    opacity: 0;
}

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

.menu-toggle {
    display: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--color-gold);
}

/* Hero Section */
.hero {
    height: 100vh;
    min-height: 100vh;
    /* Fallback for mobile browsers */
    min-height: 100dvh;
    background:
        radial-gradient(circle at 50% 50%, rgba(212, 175, 55, 0.1) 0%, transparent 70%),
        linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.9)), url('assets/hero_bg.png');
    background-size: cover, cover, cover;
    background-position: center;
    background-attachment: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-top: 80px;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 200px;
    background: linear-gradient(transparent, var(--color-black));
}

.hero-content {
    max-width: 900px;
    z-index: 2;
}

.hero-logo-large {
    height: 180px;
    margin: 0 auto 2.5rem;
    filter: drop-shadow(0 0 20px var(--color-gold-glow));
    animation: goldShine 4s infinite alternate ease-in-out;
}

.hero-title {
    font-size: 5rem;
    margin-bottom: 1.5rem;
    line-height: 1;
    font-weight: 700;
    letter-spacing: -2px;
    background: linear-gradient(to bottom, #fff, #aaa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
}

.hero-motto {
    font-size: 1.4rem;
    color: var(--color-text-grey);
    margin-bottom: 3.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* History Intro */
.history-intro {
    position: relative;
    min-height: 80vh;
    height: auto;
    background: url('assets/bilbao_bg.png') no-repeat center center/cover;
    background-attachment: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-top: 100px;
    padding-bottom: 50px;

    /* Fix overlap */
}

.history-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    /* Dark overlay */
    z-index: 1;
}

.history-text-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    padding: 0 20px;
}

.history-text-content h2 {
    font-size: 4rem;
    color: var(--color-gold);
    margin-bottom: 2rem;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.8);
}

.history-text-content p {
    font-size: 1.5rem;
    color: var(--color-white);
    margin-bottom: 1.5rem;
    font-weight: 300;
}

.highlight-text {
    color: var(--color-gold);
    font-weight: bold;
    text-transform: uppercase;
}

/* History (Timeline) */
.history {
    padding: 100px 0;
    background: var(--color-dark-grey);
}

.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.timeline::after {
    content: '';
    position: absolute;
    width: 2px;
    background: var(--color-gold);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -1px;
}

.timeline-item {
    padding: 10px 40px;
    position: relative;
    background-color: inherit;
    width: 50%;
}

.timeline-item::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    right: -10px;
    background-color: var(--color-black);
    border: 4px solid var(--color-gold);
    top: 15px;
    border-radius: 50%;
    z-index: 1;
}

.left {
    left: 0;
}

.right {
    left: 50%;
}

.right::after {
    left: -10px;
}

.timeline-content {
    padding: 30px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    position: relative;
    transition: var(--transition-smooth);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.timeline-content:hover {
    transform: translateY(-5px) scale(1.01);
    box-shadow: 0 15px 40px rgba(212, 175, 55, 0.15);
    border-color: var(--color-gold);
}

.timeline-icon {
    position: absolute;
    right: 15px;
    bottom: -10px;
    font-size: 5rem;
    color: var(--color-gold);
    opacity: 0.1;
    transform: rotate(-15deg);
    transition: var(--transition-smooth);
}

.timeline-content:hover .timeline-icon {
    opacity: 0.2;
    transform: rotate(0deg) scale(1.1);
}

.year {
    color: var(--color-gold);
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Teams */
.teams {
    padding: 100px 0;
}

.tabs {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 3rem;
}

.tab-btn {
    padding: 10px 30px;
    background: var(--color-dark-grey);
    border: 1px solid var(--color-gold);
    color: var(--color-white);
    cursor: pointer;
    font-family: var(--font-heading);
    transition: var(--transition-fast);
}

.tab-btn.active,
.tab-btn:hover {
    background: var(--color-gold);
    color: var(--color-black);
}

.team-grid {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 100px 30px;
    /* High row gap to ensure awards don't hit the next card */
}

.team-grid.active {
    display: grid;
    min-height: 200px;
    /* Prevent collapse if empty */
    width: 100%;
}

.player-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    overflow: visible;
    /* Fix: Allow awards to hang outside */
    position: relative;
    transition: var(--transition-smooth);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.player-card:hover {
    border-color: var(--color-gold);
    transform: translateY(-10px);
    box-shadow: 0 20px 50px rgba(212, 175, 55, 0.2);
    z-index: 500;
    /* Ensure hovered card and its awards are ABOVE everything else */
}

.player-img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    background-color: #222;
    border-radius: 12px 12px 0 0;
    /* Keep top corners rounded without overflow:hidden */
    transition: var(--transition-smooth);
}

.player-info {
    padding: 20px;
    text-align: center;
    border-radius: 0 0 12px 12px;
    /* Keep bottom corners rounded */
}

.player-name {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.player-pos {
    color: var(--color-gold);
    font-size: 0.9rem;
}

/* Individual Awards Hanging from Player Card */
.player-awards-container {
    position: absolute;
    bottom: -35px;
    /* Hang further down */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    gap: 15px;
    z-index: 1000;
    /* Extremely high to stay on top */
    width: 95%;
    pointer-events: none;
}

.award-hanging {
    width: 45px;
    /* Bigger medals */
    height: 45px;
    pointer-events: auto;
    /* Enable hover/tooltips for medals specifically */
    background: #111;
    border: 2px solid var(--color-gold);
    /* Thicker gold border */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-gold);
    font-size: 1.1rem;
    /* Bigger icon */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.9), 0 0 15px var(--color-gold-glow);
    position: relative;
    animation: hangingGoldGlow 3s infinite alternate ease-in-out;
    background: radial-gradient(circle at center, #222 0%, #050505 100%);
}

.award-hanging i {
    filter: drop-shadow(0 0 2px rgba(212, 175, 55, 0.5));
}

/* Trigger valuable shimmer/flash when card is hovered */
.player-card:hover .award-hanging,
.player-card:active .award-hanging {
    animation: hangingGoldGlow 3s infinite alternate ease-in-out, goldPulseValuable 1.5s infinite ease-in-out !important;
}

@keyframes goldPulseValuable {

    0%,
    100% {
        filter: brightness(1) contrast(1);
        transform: scale(1) translateY(0);
    }

    50% {
        filter: brightness(1.8) contrast(1.2);
        box-shadow: 0 0 30px var(--color-gold), 0 0 50px var(--color-gold);
        transform: scale(1.1) translateY(4px);
    }
}

.award-multiplier {
    position: absolute;
    top: -8px;
    right: -12px;
    background: var(--color-gold);
    background: linear-gradient(135deg, var(--color-gold-light), var(--color-gold));
    color: var(--color-black);
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 10px;
    border: 1px solid #000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

/* Responsive Adjustments for Awards */
@media (max-width: 768px) {
    .team-grid {
        gap: 110px 15px;
        /* Triple spacing on mobile to clear the MEDAL + TEXT + HOVER labels */
        padding-bottom: 70px;
    }

    .player-card {
        margin-bottom: 90px;
        /* Extra margin between cards in mobile */
    }

    .player-awards-container {
        bottom: -30px;
        /* More space on mobile to ensure it doesn't get cut by next card */
        z-index: 100 !important;
        /* Ensure it stays above everything */
    }

    .award-hanging {
        width: 40px;
        /* Slightly smaller on mobile to fit 3 if needed */
        height: 40px;
    }

    .award-hanging::after {
        font-size: 0.55rem;
        bottom: -16px;
    }
}

/* Label for Award Type (MVP, etc) */
.award-hanging::after {
    content: attr(data-label);
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--color-gold);
    font-size: 0.65rem;
    font-weight: 800;
    text-shadow: 0 0 5px #000;
    letter-spacing: 0.5px;
    white-space: nowrap;
    font-family: var(--font-heading);
}

@keyframes hangingGoldGlow {
    0% {
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.8), 0 0 5px var(--color-gold-glow);
        transform: translateY(0) rotate(-2deg);
    }

    100% {
        box-shadow: 0 6px 15px rgba(0, 0, 0, 0.9), 0 0 15px var(--color-gold-glow);
        transform: translateY(6px) rotate(2deg);
        /* "Hanging" motion */
    }
}

/* Award Tooltip */
.award-hanging::before {
    content: attr(data-title);
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.95);
    color: var(--color-gold);
    font-size: 0.6rem;
    padding: 4px 10px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--color-gold);
    pointer-events: none;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.award-hanging:hover::before,
.player-card:hover .award-hanging::before,
.player-card:active .award-hanging::before {
    opacity: 1;
    visibility: visible;
    bottom: -50px;
    /* Adjust specifically to be readable */
    transform: translateX(-50%) scale(1.1);
}

/* Calendar & Results */
.calendar-results {
    padding: 100px 0;
    background: var(--color-dark-grey);
}

.match-list {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    /* Changed to row for carousel */
    gap: 20px;
    overflow-x: auto;
    /* Allow scrolling */
    scroll-behavior: smooth;
    padding-bottom: 20px;
    /* Hide scrollbar */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE 10+ */
}

.match-list::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.match-item {
    min-width: 320px;
    flex-shrink: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    transition: var(--transition-fast);
    text-align: center;
    gap: 15px;
}

.match-item:hover {
    border-color: var(--color-gold);
    background: rgba(212, 175, 55, 0.05);
}

/* Pulse Animation */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(212, 175, 55, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0);
    }
}

@keyframes goldShine {
    0% {
        filter: drop-shadow(0 0 5px rgba(212, 175, 55, 0.3));
        transform: scale(1);
    }

    100% {
        filter: drop-shadow(0 0 20px rgba(212, 175, 55, 0.8));
        transform: scale(1.05);
    }
}

.btn.pulse-effect {
    animation: pulse 2s infinite;
}

.match-item {
    background: var(--color-black);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--color-gold);
    transition: var(--transition-fast);
}

.match-item:hover {
    background: #0f0f0f;
}

.match-date {
    font-size: 0.9rem;
    color: var(--color-text-grey);
    width: 100px;
}

.match-teams {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    font-family: var(--font-heading);
    font-size: 1.2rem;
}

.vs {
    color: var(--color-gold);
    font-size: 0.9rem;
}

.match-result {
    width: 80px;
    text-align: right;
    font-weight: bold;
}

.win {
    color: #2ecc71;
}

.loss {
    color: #e74c3c;
}

.draw {
    color: #f1c40f;
}

/* NEW MATCHES SECTION STYLES */
.matches-section {
    padding: 100px 0;
    background: var(--color-black);
}

.matches-container {
    max-width: 1000px;
    margin: 0 auto;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.matches-tabs {
    display: flex;
    border-bottom: 1px solid var(--glass-border);
    padding: 15px 20px;
    gap: 15px;
}

.m-tab-btn {
    padding: 10px 20px;
    border: 1px solid var(--glass-border);
    background: transparent;
    color: var(--color-text-grey);
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-heading);
    font-weight: 600;
    transition: var(--transition-fast);
}

.m-tab-btn.active {
    background: var(--color-white);
    color: var(--color-black);
    border-color: var(--color-white);
}

.match-items-container {
    padding: 10px 0;
}

/* New Match Card Design */
.match-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    margin-bottom: 20px;
    padding: 15px;
    transition: var(--transition-fast);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.match-card:hover {
    background: rgba(255, 255, 255, 0.07);
    transform: translateY(-3px);
    border-color: var(--color-gold);
}

.m-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--color-text-grey);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

.m-jornada {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.m-card-main {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 20px;
}

.m-team {
    display: flex;
    align-items: center;
    gap: 15px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
}

.m-home {
    justify-content: flex-end;
    text-align: right;
}

.m-away {
    justify-content: flex-start;
    text-align: left;
}

.m-logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.5));
}

.m-score-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.m-score {
    background: var(--color-gold);
    color: var(--color-dark);
    padding: 5px 15px;
    border-radius: 6px;
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 1.3rem;
    min-width: 80px;
    text-align: center;
}

.m-time-large {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-grey);
}

.m-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.m-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.m-scorers {
    font-size: 0.8rem;
    color: var(--color-text-grey);
    max-width: 400px;
    line-height: 1.4;
}

.m-mvp {
    font-size: 0.85rem;
    color: var(--color-gold);
    font-weight: 700;
}

.m-actions {
    display: flex;
    gap: 12px;
}

.m-action-btn {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-white);
    transition: 0.3s;
}

.m-action-btn:hover {
    background: var(--color-gold);
    color: var(--color-dark);
    transform: scale(1.1);
}

.view-more-container {
    padding: 20px;
    text-align: center;
    border-top: 1px solid var(--glass-border);
}

.view-more-btn {
    background: transparent;
    border: none;
    color: var(--color-text-grey);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
    font-size: 0.9rem;
}

.view-more-btn:hover {
    color: var(--color-white);
}


/* Responsive Adjustments */
@media (max-width: 768px) {
    .section-title {
        font-size: 2.5rem;
        margin-bottom: 3rem;
    }

    .section-title::after {
        width: 60px;
    }

    /* Reduce section padding on mobile */
    .history,
    .teams,
    .board,
    .matches-section,
    .ranking-section,
    .gallery,
    .sponsors-contact {
        padding: 50px 0;
    }

    /* Match Card Mobile Styles */
    .match-card {
        padding: 20px;
        gap: 15px;
    }

    .m-card-main {
        display: flex;
        /* Override grid */
        flex-direction: column;
        gap: 15px;
        align-items: center;
        width: 100%;
    }

    .m-team {
        width: 100%;
        justify-content: center !important;
        /* Force center for both home and away */
        text-align: center !important;
        flex-direction: row;
        /* Keep logo and text side-by-side or column? Let's try row first but centered */
        gap: 15px;
    }

    .m-home {
        order: 1;
        /* Home first */
    }

    .m-score-container {
        order: 2;
        /* Score middle */
        margin: 10px 0;
    }

    .m-away {
        order: 3;
        /* Away last */
    }

    .m-card-footer {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }

    .m-details {
        text-align: center;
        width: 100%;
        align-items: center;
    }

    .m-scorers {
        max-width: 100%;
        text-align: center;
    }

    .m-actions {
        justify-content: center;
        border-top: 1px solid var(--glass-border);
        padding-top: 15px;
        width: 100%;
    }
}

/* Gallery */
.gallery {
    padding: 100px 0;
}

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

.gallery-item {
    position: relative;
    height: 250px;
    overflow: hidden;
    cursor: pointer;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition-fast);
}

.gallery-item:hover .overlay {
    opacity: 1;
}

.play-icon {
    font-size: 3rem;
    color: var(--color-white);
}

/* Sponsors & Contact */
.sponsors-contact {
    padding: 100px 0;
    background: var(--color-dark-grey);
    text-align: center;
}

.sponsors-intro {
    max-width: 800px;
    margin: 0 auto 3rem;
}

.sponsors-intro p {
    font-size: 1.2rem;
    color: var(--color-white);
    margin-bottom: 2rem;
}

.sponsor-grid {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
    margin-bottom: 4rem;
    align-items: center;
}

.sponsor-logo {
    height: 80px;
    opacity: 0.7;
    transition: var(--transition-fast);
    filter: grayscale(100%);
}

.sponsor-logo:hover {
    opacity: 1;
    filter: grayscale(0%) drop-shadow(0 0 10px rgba(212, 175, 55, 0.5));
    transform: scale(1.1);
}

.action-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    padding: 50px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.action-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.1) 0%, transparent 70%);
    animation: rotate 10s linear infinite;
    pointer-events: none;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.contact-form {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    /* Slightly lighter than black */
    border: 1px solid #333;
    color: var(--color-white);
    font-family: var(--font-body);
    transition: var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-gold);
    background: rgba(0, 0, 0, 0.8);
}

/* Shiny Button */
.btn-shiny {
    position: relative;
    overflow: hidden;
    background: var(--color-gold);
    color: var(--color-black);
    border: none;
    z-index: 1;
}

.btn-shiny::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    bottom: -50%;
    left: -50%;
    background: linear-gradient(to bottom, rgba(229, 172, 142, 0), rgba(255, 255, 255, 0.5) 50%, rgba(229, 172, 142, 0));
    transform: rotateZ(60deg) translate(-5em, 7.5em);
    z-index: -1;
    animation: sheen 3s infinite;
}

@keyframes sheen {
    100% {
        transform: rotateZ(60deg) translate(1em, -9em);
    }
}

/* Footer */
footer {
    padding: 50px 0;
    background: #000;
    border-top: 1px solid #333;
    text-align: center;
}

.social-links {
    margin-bottom: 20px;
}

.social-links a {
    margin: 0 10px;
    font-size: 1.2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .logo-text {
        font-size: 1.1rem;
    }

    .logo-container {
        gap: 8px;
    }

    .logo-container img {
        height: 40px;
    }

    header {
        padding: 15px 0;
    }

    .hero-title {
        font-size: 2.2rem;
        line-height: 1.2;
    }

    .hero-motto {
        font-size: 1rem;
        padding: 0 15px;
    }

    .hero-logo-large {
        height: 120px;
    }

    .nav-links {
        display: none;
    }

    /* Add toggle logic later */
    .menu-toggle {
        display: block;
        font-size: 1.5rem;
    }

    .timeline::after {
        left: 20px;
    }

    .timeline-item {
        width: 100%;
        padding-left: 50px;
        padding-right: 15px;
    }

    .timeline-item::after {
        left: 10px;
    }

    .right {
        left: 0;
    }

    .nav-links.active {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 80px;
        left: 0;
        width: 100%;
        background: var(--color-black);
        padding: 20px;
        border-bottom: 1px solid var(--color-gold);
    }

    .match-item {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    /* Mobile Team Grid - 2 Columns for elegance */
    .team-grid.active {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
    }

    .hidden-on-mobile {
        display: none !important;
    }

    /* Hide button if the preceding team grid is NOT active (hidden) */
    .team-grid:not(.active)+.expand-btn-container {
        display: none !important;
    }
}

/* Ensure button is hidden on desktop AND everything is shown */
@media (min-width: 769px) {
    .expand-btn-container {
        display: none !important;
    }

    .hidden-on-mobile {
        display: block !important;
    }
}

/* Expand Button Styles */
.expand-btn-container {
    width: 100%;
    text-align: center;
    margin-top: 20px;
    display: none;
    /* Hidden by default */
}

.expand-btn-container.active {
    display: block;
}

.expand-btn {
    background: transparent;
    border: 1px solid var(--color-gold);
    color: var(--color-gold);
    padding: 10px 25px;
    border-radius: 30px;
    cursor: pointer;
    font-family: var(--font-heading);
    text-transform: uppercase;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.expand-btn:hover {
    background: var(--color-gold);
    color: var(--color-black);
}

/* Gallery & Lightbox Styles */
.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    background: var(--color-dark-grey);
    border: 1px solid var(--glass-border);
}

.gallery-item img {
    height: 300px;
    width: 100%;
    object-fit: cover;
    transition: var(--transition-smooth);
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-caption-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 15px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    color: var(--color-white);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Lightbox Modal */
.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 85%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-content img,
.lightbox-content video {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s ease-out;
}

@keyframes zoomIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

#lightbox-caption {
    margin-top: 20px;
    color: var(--color-gold);
    font-family: var(--font-heading);
    font-size: 1.5rem;
    text-align: center;
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    z-index: 10000;
}

.lightbox-close:hover {
    color: var(--color-gold);
    transform: rotate(90deg);
}

/* Classification Table Styles */
.ranking-section {
    padding: 100px 0;
    background: linear-gradient(to bottom, var(--color-black), #0a0a0a);
}

.classification-container {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
}

.ranking-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    color: var(--color-white);
}

.ranking-table th {
    padding: 15px;
    text-align: center;
    color: var(--color-gold);
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--glass-border);
}

.ranking-table th.text-left {
    text-align: left;
}

.ranking-table td {
    padding: 15px;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    transition: var(--transition-fast);
}

.ranking-table tr td:first-child {
    border-radius: 10px 0 0 10px;
    font-weight: bold;
    color: var(--color-gold);
}

.ranking-table tr td:last-child {
    border-radius: 0 10px 10px 0;
}

.ranking-table tr:hover td {
    background: rgba(212, 175, 55, 0.05);
}

/* Highlight specific team */
.ranking-table tr.highlight-team td {
    background: rgba(212, 175, 55, 0.15);
    border-top: 1px solid var(--color-gold);
    border-bottom: 1px solid var(--color-gold);
}

.ranking-table tr.highlight-team td:first-child {
    border-left: 2px solid var(--color-gold);
}

.ranking-table tr.highlight-team td:last-child {
    border-right: 2px solid var(--color-gold);
}

.team-cell {
    display: flex;
    align-items: center;
    gap: 15px;
    text-align: left;
}

.team-logo-small {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.team-name-table {
    font-weight: 600;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none;
    }

    .ranking-table td,
    .ranking-table th {
        padding: 10px 5px;
        font-size: 0.85rem;
    }

    .team-cell {
        gap: 8px;
    }
}

/* --- IMPROVED FILTER BUTTONS --- */
.filter-controls,
.team-filters {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: var(--color-text-grey);
    padding: 10px 25px;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 30px;
    /* Pill shape */
    backdrop-filter: blur(5px);
}

.filter-btn:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--color-gold);
    color: var(--color-white);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: var(--color-gold);
    color: var(--color-black);
    border-color: var(--color-gold);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
    font-weight: bold;
}

/* === FIX HERO OVERLAP === */
.news-hero,
.achievements-hero,
#hero,
.hero {
    padding-top: 100px;
    padding-top: 100px;
}

#hero,
.hero {
    min-height: 100vh;
}

.news-hero,
.achievements-hero {
    min-height: 40vh;
    /* Reduced height for inner pages to avoid huge gaps */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Specific fix for mobile to push content down below fixed header */
@media (max-width: 768px) {

    .news-hero,
    .achievements-hero,
    #hero,
    .hero {
        padding-top: 60px;
        /* Reduced from 140px */
        background-attachment: scroll;
    }

    .hero-title {
        margin-top: 0;
    }
}

/* Audio Control Button */
.audio-control {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--color-gold);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.audio-control:hover {
    transform: scale(1.1);
    background: var(--color-gold);
}

.audio-control i {
    color: var(--color-gold);
    font-size: 1.2rem;
    transition: color 0.3s ease;
}

.audio-control:hover i {
    color: var(--color-black);
}

.audio-control.playing {
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0% {
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(212, 175, 55, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0);
    }
}

/* Join Us Section */
.join-us-section .step-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
    width: 200px;
    text-align: center;
    border: 1px solid #333;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.join-us-section .step-item:hover {
    transform: translateY(-5px);
    border-color: var(--color-gold);
}

.join-us-section p {
    color: #ccc;
    line-height: 1.6;
}

.join-intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

#open-join-modal-btn {
    margin: 0 auto;
}

/* Modal Steps */
.form-step {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

@keyframes pulse-border {
    0% {
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(212, 175, 55, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0);
    }
}

/* --- MODAL STYLES (Fixed) --- */
.modal {
    display: none;
    position: fixed;
    z-index: 10001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    /* Enable scroll if content is tall */
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    /* Centers modal-content more reliably */
    align-items: center;
    justify-content: center;
    padding: 20px;
    /* Safety padding for small screens */
}

/* Hide display:flex by default and only use it when active */
.modal:not([style*="display: block"]) {
    display: none !important;
}

.modal[style*="display: block"] {
    display: flex !important;
}

.modal-content {
    background-color: #111;
    margin: auto;
    /* Centering with flexbox parent */
    padding: 40px 30px;
    border: 1px solid var(--color-gold);
    border-radius: 20px;
    width: 100%;
    max-width: 550px;
    max-height: 90vh;
    /* Don't exceed screen height */
    overflow-y: auto;
    /* Content inside modal is scrollable */
    position: relative;
    box-shadow: 0 0 50px rgba(212, 175, 55, 0.3);
    animation: modalSlideIn 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

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

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #999;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s;
}

.close-modal:hover {
    color: var(--color-gold);
}

.modal-content h2 {
    margin-bottom: 20px;
    text-align: center;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--color-gold);
    font-size: 0.9rem;
    font-family: var(--font-heading);
    letter-spacing: 1px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    background: #000;
    border: 1px solid #333;
    border-radius: 5px;
    color: var(--color-white);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: border-color 0.3s;
    margin-bottom: 15px;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--color-gold);
    outline: none;
}

.form-group small {
    display: block;
    margin-top: -10px;
    margin-bottom: 15px;
    font-size: 0.8rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 20px;
}

/* Row layout for modal inputs */
.form-group.row {
    display: flex;
    gap: 15px;
}

.form-group.row .col {
    flex: 1;
}

/* Mobile Modal Adjustments */
@media (max-width: 768px) {
    .modal {
        padding: 10px;
    }

    .modal-content {
        padding: 40px 20px 30px 20px;
        width: 100%;
        border-radius: 12px;
        max-height: 95vh;
    }

    .form-group.row {
        flex-direction: column;
        gap: 0;
    }

    .close-modal {
        top: 10px;
        right: 15px;
        background: #000;
        width: 35px;
        height: 35px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--color-gold);
    }
}

/* Utility for screen readers */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Magic Text Canvas */
#hero-magic-text canvas {
    pointer-events: none;
}