/* Fonts */
@import url('https://fonts.cdnfonts.com/css/vcr-osd-mono');
@import url('https://fonts.cdnfonts.com/css/pragmatica');

/* CSS Variables */
:root {
    --primary-color: #007F5F;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: 'Courier New', Courier, monospace;
    background-color: #F5F3ED;
    color: #1a1a1a;
    overflow-x: hidden;
    position: relative;
    width: 100%;
    max-width: 100vw;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.4' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    filter: contrast(170%) brightness(1000%);
    opacity: 0.08;
}

/* Banner Styles */
.banner {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    padding: 2px 0;
    position: relative;
    z-index: 10;
    max-width: 100vw;
}

.banner-top {
    background-color: var(--primary-color);
    position: relative;
    transform: rotate(2deg);
    transform-origin: top left;
    width: 120%;
}

.banner-middle {
    background-color: #1a1a1a;
    /* remove grainy effect */
    background-image: none;
    width: 100%;
}

.banner-bottom {
    background-color: var(--primary-color);
    position: relative;
    transform: rotate(-2deg);
    transform-origin: bottom left;
    width: 120%;
}

.banner-text {
    font-family: 'VCR OSD Mono';
    font-weight: 400;
    text-transform: uppercase;
    display: inline-block;
    color: #F5F3ED;
    font-size: 24px;
}

.banner-middle .banner-text {
    animation: scroll 20s linear infinite;
}

.banner-text span {
    margin: 0 6px;
}

@keyframes scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* Join Button */
.join-button-container {
    position: absolute;
    top: 72px;
    left: 82.11px;
    z-index: 100;
}

/* Buttons */
.btn-primary {
    border: 1.22px solid var(--primary-color);
    background-color: transparent;
    color: var(--primary-color);
    padding: 7.66px 28.57px;
    font-family: 'Pragmatica Cond', 'Arial Narrow', sans-serif;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    border-radius: 40.81px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0;
    line-height: 100%;
    white-space: nowrap;
    display: inline-block;
}

.btn-secondary {
    border: 2px solid var(--primary-color);
    background-color: transparent;
    color: var(--primary-color);
    padding: 12px 30px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 25px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary:hover,
.btn-secondary:hover {
    background-color: var(--primary-color);
    color: #F5F3ED;
}

/* Hero Section */
.hero {
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 20px 100px;
    text-align: center;
    position: relative;
    z-index: 10;
}

.hero-video-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    z-index: 1;
    pointer-events: none;
}

.hero-video {
    width: 100%;
    height: auto;
    display: block;
    opacity: 0.9;
}

.hero-title {
    font-family: 'VCR OSD Mono', 'Courier New', monospace;
    font-size: 64px;
    font-weight: 400;
    letter-spacing: 12px;
    color: #1a1a1a;
    margin: 30px 0 60px;
    position: relative;
    z-index: 2;
    text-rendering: optimizeSpeed;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: grayscale;
}

.cube-logo {
    width: 280px;
    height: auto;
    display: block;
    margin: 0 auto;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.main-title {
    font-size: 72px;
    font-weight: bold;
    letter-spacing: 8px;
    margin-bottom: 10px;
    color: #1a1a1a;
}

.subtitle {
    font-size: 18px;
    letter-spacing: 3px;
    margin-bottom: 80px;
    color: #1a1a1a;
}

/* Stats Section */
.stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    flex-wrap: nowrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex-shrink: 1;
}

.stat-number {
    font-family: 'VCR OSD Mono', monospace;
    font-size: 96px;
    color: var(--primary-color);
    line-height: 1;
    letter-spacing: 2px;
}

.stat-label {
    font-family: 'Pragmatica Cond', 'Arial Narrow', sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 100%;
    letter-spacing: 0;
    color: var(--primary-color);
    white-space: nowrap;
}

.stat-separator {
    font-size: 48px;
    color: #1a1a1a;
    font-weight: bold;
    flex-shrink: 0;
}

/* Map Section */
.map-section {
    max-width: 1200px;
    margin: 0 auto;
    margin-top: 20px;
    padding: 20px 20px;
    text-align: center;
    position: relative;
    z-index: 10;
}

.section-title {
    font-family: 'VCR OSD Mono', monospace;
    font-size: 28px;
    font-weight: 100;
    line-height: 100%;
    margin-bottom: 50px;
    color: var(--primary-color);
}

.map-container {
    margin-bottom: 50px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: 70%;
    margin-left: auto;
    margin-right: auto;
}

.map-image {
    width: 100%;
    height: 500px;
    object-fit: cover;
    display: block;
}

.register-button-container {
    margin-top: 40px;
}

/* Race Registration Section */
.race-section {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
    text-align: center;
    position: relative;
    z-index: 10;
}

.race-form {
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    text-align: left;
    padding: 0 10px;
    box-sizing: border-box;
}

.race-form select {
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    padding: 12px;
    border: 2px solid #1a1a1a;
    border-radius: 4px;
    background-color: #F5F3ED;
    transition: border-color 0.3s ease;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
}

.race-form select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.race-form .btn-primary {
    margin-top: 10px;
    padding: 12px 25px;
    font-size: 14px;
}

/* Footer Cubes */
.footer-cubes {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 50px;
    padding: 24px 20px;
    margin-bottom: 40px;
    flex-wrap: nowrap;
    overflow-x: auto;
    position: relative;
    z-index: 10;
}

.footer-cube {
    width: 100px;
    height: 100px;
    object-fit: scale-down;
}

/* Copyright Footer */
.copyright-footer {
    text-align: center;
    padding: 20px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    color: #1a1a1a;
    opacity: 0.6;
    position: relative;
    z-index: 10;
}

/* Responsive Design */
@media (max-width: 768px) {
    body::before {
        opacity: 0.03;
    }
    
    .main-title {
        font-size: 48px;
    }
    
    .stat-number {
        font-size: 64px;
    }
    
    .stats {
        gap: 20px;
    }
    
    .stat-separator {
        font-size: 32px;
    }
    
    .section-title {
        font-size: 24px;
        margin-bottom: 40px;
    }
    
    .footer-cubes {
        gap: 20px;
        padding: 24px 10px;
        margin-bottom: 20px;
        justify-content: center;
    }
    
    .footer-cube {
        width: 60px;
        height: 60px;
        flex-shrink: 0;
    }
    
    .banner-text {
        font-size: 14px;
    }
    
    .join-button-container {
        left: 20px;
    }
    
    .hero-title {
        font-size: 48px;
        margin: 20px 0 50px;
        letter-spacing: 8px;
    }
    
    .hero-video-container {
        max-width: 400px;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 36px;
    }
    
    .hero {
        padding: 60px 10px 80px;
    }
    
    .stat-number {
        font-size: 52px;
    }
    
    .stat-label {
        font-size: 16px;
    }
    
    .stats {
        gap: 15px;
    }
    
    .stat-separator {
        font-size: 28px;
    }
    
    .hero-title {
        font-size: 32px;
        margin: 15px 0 40px;
        letter-spacing: 6px;
    }
    
    .btn-primary {
        font-size: 18px;
        padding: 6px 20px;
    }
    
    .join-button-container {
        top: 50px;
        left: 20px;
    }
    
    .hero-video-container {
        max-width: 300px;
    }
}

@media (max-width: 360px) {
    .hero {
        padding: 50px 5px 70px;
    }
    
    .stat-number {
        font-size: 42px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .stats {
        gap: 10px;
    }
    
    .stat-separator {
        font-size: 20px;
    }
    
    .hero-title {
        font-size: 28px;
        margin: 10px 0 30px;
        letter-spacing: 4px;
    }
    
    .hero-video-container {
        max-width: 250px;
        opacity: 0.6;
    }
}

/* Color Toggle Button */
.color-toggle-btn {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    background-color: #F5F3ED;
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
}

.color-toggle-btn:hover {
    transform: scale(1.1) translate3d(0, 0, 0);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.color-toggle-btn:active {
    transform: scale(0.95) translate3d(0, 0, 0);
}

.color-toggle-btn.pink {
    border-color: #FF5D8B;
    color: #FF5D8B;
}

@media (max-width: 768px) {
    .color-toggle-btn {
        position: fixed;
        bottom: 20px;
        left: 20px;
        width: 48px;
        height: 48px;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 20000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #F5F3ED;
    padding: 40px;
    border-radius: 8px;
    max-width: 500px;
    width: 100%;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
    box-sizing: border-box;
}

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

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #1a1a1a;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.modal-close:hover {
    transform: rotate(90deg);
}

.modal-title {
    font-family: 'VCR OSD Mono', monospace;
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 30px;
    text-align: center;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-family: 'Pragmatica Cond', 'Arial Narrow', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group textarea {
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    padding: 12px;
    border: 2px solid #1a1a1a;
    border-radius: 4px;
    background-color: #F5F3ED;
    transition: border-color 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

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

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.btn-submit {
    background-color: var(--primary-color);
    color: #F5F3ED;
    border: none;
    padding: 15px 30px;
    font-family: 'Pragmatica Cond', 'Arial Narrow', sans-serif;
    font-size: 20px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit:disabled,
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-submit.loading,
.btn-primary.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

.btn-submit.loading::after,
.btn-primary.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-radius: 50%;
    border-top-color: currentColor;
    animation: button-spin 0.6s linear infinite;
}

@keyframes button-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.form-message {
    padding: 15px;
    border-radius: 4px;
    text-align: center;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    margin-top: 15px;
}

.form-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.form-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

@media (max-width: 768px) {
    .modal-content {
        padding: 30px 20px;
        max-width: 90%;
    }

    .modal-title {
        font-size: 24px;
        margin-bottom: 20px;
    }

    .form-group input,
    .form-group textarea,
    .race-form select,
    .race-form input {
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .btn-submit {
        font-size: 18px;
    }
    
    .race-form {
        padding: 0 20px;
    }
}
