/* AS215666 Website - Mobile-First Responsive Styles */

/* ============================================
   MOBILE NAVIGATION
   ============================================ */

.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a0a2e 50%, #2d1b4e 100%);
    z-index: 100;
    padding: 80px 20px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-menu.active {
    display: flex;
    flex-direction: column;
}

.mobile-menu a {
    padding: 18px 20px;
    font-size: 1.25rem;
    color: #fff;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    min-height: 44px; /* Touch target size */
}

.mobile-menu a:hover,
.mobile-menu a:active {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    z-index: 101;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
    align-items: center;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: #fff;
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Show hamburger on mobile and tablet */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .desktop-nav {
        display: none !important;
    }
}

/* ============================================
   VERY SMALL PHONES (iPhone SE, older Android)
   320px - 374px
   ============================================ */

@media (max-width: 374px) {
    .text-9xl {
        font-size: 2.5rem !important; /* 40px */
        line-height: 1.1 !important;
    }

    .text-7xl {
        font-size: 2rem !important; /* 32px */
        line-height: 1.2 !important;
    }

    .text-5xl {
        font-size: 1.75rem !important; /* 28px */
        line-height: 1.2 !important;
    }

    .text-4xl {
        font-size: 1.5rem !important; /* 24px */
        line-height: 1.3 !important;
    }

    .text-3xl {
        font-size: 1.375rem !important; /* 22px */
        line-height: 1.3 !important;
    }

    .text-2xl {
        font-size: 1.25rem !important; /* 20px */
        line-height: 1.4 !important;
    }

    .text-xl {
        font-size: 1.125rem !important; /* 18px */
        line-height: 1.4 !important;
    }

    /* Extra small containers */
    .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    /* Reduce section padding */
    section {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }

    /* Hero section spacing */
    .pt-32 {
        padding-top: 6rem !important;
    }

    .pb-20 {
        padding-bottom: 3rem !important;
    }
}

/* ============================================
   SMALL PHONES (iPhone SE, iPhone 12 Mini)
   375px - 389px
   ============================================ */

@media (min-width: 375px) and (max-width: 389px) {
    .text-9xl {
        font-size: 3rem !important; /* 48px */
        line-height: 1.1 !important;
    }

    .text-7xl {
        font-size: 2.25rem !important; /* 36px */
        line-height: 1.2 !important;
    }

    .text-5xl {
        font-size: 2rem !important; /* 32px */
        line-height: 1.2 !important;
    }
}

/* ============================================
   STANDARD PHONES (Most modern phones)
   390px - 430px (iPhone 14, Samsung Galaxy, etc)
   ============================================ */

@media (min-width: 390px) and (max-width: 430px) {
    .text-9xl {
        font-size: 3.5rem !important; /* 56px */
        line-height: 1.1 !important;
    }

    .text-7xl {
        font-size: 2.5rem !important; /* 40px */
        line-height: 1.2 !important;
    }

    .text-5xl {
        font-size: 2.25rem !important; /* 36px */
        line-height: 1.2 !important;
    }
}

/* ============================================
   ALL MOBILE DEVICES (up to 640px)
   ============================================ */

@media (max-width: 640px) {
    /* General font size adjustments */
    .text-9xl {
        font-size: 3rem !important;
        line-height: 1.1 !important;
    }

    .text-7xl {
        font-size: 2.25rem !important;
        line-height: 1.2 !important;
    }

    .text-5xl {
        font-size: 2rem !important;
        line-height: 1.2 !important;
    }

    .text-4xl {
        font-size: 1.75rem !important;
        line-height: 1.3 !important;
    }

    .text-3xl {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
    }

    .text-2xl {
        font-size: 1.25rem !important;
        line-height: 1.4 !important;
    }

    .text-xl {
        font-size: 1.125rem !important;
        line-height: 1.5 !important;
    }

    .text-lg {
        font-size: 1rem !important;
        line-height: 1.5 !important;
    }

    /* Container and spacing */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
        max-width: 100%;
        overflow-x: hidden;
    }

    section {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }

    .px-6 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .py-16 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }

    .py-12 {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }

    /* Hero section */
    .pt-32 {
        padding-top: 7rem !important;
    }

    .pb-20 {
        padding-bottom: 3rem !important;
    }

    /* Cards and glass effects */
    .glass {
        padding: 1rem !important;
    }

    .glass.rounded-xl.p-8 {
        padding: 1.25rem !important;
    }

    .rounded-xl {
        border-radius: 0.75rem !important;
    }

    /* Margins */
    .mb-12 {
        margin-bottom: 2rem !important;
    }

    .mb-8 {
        margin-bottom: 1.5rem !important;
    }

    .mb-6 {
        margin-bottom: 1rem !important;
    }

    .mb-4 {
        margin-bottom: 0.75rem !important;
    }

    /* Gap adjustments */
    .gap-8 {
        gap: 1.5rem !important;
    }

    .gap-6 {
        gap: 1rem !important;
    }

    .gap-4 {
        gap: 0.75rem !important;
    }

    .space-y-4 > * + * {
        margin-top: 0.75rem !important;
    }

    .space-y-3 > * + * {
        margin-top: 0.5rem !important;
    }
}

/* ============================================
   BUTTONS AND TOUCH TARGETS
   ============================================ */

@media (max-width: 640px) {
    /* All buttons minimum touch target */
    button,
    .copy-btn,
    a.inline-block {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Button sizing */
    .px-8 {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }

    .px-6 {
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
    }

    .px-4 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .py-4 {
        padding-top: 0.875rem !important;
        padding-bottom: 0.875rem !important;
    }

    .py-3 {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }

    .py-2 {
        padding-top: 0.625rem !important;
        padding-bottom: 0.625rem !important;
    }

    /* Copy buttons */
    .copy-btn {
        font-size: 0.8125rem !important;
        padding: 0.625rem 1rem !important;
        white-space: nowrap;
    }

    /* Button groups */
    .flex.space-x-4,
    .flex.space-x-6 {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    .flex.space-x-4 > *,
    .flex.space-x-6 > * {
        width: 100% !important;
        margin: 0 !important;
    }

    .flex.justify-center {
        flex-direction: column !important;
        align-items: stretch !important;
    }
}

/* ============================================
   GRIDS AND LAYOUTS
   ============================================ */

@media (max-width: 768px) {
    /* Force single column on mobile */
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4,
    .md\:grid-cols-2,
    .md\:grid-cols-3,
    .md\:grid-cols-4,
    .lg\:grid-cols-3 {
        grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
    }

    /* Flex containers */
    .flex.items-center.justify-between {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }

    .flex.justify-between:not(.items-center) {
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }
}

/* ============================================
   TYPOGRAPHY AND TEXT
   ============================================ */

@media (max-width: 640px) {
    /* Mono font (for IP addresses) */
    .font-mono {
        font-size: 0.8125rem !important;
        word-break: break-all;
        line-height: 1.5 !important;
    }

    .font-mono.text-lg {
        font-size: 0.9375rem !important;
    }

    .font-mono.text-2xl {
        font-size: 1.125rem !important;
    }

    /* Text alignment */
    .text-center {
        text-align: center !important;
    }

    /* Max width adjustments */
    .max-w-3xl,
    .max-w-4xl,
    .max-w-5xl {
        max-width: 100% !important;
    }
}

/* ============================================
   MAPS
   ============================================ */

@media (max-width: 768px) {
    #map,
    #ixp-map {
        height: 250px !important;
        min-height: 250px !important;
    }
}

@media (max-width: 480px) {
    #map,
    #ixp-map {
        height: 200px !important;
        min-height: 200px !important;
    }
}

/* ============================================
   FORMS AND INPUTS
   ============================================ */

@media (max-width: 640px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    textarea,
    select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.75rem !important;
        width: 100% !important;
    }
}

/* ============================================
   NAVIGATION
   ============================================ */

@media (max-width: 768px) {
    nav {
        padding: 0.75rem 1rem !important;
    }

    nav .container {
        padding: 0 !important;
    }

    nav .text-2xl {
        font-size: 1.5rem !important;
    }

    /* Language switcher */
    #lang-switch-mobile {
        min-width: 44px !important;
        min-height: 44px !important;
    }
}

/* ============================================
   OVERFLOW PREVENTION
   ============================================ */

@media (max-width: 640px) {
    body {
        overflow-x: hidden !important;
        width: 100%;
    }

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

    * {
        max-width: 100%;
    }

    .container {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }
}

/* ============================================
   FOOTER
   ============================================ */

@media (max-width: 768px) {
    footer .grid-cols-3 {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }

    footer .text-xl {
        font-size: 1.125rem !important;
    }

    footer .text-lg {
        font-size: 1rem !important;
    }

    footer ul {
        margin-top: 0.75rem !important;
    }
}

/* ============================================
   TABLET OPTIMIZATIONS
   768px - 1024px
   ============================================ */

@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    .text-9xl {
        font-size: 5rem !important;
    }

    .text-7xl {
        font-size: 3.5rem !important;
    }

    .text-5xl {
        font-size: 2.75rem !important;
    }

    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .md\:grid-cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* ============================================
   ANIMATIONS AND TRANSITIONS
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

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

/* Focus styles for keyboard navigation */
button:focus-visible,
a:focus-visible {
    outline: 2px solid #8b5cf6 !important;
    outline-offset: 2px !important;
}

/* Better tap highlights */
@media (hover: none) {
    button,
    a {
        -webkit-tap-highlight-color: rgba(139, 92, 246, 0.2);
    }
}
