@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,300..900;1,300..900&display=swap');

/* ==========================================================================
   1. VARIABLES & RESET GLOBAL
   ========================================================================== */
:root {
    --brand: #9000bf;
    --brand-glow: rgba(144, 0, 191, 0.5);
    --brand-accent: #d94dff;
    --bg-dark: #0a0a0c;
    --bg-glass: rgba(20, 8, 26, 0.75);
    --border-glass: rgba(144, 0, 191, 0.2);
    --border-strong: rgba(144, 0, 191, 0.5);
    --text-muted: rgba(255, 255, 255, 0.65);
}

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

html {
    scrollbar-width: none;
}

html::-webkit-scrollbar {
    display: none;
}

body {
    font-family: "Rubik", sans-serif;
    background: var(--bg-dark);
    color: #f0f0f2;
    padding-top: 72px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* Transiciones de Vista nativas */
::view-transition-old(root) {
    animation: fade-out 0.2s ease forwards;
}

::view-transition-new(root) {
    animation: fade-in 0.3s ease forwards;
}

@keyframes fade-out {
    to { opacity: 0; }
}

@keyframes fade-in {
    from { opacity: 0; }
}

/* ==========================================================================
   2. HEADER & NAVEGACIÓN
   ========================================================================== */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 72px;
    z-index: 100;
    background: var(--bg-glass);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid var(--border-glass);
}

.header-inner {
    max-width: 1280px;
    height: 100%;
    margin: 0 auto;
    padding: 0 32px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    column-gap: 24px;
}

.top-header-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    justify-self: start;
}

.top-header-logo {
    height: 34px;
    width: auto;
    flex-shrink: 0;
}

.top-header-nav {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-self: center;
}

.top-nav-item {
    background: transparent;
    border: none;
    font-family: "Roboto Mono", monospace;
    color: rgba(255, 255, 255, 0.65);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 9px 18px;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.top-nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.top-nav-item:active {
    transform: scale(0.94);
}

.top-nav-item.active {
    color: #fff;
    background: var(--brand);
    box-shadow: 0 0 16px var(--brand-glow);
}

/* Ocultar botón móvil por defecto en PC */
.menu-toggle {
    display: none !important;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 6px;
    justify-self: end;
}

/* Versión móvil (solo cuando la pantalla mide 768px o menos) */
@media (max-width: 768px) {
    .top-header-nav {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 72px;
        left: 0;
        width: 100%;
        background: #0a0a0c;
        border-bottom: 1px solid var(--brand);
        padding: 24px 0;
        gap: 16px;
        box-shadow: 0 16px 32px rgba(0, 0, 0, 0.85);
    }

    .top-header-nav.is-active {
        display: flex;
    }
}

/* ==========================================================================
   3. SECCIÓN HERO & CUENTA REGRESIVA
   ========================================================================== */
.hero {
    position: relative;
    height: calc(100vh - 72px);
    overflow: hidden;
    display: flex;
    align-items: center;
    z-index: 4;
    background: var(--bg-dark);
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(10, 10, 12, 0.92) 10%, rgba(10, 10, 12, 0.45) 60%, rgba(10, 10, 12, 0.75) 100%),
        linear-gradient(180deg, rgba(144, 0, 191, 0.28), rgba(10, 10, 12, 0.6));
    mix-blend-mode: normal;
}

.hero-shape {
    position: absolute;
    z-index: 1;
    pointer-events: none;
}

.hero-shape-1 {
    top: -10%;
    right: -8%;
    width: 420px;
    height: 420px;
    background: linear-gradient(135deg, var(--brand), transparent 70%);
    opacity: 0.35;
    clip-path: polygon(30% 0%, 100% 0%, 100% 70%, 60% 100%, 0% 60%);
    filter: blur(2px);
}

.hero-shape-2 {
    bottom: -15%;
    right: 10%;
    width: 260px;
    height: 260px;
    background: var(--brand);
    opacity: 0.18;
    clip-path: polygon(20% 100%, 0% 30%, 60% 0%, 100% 50%, 70% 100%);
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 60px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}

.hero-text-col {
    flex-shrink: 0;
}

.hero-title {
    font-size: clamp(38px, 6vw, 72px);
    font-weight: 800;
    line-height: 1.05;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #fff;
    margin-bottom: 24px;
    max-width: 560px;
}

.hero-subtitle {
    font-family: "Roboto Mono", monospace;
    font-size: 17px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.65);
    max-width: 460px;
    margin-bottom: 40px;
}

.hero-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.hero-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 16px 34px 16px 28px;
    font-family: "Roboto Mono", monospace;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-decoration: none;
    clip-path: polygon(0 0, 100% 0, 88% 100%, 0% 100%);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.hero-btn:active {
    transform: scale(0.96);
}

.hero-btn-primary {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 0 20px var(--brand-glow);
}

.hero-btn-primary:hover {
    box-shadow: 0 0 30px rgba(144, 0, 191, 0.8);
    filter: brightness(1.1);
}

.hero-btn-secondary {
    background: #fff;
    color: var(--bg-dark);
}

.hero-btn-secondary:hover {
    background: #e8d9ee;
}

.hero-scroll-hint {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    width: 24px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    display: flex;
    justify-content: center;
    padding-top: 8px;
}

.hero-scroll-hint span {
    width: 4px;
    height: 8px;
    background: var(--brand);
    border-radius: 2px;
    animation: scroll-bounce 1.6s ease infinite;
}

@keyframes scroll-bounce {
    0%, 100% { transform: translateY(0); opacity: 1; }
    50% { transform: translateY(10px); opacity: 0.3; }
}

.hero-countdown {
    flex-shrink: 0;
    background: var(--bg-glass);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid rgba(144, 0, 191, 0.35);
    border-radius: 12px;
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.hero-countdown-label {
    font-family: "Roboto Mono", monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--brand-accent);
    margin-bottom: 6px;
}

.hero-countdown-event {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 18px;
}

.hero-countdown-timer {
    display: flex;
    align-items: center;
    gap: 10px;
}

.countdown-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 48px;
    background: rgba(144, 0, 191, 0.1);
    border: 1px solid rgba(144, 0, 191, 0.3);
    border-radius: 6px;
    padding: 10px 6px;
    clip-path: polygon(0 0, 100% 0, 100% 85%, 85% 100%, 0 100%);
}

.countdown-number {
    font-family: "Roboto Mono", monospace;
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.countdown-unit-label {
    font-family: "Roboto Mono", monospace;
    font-size: 9px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 6px;
}

.countdown-sep {
    font-family: "Roboto Mono", monospace;
    font-size: 20px;
    font-weight: 700;
    color: rgba(144, 0, 191, 0.5);
    padding-bottom: 14px;
}

/* ==========================================================================
   4. SECCIÓN MARQUEE (SPONSORS / PARTNERS)
   ========================================================================== */
.marquee-section {
    width: 100%;
    padding: 24px 0;
    background: var(--bg-glass);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border-bottom: 1px solid var(--border-glass);
    overflow: hidden;
    position: relative;
}

.marquee-section::before,
.marquee-section::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 120px;
    z-index: 2;
    pointer-events: none;
}

.marquee-section::before {
    left: 0;
    background: linear-gradient(90deg, var(--bg-dark), transparent);
}

.marquee-section::after {
    right: 0;
    background: linear-gradient(270deg, var(--bg-dark), transparent);
}

.marquee-track {
    display: flex;
    width: max-content;
    animation: marquee-scroll 15s linear infinite;
}

.marquee-track:hover {
    animation-play-state: paused;
}

@keyframes marquee-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

.marquee-group {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.partner-logo {
    display: inline-flex;
    align-items: center;
    padding: 0 40px;
    cursor: pointer;
}

.partner-logo img {
    height: 22px;
    width: auto;
    filter: grayscale(1) brightness(1.6);
    opacity: 0.6;
    transition: filter 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
}

.partner-logo:hover img {
    filter: grayscale(0) brightness(1);
    opacity: 1;
    transform: scale(1.05);
}

.marquee-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(144, 0, 191, 0.5);
    flex-shrink: 0;
}

/* ==========================================================================
   5. TÍTULOS Y TIMELINE
   ========================================================================== */
.page-title,
.drivers-title,
.garage-title,
.gallery-title,
.contact-title,
.timeline-title {
    font-size: clamp(38px, 5.5vw, 64px);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #fff;
    text-align: center;
    position: relative;
    padding: 60px 24px 20px;
}

.timeline-title-highlight {
    position: relative;
    display: inline-block;
    background: linear-gradient(90deg, var(--brand), var(--brand-accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.timeline-title-highlight::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -8px;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--brand), var(--brand-accent));
    border-radius: 3px;
    box-shadow: 0 0 18px rgba(144, 0, 191, 0.85);
    animation: drawUnderline 0.9s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    animation-delay: 0.2s;
}

@keyframes drawUnderline {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

.timeline-section {
    position: relative;
    scroll-snap-type: y proximity;
}

.timeline-line {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(144, 0, 191, 0.05),
        rgba(144, 0, 191, 0.35) 10%,
        rgba(144, 0, 191, 0.35) 90%,
        rgba(144, 0, 191, 0.05)
    );
    transform: translateX(-50%);
    z-index: 1;
    pointer-events: none;
}

.timeline-item {
    position: relative;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 60px;
    padding: 40px 60px;
    z-index: 2;
    max-width: 1280px;
    margin: 0 auto;
}

.timeline-col {
    flex: 1;
    min-width: 0;
}

.timeline-text {
    text-align: right;
}

.timeline-date {
    display: inline-block;
    font-family: "Roboto Mono", monospace;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--brand-accent);
    background: rgba(144, 0, 191, 0.12);
    border: 1px solid rgba(144, 0, 191, 0.4);
    padding: 6px 18px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.timeline-text h3 {
    font-size: clamp(24px, 3.4vw, 36px);
    color: #fff;
    margin-bottom: 18px;
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.15;
}

.timeline-text p {
    font-size: 15px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.6);
    margin-left: auto;
    max-width: 440px;
}

.timeline-dot {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg-dark);
    border: 2px solid rgba(144, 0, 191, 0.4);
    opacity: 0.4;
    transform: scale(0.7);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.timeline-image {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.timeline-image img {
    width: 100%;
    max-width: 480px;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border-glass);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.timeline-item:nth-of-type(even) {
    flex-direction: row-reverse;
}

.timeline-item:nth-of-type(even) .timeline-text {
    text-align: left;
}

.timeline-item:nth-of-type(even) .timeline-text p {
    margin-left: 0;
    margin-right: auto;
}

.timeline-item:nth-of-type(even) .timeline-image {
    justify-content: flex-end;
}

.timeline-text,
.timeline-image {
    opacity: 0;
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.timeline-item:nth-of-type(odd) .timeline-text { transform: translateX(30px); }
.timeline-item:nth-of-type(odd) .timeline-image { transform: translateX(-30px); }
.timeline-item:nth-of-type(even) .timeline-text { transform: translateX(-30px); }
.timeline-item:nth-of-type(even) .timeline-image { transform: translateX(30px); }

.timeline-item.active .timeline-text,
.timeline-item.active .timeline-image {
    opacity: 1;
    transform: translateX(0);
}

.timeline-item.active .timeline-dot {
    background: var(--brand);
    border-color: var(--brand-accent);
    box-shadow: 0 0 24px rgba(144, 0, 191, 0.9);
    opacity: 1;
    transform: scale(1);
}

/* ==========================================================================
   6. GRIDS DE CONTENIDO (EVENTS, ROSTER, GARAGE, GALLERY)
   ========================================================================== */
.events-section,
.page-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px 80px;
    width: 100%;
}

.events-grid,
.roster-grid,
.garage-grid,
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.event-card,
.card {
    position: relative;
    background: rgba(144, 0, 191, 0.04);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 24px;
    clip-path: polygon(0 0, 100% 0, 100% 92%, 92% 100%, 0 100%);
    transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.event-card:hover,
.card:hover {
    border-color: var(--border-strong);
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(144, 0, 191, 0.2);
}

.event-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.event-series,
.badge {
    font-family: "Roboto Mono", monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--brand-accent);
    background: rgba(144, 0, 191, 0.12);
    border: 1px solid rgba(144, 0, 191, 0.4);
    padding: 5px 12px;
    border-radius: 4px;
    text-transform: uppercase;
}

.event-date {
    font-family: "Roboto Mono", monospace;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
}

.event-track,
.card-title {
    font-size: 20px;
    font-weight: 800;
    text-transform: uppercase;
    color: #fff;
    margin-bottom: 8px;
}

.event-desc,
.card-subtitle {
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 20px;
}

/* ==========================================================================
   7. FORMULARIOS Y PANELES (CONTACT / ADMIN)
   ========================================================================== */
.contact-container,
.admin-panel-container,
.form-card {
    max-width: 680px;
    margin: 0 auto;
    background: rgba(20, 8, 26, 0.6);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 36px;
    backdrop-filter: blur(16px);
}

.form-group {
    margin-bottom: 22px;
}

.form-label {
    display: block;
    font-family: "Roboto Mono", monospace;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    color: var(--brand-accent);
}

.form-control {
    width: 100%;
    padding: 14px 18px;
    background: #050507;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #fff;
    font-family: "Rubik", sans-serif;
    font-size: 15px;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 14px var(--brand-glow);
}

textarea.form-control {
    min-height: 140px;
    resize: vertical;
}

.btn-primary {
    width: 100%;
    padding: 16px;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-family: "Roboto Mono", monospace;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 0 20px var(--brand-glow);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--brand-accent);
    box-shadow: 0 0 30px rgba(217, 77, 255, 0.6);
}

/* ==========================================================================
   8. FOOTER
   ========================================================================== */
.site-footer {
    background: #0e0a11;
    border-top: 1px solid var(--border-glass);
    padding: 60px 32px 0;
    margin-top: auto;
}

.footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    padding-bottom: 40px;
}

.footer-brand-logo {
    height: 40px;
    width: auto;
    margin-bottom: 14px;
}

.footer-brand-desc {
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.5);
    max-width: 380px;
    text-align: center;
}

.footer-socials {
    display: flex;
    gap: 12px;
}

.footer-social-item {
    width: 38px;
    height: 38px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    transition: all 0.25s ease;
}

.footer-social-item:hover {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    box-shadow: 0 0 16px var(--brand-glow);
    transform: translateY(-2px);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 20px 0;
    text-align: center;
}

.footer-copyright {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
}

/* ==========================================================================
   9. MEDIA QUERIES (RESPONSIVE)
   ========================================================================== */
@media (max-width: 900px) {
    .hero-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 32px;
    }

    .hero-countdown {
        align-self: stretch;
    }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block !important;
    }

    .header-inner,
    .header-container {
        padding: 0 20px;
    }

    .top-header-nav {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 72px;
        left: 0;
        width: 100%;
        background: #0a0a0c;
        border-bottom: 1px solid var(--brand);
        padding: 24px 0;
        gap: 16px;
        box-shadow: 0 16px 32px rgba(0, 0, 0, 0.85);
    }

    .top-header-nav.is-active {
        display: flex;
    }

    .top-nav-item,
    .nav-link {
        font-size: 15px;
        padding: 10px 24px;
    }

    .nav-btn-contact {
        width: 80%;
        text-align: center;
    }

    .timeline-line {
        left: 20px;
    }

    .timeline-item,
    .timeline-item:nth-of-type(even) {
        flex-direction: column;
        padding: 28px 16px 28px 48px;
        gap: 20px;
    }

    .timeline-text,
    .timeline-item:nth-of-type(even) .timeline-text {
        text-align: left;
    }

    .timeline-text p,
    .timeline-item:nth-of-type(even) .timeline-text p {
        margin: 0;
    }

    .events-grid,
    .roster-grid,
    .garage-grid,
    .gallery-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }

    .contact-container,
    .admin-panel-container {
        width: 95%;
        padding: 24px 18px;
    }
}