/* ============================================
   COMBAT ROBOTICS TEAM - RESPONSIVE STYLES
   Mobile-first breakpoints
   ============================================ */

/* ============================================
   BREAKPOINTS:
   - Mobile: < 640px
   - Tablet: 640px - 1024px  
   - Desktop: > 1024px
   ============================================ */

/* ============================================
   SMALL MOBILE (< 480px)
   ============================================ */
@media (max-width: 479px) {
    :root {
        --text-6xl: 2rem;
        --text-5xl: 1.75rem;
        --text-4xl: 1.5rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .btn-lg {
        padding: var(--space-3) var(--space-5);
        font-size: var(--text-sm);
    }

    .countdown-value {
        font-size: var(--text-2xl);
        padding: var(--space-3);
        min-width: 60px;
    }
}

/* ============================================
   MOBILE (< 768px)
   ============================================ */
@media (max-width: 767px) {

    /* Navigation */
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        background: var(--color-black-deep);
        flex-direction: column;
        align-items: flex-start;
        padding: var(--space-20) var(--space-6);
        gap: var(--space-4);
        border-left: 1px solid var(--color-charcoal);
        transition: right var(--transition-base);
        z-index: var(--z-fixed);
    }

    .nav-menu.open {
        right: 0;
    }

    .nav-link {
        font-size: var(--text-lg);
        padding: var(--space-3) 0;
    }

    .nav-toggle {
        display: flex;
        z-index: calc(var(--z-fixed) + 1);
    }

    .nav-toggle.open span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .nav-toggle.open span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.open span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* Mobile menu overlay */
    .nav-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.8);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-base);
        z-index: calc(var(--z-fixed) - 1);
    }

    .nav-overlay.open {
        opacity: 1;
        visibility: visible;
    }

    /* Hero */
    .hero {
        padding: var(--space-20) 0 var(--space-12);
        text-align: center;
    }

    .hero-content {
        padding: 0 var(--space-4);
    }

    .hero-title {
        font-size: var(--text-4xl);
        line-height: 1.1;
    }

    .hero-subtitle {
        font-size: var(--text-lg);
    }

    .hero-cta {
        flex-direction: column;
        gap: var(--space-3);
    }

    .hero-cta .btn {
        width: 100%;
    }

    /* Sections */
    .section {
        padding: var(--space-16) 0;
    }

    .section-header {
        margin-bottom: var(--space-10);
    }

    .section-header h2 {
        font-size: var(--text-3xl);
    }

    /* Grids */
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-4);
    }

    /* Cards */
    .flip-card {
        height: auto;
        min-height: 280px;
    }

    .card {
        padding: var(--space-4);
    }

    /* Tabs */
    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: var(--space-3);
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        padding: var(--space-2) var(--space-4);
        font-size: var(--text-xs);
    }

    /* Gallery */
    .gallery {
        columns: 1;
    }

    /* Timeline */
    .timeline {
        padding-left: var(--space-8);
    }

    .timeline::before {
        left: 8px;
    }

    .timeline-dot {
        left: calc(-1 * var(--space-8) + 2px);
        width: 12px;
        height: 12px;
    }

    /* Countdown */
    .countdown {
        gap: var(--space-2);
    }

    .countdown-item {
        min-width: 65px;
    }

    .countdown-value {
        font-size: var(--text-3xl);
        padding: var(--space-3);
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-8);
        text-align: center;
    }

    .footer-brand p {
        max-width: none;
    }

    .footer-social {
        justify-content: center;
    }

    /* Marquee */
    .marquee-item img {
        height: 40px;
    }

    /* Forms */
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    /* Robots Carousel */
    .robot-carousel {
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .robot-card {
        scroll-snap-align: center;
        min-width: 280px;
    }

    /* Counter Values */
    .counter-value {
        font-size: var(--text-4xl);
    }

    /* Touch targets */
    a, button, .btn, .nav-link {
        min-width: 48px;
        min-height: 48px;
        padding: 12px 0;
    }
}

/* ============================================
   TABLET (768px - 1023px)
   ============================================ */
@media (min-width: 768px) and (max-width: 1023px) {

    /* Navigation */
    .nav-menu {
        gap: var(--space-4);
    }

    .nav-link {
        font-size: var(--text-xs);
    }

    /* Grids */
    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Hero */
    .hero-title {
        font-size: var(--text-5xl);
    }

    /* Gallery */
    .gallery {
        columns: 2;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================
   DESKTOP (>= 1024px)
   ============================================ */
@media (min-width: 1024px) {

    /* Container max widths */
    .container {
        max-width: 1200px;
    }

    .container-lg {
        max-width: 1400px;
    }

    /* Hero */
    .hero-title {
        font-size: var(--text-7xl);
    }

    .hero-subtitle {
        font-size: var(--text-xl);
    }

    /* Sections */
    .section {
        padding: var(--space-24) 0;
    }

    /* Gallery */
    .gallery {
        columns: 3;
    }

    /* Team Grid */
    .team-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Robot Grid */
    .robot-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================
   LARGE DESKTOP (>= 1440px)
   ============================================ */
@media (min-width: 1440px) {
    :root {
        font-size: 18px;
    }

    .container {
        max-width: 1400px;
    }
}

/* ============================================
   HEIGHT-BASED QUERIES
   ============================================ */
@media (max-height: 700px) {
    .hero {
        min-height: auto;
        padding: var(--space-16) 0;
    }

    .hero-title {
        font-size: var(--text-4xl);
    }
}

/* ============================================
   HOVER CAPABILITY DETECTION
   ============================================ */
@media (hover: none) {

    /* Disable hover effects on touch devices */
    .flip-card:hover .flip-card-inner {
        transform: none;
    }

    .flip-card.flipped .flip-card-inner {
        transform: rotateY(180deg);
    }

    /* Make hover effects permanent on touch */
    .card:active {
        border-color: var(--color-crimson);
        transform: translateY(-3px);
    }

    .btn:active {
        transform: translateY(-2px);
        box-shadow: var(--shadow-glow);
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
    }

    .nav,
    .footer,
    .btn,
    #particles-canvas,
    .scanlines,
    .noise-overlay {
        display: none !important;
    }

    .section {
        page-break-inside: avoid;
    }

    .hero {
        min-height: auto;
        padding: 2rem 0;
    }

    a {
        text-decoration: underline;
    }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
}

/* ============================================
   LANDSCAPE MOBILE
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: var(--space-8) 0;
    }

    .hero-title {
        font-size: var(--text-3xl);
    }

    .hero-subtitle {
        font-size: var(--text-base);
        margin-bottom: var(--space-4);
    }

    .hero-cta {
        flex-direction: row;
    }
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */
@media (prefers-contrast: high) {
    :root {
        --color-red: #ff0000;
        --color-text-secondary: #ffffff;
        --color-charcoal: #000000;
        --color-charcoal-light: #333333;
    }

    .card,
    .btn,
    .form-input {
        border-width: 2px;
    }
}

/* ============================================
   DARK MODE TOGGLE OVERRIDES
   ============================================ */
[data-theme="light"] {
    --color-black-deep: #ffffff;
    --color-black: #f5f5f5;
    --color-black-light: #eeeeee;
    --color-charcoal: #e0e0e0;
    --color-charcoal-light: #d0d0d0;
    --color-text-primary: #1a1a1a;
    --color-text-secondary: #4a4a4a;
    --color-text-muted: #6a6a6a;
    --gradient-card: linear-gradient(145deg, #ffffff 0%, #f0f0f0 100%);
}

[data-theme="light"] .nav {
    background: rgba(255, 255, 255, 0.95);
}

[data-theme="light"] .footer {
    background: #f5f5f5;
}
