/**
 * AIBG-126 Mobile Responsive Enhancement
 * Perfect mobile experience across all devices
 * Priority: Mobile-first, touch-friendly, no horizontal overflow
 */

/* ========================================
   MOBILE NAVIGATION (CSS-ONLY CHECKBOX HACK)
   ======================================== */

/* Hide the checkbox */
.mobile-menu-checkbox {
    display: none;
}

/* Hamburger toggle button (label for checkbox) */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: 2px solid var(--primary-cyan);
    color: var(--primary-cyan);
    cursor: pointer;
    clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
    transition: all 0.3s;
    min-width: 44px;
    min-height: 44px;
    padding: 0.6rem;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10000;
}

.mobile-menu-toggle:hover {
    background: rgba(0, 255, 255, 0.1);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

/* Hamburger icon (3 lines) */
.hamburger {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--primary-cyan);
    position: relative;
    transition: background 0.3s;
}

.hamburger::before,
.hamburger::after {
    content: '';
    display: block;
    width: 24px;
    height: 2px;
    background: var(--primary-cyan);
    position: absolute;
    left: 0;
    transition: transform 0.3s;
}

.hamburger::before {
    top: -8px;
}

.hamburger::after {
    top: 8px;
}

/* Transform hamburger to X when menu is open */
.mobile-menu-checkbox:checked ~ .mobile-menu-toggle .hamburger {
    background: transparent;
}

.mobile-menu-checkbox:checked ~ .mobile-menu-toggle .hamburger::before {
    transform: rotate(45deg);
    top: 0;
}

.mobile-menu-checkbox:checked ~ .mobile-menu-toggle .hamburger::after {
    transform: rotate(-45deg);
    top: 0;
}

/* Mobile overlay (also a label for checkbox - clicking closes menu) */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 9998;
    cursor: pointer;
}

/* Show overlay when menu is open */
.mobile-menu-checkbox:checked ~ .mobile-overlay {
    opacity: 1;
    visibility: visible;
}

/* DESKTOP: Hide hamburger and overlay completely (above 768px) */
@media (min-width: 769px) {
    .mobile-menu-toggle,
    .mobile-overlay,
    .mobile-menu-checkbox {
        display: none !important;
    }
}

/* ========================================
   TABLET (481px - 768px)
   ======================================== */

@media (max-width: 768px) {
    /* Base Typography */
    body {
        font-size: 16px; /* Readable minimum */
    }
    
    /* Container */
    .container {
        padding: 0 20px;
    }
    
    /* Navigation */
    .nav-container {
        padding: 0 20px;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    /* Menu closed by default (off-screen) */
    .nav-menu {
        position: fixed;
        top: 0;
        right: 0;
        width: 80%;
        max-width: 400px;
        height: 100vh;
        background: linear-gradient(135deg, var(--bg-charcoal), var(--bg-slate));
        border-left: 2px solid var(--primary-cyan);
        padding: 5rem 2rem 2rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        overflow-y: auto;
        z-index: 9999;
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }
    
    /* Menu open when checkbox is checked (pure CSS!) */
    .mobile-menu-checkbox:checked ~ .nav-menu {
        transform: translateX(0);
        box-shadow: -10px 0 50px rgba(0, 0, 0, 0.7);
    }
    
    /* Links are simple <a> tags - NO event handlers, NO pseudo-elements blocking clicks */
    .nav-link {
        padding: 1.2rem 1.5rem;
        border-bottom: 1px solid rgba(0, 255, 255, 0.1);
        text-align: left;
        font-size: 1.1rem;
        min-height: 44px;
        cursor: pointer;
        display: block;
    }
    
    .cta-button {
        margin: 1.5rem 0;
        width: 100%;
        justify-content: center;
        min-height: 48px;
        font-size: 1rem;
        cursor: pointer;
        display: flex;
    }
    
    .lang-switcher {
        margin-top: 2rem;
        justify-content: center;
    }
    
    .lang-flag {
        font-size: 2rem;
        padding: 0.5rem;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }
    
    /* Hero Section */
    .hero {
        min-height: auto;
        padding: 50px 0 25px;
    }
    
    section {
        padding: 40px 0;
    }
    
    .hero::before {
        font-size: 8rem;
        opacity: 0.03;
    }
    
    .hero-title {
        font-size: clamp(1.5rem, 7vw, 2.2rem);
        line-height: 1.1;
        margin-bottom: 0.6rem;
    }
    
    .hero-subtitle {
        font-size: 0.95rem;
        line-height: 1.5;
        margin-bottom: 0.8rem;
    }
    
    /* Stats Dashboard */
    .stats-dashboard {
        grid-template-columns: 1fr 1fr;
        gap: 0.8rem;
        margin: 0.8rem auto;
    }
    
    .stat-item {
        padding: 1rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .stat-label {
        font-size: 0.85rem;
    }
    
    /* Hero CTA */
    .hero-cta {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .primary-button,
    .secondary-button {
        width: 100%;
        justify-content: center;
        min-height: 48px;
        font-size: 1rem;
        padding: 1rem 2rem;
    }
    
    /* Trust Indicators */
    .trust-indicators {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .trust-indicators span {
        padding: 0.8rem;
        text-align: center;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Section Titles */
    .section-title {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .section-subtitle {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    /* Models Grid */
    .models-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .model-card {
        padding: 2rem;
    }
    
    .model-icon {
        width: 70px;
        height: 70px;
        font-size: 2.5rem;
    }
    
    /* Process Flow */
    .flow-steps {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .flow-steps::before {
        display: none;
    }
    
    .step-number {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    /* Pricing Grid */
    .pricing-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .pricing-card {
        padding: 2.5rem 2rem;
    }
    
    .pricing-card.featured {
        transform: none;
    }
    
    .pricing-button {
        min-height: 48px;
        font-size: 1rem;
    }
    
    /* Track Record Section */
    .record-summary {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .record-chart {
        min-height: 300px;
    }
    
    .record-details {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    /* FAQ Grid */
    .faq-grid {
        grid-template-columns: 1fr;
    }
    
    .faq-item {
        padding: 2rem;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 3rem;
        text-align: center;
    }
    
    .footer-section {
        align-items: center;
    }
    
    /* Charts */
    canvas {
        max-height: 300px !important;
    }
}

/* ========================================
   MOBILE SMALL (320px - 480px)
   ======================================== */

@media (max-width: 480px) {
    /* Base Typography */
    body {
        font-size: 16px;
    }
    
    /* Container */
    .container {
        padding: 0 16px;
    }
    
    /* Navigation */
    .nav-container {
        padding: 0 16px;
    }
    
    .nav-logo {
        font-size: 1.3rem;
    }
    
    .nav-menu {
        width: 90%;
        padding: 4rem 1.5rem 2rem;
    }
    
    /* Hero */
    .hero {
        padding: 35px 0 15px;
    }
    
    section {
        padding: 28px 0;
    }
    
    .hero::before {
        font-size: 5rem;
    }
    
    .hero-title {
        font-size: 1.8rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 0.95rem;
    }
    
    /* Stats Dashboard */
    .stat-item {
        padding: 1.2rem;
    }
    
    .stat-number {
        font-size: 1.8rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    /* Buttons */
    .primary-button,
    .secondary-button,
    .cta-button,
    .pricing-button {
        padding: 0.9rem 1.5rem;
        font-size: 0.9rem;
        min-height: 48px;
    }
    
    /* Section Titles */
    .section-title {
        font-size: 1.6rem;
    }
    
    .section-subtitle {
        font-size: 0.9rem;
    }
    
    /* Model Cards */
    .model-card {
        padding: 1.5rem;
    }
    
    .model-icon {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    .model-card h3 {
        font-size: 1.1rem;
    }
    
    .model-card p {
        font-size: 0.85rem;
    }
    
    /* Process Flow */
    .step-number {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .step-content h4 {
        font-size: 1rem;
    }
    
    .step-content p {
        font-size: 0.85rem;
    }
    
    /* Pricing Cards */
    .pricing-card {
        padding: 2rem 1.5rem;
    }
    
    .price {
        font-size: 2.5rem;
    }
    
    .pricing-features ul li {
        font-size: 0.85rem;
        padding: 0.6rem 0;
    }
    
    /* Record Details */
    .record-details {
        grid-template-columns: 1fr;
    }
    
    .record-stat h3 {
        font-size: 1.8rem;
    }
    
    .record-stat p {
        font-size: 0.85rem;
    }
    
    /* FAQ Items */
    .faq-item {
        padding: 1.5rem;
    }
    
    .faq-item h3 {
        font-size: 1rem;
    }
    
    .faq-item p {
        font-size: 0.85rem;
    }
    
    /* Charts */
    canvas {
        max-height: 250px !important;
    }
}

/* ========================================
   TRACK RECORD TABLE MOBILE
   ======================================== */

@media (max-width: 768px) {
    /* Track Record Hero */
    .track-hero {
        min-height: auto;
        padding: 45px 0 20px;
    }
    
    .track-hero::before {
        font-size: 8rem;
    }
    
    /* Stats Overview */
    .stats-overview {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    /* Charts Section */
    .chart-section {
        padding: 30px 0;
    }
    
    .charts-container {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
    
    .chart-box {
        padding: 2rem;
    }
    
    .chart-box h3 {
        font-size: 1.1rem;
        margin-bottom: 1.5rem;
    }
    
    .chart-box canvas {
        height: 250px !important;
    }
    
    /* Picks Table Section */
    .picks-table-section {
        padding: 25px 0 40px;
    }
    
    .table-container {
        padding: 2rem 1.5rem;
    }
    
    .table-filters {
        flex-direction: column;
        gap: 1rem;
    }
    
    .filter-select {
        width: 100%;
        padding: 0.9rem 1.5rem;
        font-size: 0.75rem;
    }
    
    .table-scroll {
        margin: 0 -1.5rem;
        padding: 0 1.5rem;
    }
    
    .picks-table {
        font-size: 0.7rem;
        min-width: 800px; /* Force horizontal scroll */
    }
    
    .picks-table thead th,
    .picks-table tbody td {
        padding: 0.8rem 0.5rem;
        white-space: nowrap;
    }
    
    .picks-table tbody td:nth-child(3) {
        max-width: 150px;
        white-space: normal;
        font-size: 0.65rem;
    }
    
    .table-footer {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        margin-top: 1.5rem;
    }
    
    .table-info {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    /* Stats Overview */
    .stats-overview {
        grid-template-columns: 1fr;
    }
    
    /* Table Container */
    .table-container {
        padding: 1.5rem 1rem;
    }
    
    .picks-table {
        font-size: 0.65rem;
    }
    
    .picks-table thead th,
    .picks-table tbody td {
        padding: 0.6rem 0.3rem;
    }
}

/* ========================================
   BLOG PAGE MOBILE
   ======================================== */

@media (max-width: 768px) {
    /* Blog Hero - COMPACT: Reduce white space */
    .blog-hero {
        min-height: auto;
        padding: 2rem 0 1rem; /* Much less padding */
        margin-top: 0;
    }
    
    .blog-hero h1 {
        margin-top: 1rem; /* Less space above heading */
    }
    
    .blog-hero::before {
        font-size: 8rem;
    }
    
    /* Blog Grid - COMPACT: Less spacing between cards */
    .blog-grid {
        gap: 1.5rem; /* Reduced from 3rem */
    }
    
    /* Post Cards - COMPACT: Smaller images, tighter layout */
    .post-card {
        grid-template-columns: 1fr;
        clip-path: polygon(15px 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%, 0 15px);
        margin-bottom: 1.5rem; /* Less spacing */
    }
    
    .post-image {
        max-height: 150px; /* Much smaller - reduced from 250px */
        min-height: 150px;
        object-fit: cover;
    }
    
    .post-content {
        padding: 1rem; /* More compact padding */
    }
    
    .post-title {
        font-size: 1.5rem;
    }
    
    .post-excerpt {
        font-size: 0.9rem;
    }
    
    .post-highlights {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .post-footer {
        flex-direction: column;
        gap: 1.5rem;
        align-items: flex-start;
    }
    
    .read-more {
        width: 100%;
        justify-content: center;
        min-height: 44px;
    }
    
    /* CTA Box */
    .cta-box {
        padding: 2.5rem 2rem;
        clip-path: polygon(20px 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%, 0 20px);
    }
    
    .cta-box h2 {
        font-size: 2rem;
    }
    
    .cta-box p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .blog-hero {
        padding: 1.5rem 0 0.5rem; /* Even more compact on small phones */
    }
    
    .post-content {
        padding: 1rem; /* Keep compact */
    }
    
    .post-title {
        font-size: 1.2rem;
    }
    
    .post-excerpt {
        font-size: 0.85rem;
    }
    
    .post-meta {
        gap: 1rem;
    }
    
    .post-date,
    .post-category {
        font-size: 0.65rem;
    }
    
    .post-image {
        max-height: 120px; /* Even smaller on tiny screens */
        min-height: 120px;
    }
    
    .blog-grid {
        gap: 1rem; /* Tighter on small screens */
    }
    
    .cta-box {
        padding: 2rem 1.5rem;
    }
    
    .cta-box h2 {
        font-size: 1.6rem;
    }
}

/* ========================================
   UTILITY - TOUCH TARGETS
   ======================================== */

@media (max-width: 768px) {
    /* Ensure all interactive elements are touch-friendly */
    a,
    button,
    .nav-link,
    .cta-button,
    .primary-button,
    .secondary-button,
    .filter-select,
    .lang-flag {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation; /* Prevent double-tap zoom on mobile */
        -webkit-tap-highlight-color: rgba(0, 255, 255, 0.2); /* Visual feedback on tap */
    }
    
    /* Explicitly enable pointer events on all interactive elements */
    .nav-menu a,
    .nav-menu button,
    .nav-link,
    .cta-button {
        pointer-events: auto !important;
        cursor: pointer !important;
    }
    
    /* No horizontal overflow */
    body,
    html {
        overflow-x: hidden;
        max-width: 100%;
    }
    
    * {
        max-width: 100%;
    }
    
    /* Readable text minimum */
    body,
    p,
    li,
    span,
    a {
        font-size: 16px;
        line-height: 1.6;
    }
    
    /* Smaller elements can be smaller but readable */
    .stat-label,
    .post-date,
    .post-category,
    .table-info {
        font-size: 14px;
    }
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   ======================================== */

@media (max-width: 768px) {
    /* Focus states for touch */
    a:focus,
    button:focus,
    select:focus {
        outline: 3px solid var(--primary-cyan);
        outline-offset: 2px;
    }
    
    /* Skip to content link */
    .skip-to-content {
        position: absolute;
        top: -100px;
        left: 0;
        background: var(--primary-cyan);
        color: var(--bg-void);
        padding: 1rem 2rem;
        text-decoration: none;
        font-weight: bold;
        z-index: 10000;
    }
    
    .skip-to-content:focus {
        top: 0;
    }
}
