/* ======================================================
   RESPONSIVE & CROSS-BROWSER COMPATIBILITY
   GLACIAL -8 WonderCool
   Supports: Chrome, Firefox, Safari, Edge, iOS Safari,
             Android Chrome, Samsung Internet, Opera
   ====================================================== */

/* ---- CROSS-BROWSER PREFIXES & CORE FIXES ---- */

/* Smooth scroll - all browsers */
html {
    -webkit-scroll-behavior: smooth;
    scroll-behavior: smooth;
    /* Prevent text size adjustment on iOS rotation */
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Better box model everywhere */
*,
*::before,
*::after {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

/* Prevent tap highlight on iOS/Android */
a,
button,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

/* ---- BACKDROP FILTER (Safari prefix) ---- */
.navbar.scrolled,
.contact-form-panel,
.img-badge,
.lang-switcher,
.toast {
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

/* ---- FLEXBOX CROSS-BROWSER ---- */
.nav-links,
.hero-ctas,
.stats-container,
.feat-list,
.hero-ctas,
.footer-social,
.social-buttons-contact,
.renting-info-cards,
.testi-author,
.cinfo-block,
.roi-result-card,
.range-container,
.btn-submit,
.btn-download,
.footer-bottom,
.footer-bottom-links,
.social-float,
.ceo-info {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
}

/* ---- CSS GRID SUPPORT (older iOS/Android) ---- */
/* For browsers that don't support grid, fall back to block */
@supports not (display: grid) {

    .tech-grid,
    .gallery-grid,
    .split-layout,
    .testi-grid,
    .contact-layout,
    .form-row,
    .footer-main,
    .roi-calculator,
    .renting-wrapper {
        display: block;
    }

    .tech-card,
    .gallery-item,
    .testi-card,
    .form-group {
        display: inline-block;
        width: 100%;
        vertical-align: top;
        margin-bottom: 20px;
    }
}

/* ---- ASPECT-RATIO FALLBACK (iOS < 15, older browsers) ---- */
/* Use padding-bottom hack for browsers that don't support aspect-ratio */
@supports not (aspect-ratio: 4/3) {
    .gallery-item {
        padding-bottom: 75%;
        /* 4:3 ratio */
        height: 0;
        position: relative;
    }

    .gallery-item img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .gallery-item.large {
        padding-bottom: 56.25%;
        /* 16:9 ratio */
    }
}

/* ---- FORM INPUTS - iOS fixes ---- */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
select,
textarea {
    /* Prevent iOS zoom on focus (font-size must be >= 16px) */
    font-size: 16px !important;
    /* Remove iOS default styling */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /* Remove inner shadow on iOS inputs */
    -webkit-box-shadow: none;
    box-shadow: none;
    border-radius: 12px;
}

/* Select dropdown arrow for all browsers */
select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238090b0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 44px !important;
}

/* Range input - Firefox */
.range-container input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    cursor: pointer;
    box-shadow: 0 0 12px var(--accent-glow);
}

.range-container input[type="range"]::-moz-range-track {
    background: rgba(255, 255, 255, 0.1);
    height: 4px;
    border-radius: 2px;
}

/* IE / Edge legacy */
.range-container input[type="range"]::-ms-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    cursor: pointer;
}

.range-container input[type="range"]::-ms-track {
    background: rgba(255, 255, 255, 0.1);
    height: 4px;
    border-radius: 2px;
    color: transparent;
    border: none;
}

/* ---- TOUCH DEVICE IMPROVEMENTS ---- */
@media (hover: none) and (pointer: coarse) {

    /* Remove hover transforms on touch devices - they stay "stuck" */
    .tech-card:hover,
    .testi-card:hover,
    .gallery-item:hover img,
    .img-frame:hover,
    .btn-hero-primary:hover,
    .btn-hero-secondary:hover,
    .btn-calc:hover,
    .btn-submit:hover,
    .social-cta:hover,
    .social-float-btn:hover {
        transform: none;
    }

    /* But keep color/border changes */
    .tech-card:hover {
        border-color: rgba(0, 229, 255, 0.3);
    }

    /* Make gallery overlay always visible on touch */
    .gallery-overlay {
        opacity: 1;
    }

    /* Bigger touch targets */
    .nav-link {
        padding: 10px 0;
    }

    .btn-hero-primary,
    .btn-hero-secondary {
        min-height: 54px;
    }

    .btn-submit,
    .btn-calc {
        min-height: 56px;
    }

    .cinfo-block a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Disable custom cursor on touch */
    body {
        cursor: auto;
    }

    .cursor-dot,
    .cursor-ring {
        display: none !important;
    }
}

/* ---- SAFARI-SPECIFIC FIXES ---- */
/* Fix for Safari flex gap support (< Safari 14) */
@supports (-webkit-hyphens: none) {
    .nav-links {
        gap: 0;
    }

    .nav-link {
        margin-left: 32px;
    }

    .nav-link:first-child {
        margin-left: 0;
    }

    .hero-ctas {
        gap: 0;
    }

    .btn-hero-primary {
        margin-right: 20px;
    }

    .feat-list {
        gap: 0;
    }

    .feat-list li {
        margin-bottom: 14px;
    }

    .tech-grid {
        gap: 0;
    }

    .tech-card {
        margin-bottom: 24px;
        margin-right: 24px;
    }

    .footer-social {
        gap: 0;
    }

    .footer-social a {
        margin-right: 12px;
    }
}

/* ---- ANIMATION - Respect reduced motion preference ---- */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .hero-slide {
        transition: none;
    }

    .hero-bg-slider .hero-slide.active {
        opacity: 1;
        transition: none;
    }

    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .marquee-track {
        animation: none;
    }
}

/* ======================================================
   BREAKPOINTS - MOBILE FIRST RESPONSIVE SYSTEM
   ====================================================== */

/* --- LARGE TABLETS (≤ 1200px) --- */
@media screen and (max-width: 1200px) {
    .container {
        width: 92%;
    }

    .tech-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-main {
        grid-template-columns: 1fr 1fr;
        gap: 40px;
    }

    .footer-brand {
        grid-column: 1 / -1;
    }

    .roi-calculator {
        padding: 40px;
        gap: 40px;
    }

    .split-layout {
        gap: 50px;
    }

    .renting-wrapper {
        gap: 50px;
    }
}

/* --- TABLETS (≤ 1024px) --- */
@media screen and (max-width: 1024px) {
    h1 {
        font-size: clamp(2.2rem, 5vw, 4rem);
    }

    h2 {
        font-size: clamp(1.8rem, 4vw, 3rem);
    }

    .split-layout {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .renting-wrapper {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .contact-layout {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .testi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .roi-calculator {
        grid-template-columns: 1fr;
        gap: 32px;
        padding: 36px;
    }

    .roi-inputs {
        grid-column: 1;
    }

    .roi-results {
        grid-column: 1;
        -webkit-box-orient: horizontal;
        -webkit-box-direction: normal;
        -ms-flex-direction: row;
        flex-direction: row;
        -ms-flex-wrap: wrap;
        flex-wrap: wrap;
    }

    .roi-result-card {
        -ms-flex: 1 1 180px;
        flex: 1 1 180px;
    }

    .roi-disclaimer {
        grid-column: 1;
    }

    .img-frame {
        -webkit-transform: none;
        transform: none;
    }

    .img-frame:hover {
        -webkit-transform: none;
        transform: none;
    }

    /* Gallery: 2 columns */
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .gallery-item.large {
        grid-column: span 2;
    }
}

/* --- SMALL TABLETS (≤ 860px) --- */
@media screen and (max-width: 860px) {
    .section {
        padding: 80px 0;
    }

    .section-header {
        margin-bottom: 50px;
    }

    .stats-bar {
        padding: 40px 0;
    }

    .stats-container {
        -ms-flex-wrap: wrap;
        flex-wrap: wrap;
    }

    .stat-divider {
        display: none;
    }

    .stat-pill {
        -ms-flex: 1 1 45%;
        flex: 1 1 45%;
        padding: 20px 24px;
    }

    .testi-grid {
        grid-template-columns: 1fr;
    }

    .tech-grid {
        grid-template-columns: 1fr;
    }
}

/* --- MOBILE (≤ 768px) --- */
@media screen and (max-width: 768px) {

    /* === NAVBAR === */
    .navbar {
        padding: 14px 0;
    }

    .nav-container {
        padding: 0 20px;
    }

    /* Full screen overlay menu for mobile */
    .nav-links {
        display: -webkit-box !important;
        display: -ms-flexbox !important;
        display: flex !important;
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        justify-content: center;
        -webkit-box-align: center;
        -ms-flex-align: center;
        align-items: center;
        gap: 28px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(3, 8, 16, 0.98);
        -webkit-backdrop-filter: blur(20px);
        backdrop-filter: blur(20px);
        z-index: 998;
        padding: 80px 30px 40px;
        /* Hidden by default */
        opacity: 0;
        pointer-events: none;
        -webkit-transition: opacity 0.3s ease;
        transition: opacity 0.3s ease;
    }

    .nav-links.open {
        opacity: 1;
        pointer-events: all;
    }

    .nav-link {
        font-size: 1.2rem;
        letter-spacing: 3px;
        padding: 12px 0;
        width: 100%;
        text-align: center;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .lang-switcher {
        margin-top: 16px;
        padding: 8px 20px;
    }

    .lang-btn {
        font-size: 0.9rem;
        padding: 6px 10px;
    }

    .hamburger {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        align-items: center;
        z-index: 1001;
    }

    /* === HERO === */
    .hero-content {
        padding: 0 24px;
        max-width: 100%;
    }

    .hero-badge {
        font-size: 0.62rem;
        letter-spacing: 2px;
        padding: 7px 16px;
        margin-bottom: 24px;
    }

    .hero-sub {
        font-size: 1rem;
        margin-bottom: 32px;
        line-height: 1.7;
    }

    .hero-ctas {
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
        -webkit-box-align: center;
        -ms-flex-align: center;
        align-items: center;
        gap: 14px;
    }

    .btn-hero-primary,
    .btn-hero-secondary {
        width: 100%;
        max-width: 320px;
        text-align: center;
        padding: 16px 32px;
    }

    /* Hide floating social buttons on mobile */
    .social-float {
        display: none;
    }

    /* Hide custom cursor on mobile */
    .cursor-dot,
    .cursor-ring {
        display: none;
    }

    body {
        cursor: auto;
    }

    /* === STATS === */
    .stat-pill {
        -ms-flex: 1 1 50%;
        flex: 1 1 50%;
        padding: 20px 16px;
        min-width: 0;
    }

    .stat-n {
        font-size: 2.5rem;
    }

    .stat-sym {
        font-size: 1.5rem;
    }

    .stat-l {
        font-size: 0.68rem;
        letter-spacing: 1px;
    }

    /* === GALLERY === */
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .gallery-item.large {
        grid-column: span 1;
    }

    .gallery-item {
        aspect-ratio: 16/9;
    }

    /* Always show overlay labels on mobile */
    .gallery-overlay {
        opacity: 1;
    }

    /* === ROI CALCULATOR === */
    .roi-calculator {
        padding: 24px 20px;
    }

    .roi-results {
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
        padding-top: 0;
    }

    /* === RENTING === */
    .btn-download {
        width: 100%;
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        justify-content: center;
        padding: 16px 24px;
        font-size: 0.75rem;
    }

    .renting-info-cards {
        -ms-flex-wrap: wrap;
        flex-wrap: wrap;
    }

    .info-card {
        -ms-flex: 1 1 calc(50% - 6px);
        flex: 1 1 calc(50% - 6px);
    }

    /* === CONTACT FORM === */
    .contact-form-panel {
        padding: 28px 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .contact-info-panel {
        order: 1;
    }

    .contact-form-panel {
        order: 2;
    }

    /* === FOOTER === */
    .footer {
        padding: 60px 0 30px;
    }

    .footer-main {
        grid-template-columns: 1fr;
        gap: 36px;
    }

    .footer-brand {
        grid-column: 1;
    }

    .footer-logo {
        font-size: 1.3rem;
    }

    .footer-bottom {
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
        text-align: center;
        gap: 14px;
    }

    .footer-bottom-links {
        -ms-flex-wrap: wrap;
        flex-wrap: wrap;
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        justify-content: center;
        gap: 16px;
    }

    /* === SECTION HEADINGS === */
    .section-desc {
        font-size: 1rem;
    }

    .section-lead {
        font-size: 1.15rem;
    }
}

/* --- SMALL MOBILE (≤ 480px) --- */
@media screen and (max-width: 480px) {
    .container {
        width: 94%;
        padding: 0 12px;
    }

    .section {
        padding: 60px 0;
    }

    h1 {
        font-size: clamp(1.9rem, 8vw, 2.8rem);
    }

    h2 {
        font-size: clamp(1.6rem, 6vw, 2.2rem);
    }

    /* Hero */
    .hero-badge {
        display: none;
    }

    /* Too crowded on very small screens */
    .hero-scroll-indicator {
        display: none;
    }

    /* Stats: full width each */
    .stat-pill {
        -ms-flex: 1 1 100%;
        flex: 1 1 100%;
        border-bottom: 1px solid var(--border-glass);
    }

    .stat-pill:last-child {
        border-bottom: none;
    }

    /* Tech cards */
    .tech-card {
        padding: 28px 20px;
    }

    /* ROI */
    .roi-result-card {
        padding: 18px 16px;
        gap: 12px;
    }

    .roi-result-value {
        font-size: 1.4rem;
    }

    .roi-calculator {
        border-radius: var(--r-md);
    }

    /* Testimonials */
    .testi-card {
        padding: 24px 20px;
    }

    /* Form */
    .contact-form-panel {
        border-radius: var(--r-md);
    }

    /* Company footer info */
    .ceo-info {
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
        gap: 8px;
    }

    /* Social buttons full width */
    .social-cta {
        width: 100%;
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        justify-content: center;
    }

    /* Marquee: smaller slides on mobile */
    .marquee-slide {
        width: 220px;
    }

    .marquee-slide img {
        height: 150px;
    }
}

/* --- VERY SMALL MOBILE (≤ 360px) --- */
@media screen and (max-width: 360px) {
    h1 {
        font-size: 1.7rem;
    }

    h2 {
        font-size: 1.4rem;
    }

    .btn-hero-primary,
    .btn-hero-secondary {
        font-size: 0.75rem;
        letter-spacing: 1px;
    }

    .logo {
        font-size: 1.1rem;
    }

    .roi-calculator {
        padding: 18px 14px;
    }
}

/* ======================================================
   PRINT STYLES
   ====================================================== */
@media print {

    .navbar,
    .cursor-dot,
    .cursor-ring,
    .social-float,
    .marquee-section,
    .hero-scroll-indicator {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    .hero {
        height: auto;
        padding: 60px 20px;
        min-height: 0;
    }

    .hero-overlay,
    .hero-bg-slider {
        display: none;
    }

    .hero-content {
        color: black;
    }

    .accent {
        color: #003399;
        text-shadow: none;
    }

    section {
        padding: 40px 20px;
    }

    .footer {
        background: white;
        color: black;
    }
}

/* ======================================================
   LANDSCAPE MOBILE (phones rotated)
   ====================================================== */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .hero {
        height: auto;
        min-height: 100vh;
        padding: 100px 20px 60px;
    }

    .hero-content {
        padding: 0 20px;
    }

    .hero-scroll-indicator {
        display: none;
    }

    .hero-ctas {
        -webkit-box-orient: horizontal;
        -webkit-box-direction: normal;
        -ms-flex-direction: row;
        flex-direction: row;
    }

    .btn-hero-primary,
    .btn-hero-secondary {
        width: auto;
    }
}