/* ============================================================
   CHABATRADING.COM - RESPONSIVE STYLESHEET
   Media Queries & Mobile-First Adaptations
   ============================================================ */

/* ---------- LARGE SCREENS (≥1600px) ---------- */
@media (min-width: 1600px) {
    :root {
        --container-max: 1480px;
    }

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

/* ---------- DESKTOP (1280px - 1599px) ---------- */
@media (max-width: 1599px) {
    .footer-grid {
        grid-template-columns: 1.5fr 1fr 1fr 1fr;
        gap: 2.5rem;
    }
}

/* ---------- MEDIUM SCREENS (1024px - 1279px) ---------- */
@media (max-width: 1279px) {
    :root {
        --header-height: 72px;
    }

    h1 { font-size: clamp(2.25rem, 4.5vw, 3.5rem); }
    h2 { font-size: clamp(1.85rem, 3.5vw, 2.85rem); }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }

    .footer-brand {
        grid-column: 1 / -1;
        max-width: 100%;
        margin-bottom: 1rem;
    }

    .two-col {
        gap: 3rem;
    }

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

    .timeline-item {
        width: 100%;
        padding-left: 60px !important;
        padding-right: 0 !important;
        text-align: left !important;
    }

    .timeline-item:nth-child(even) {
        margin-left: 0;
    }

    .timeline-item::before {
        left: 22px !important;
        right: auto !important;
    }
}

/* ---------- TABLET (768px - 1023px) ---------- */
@media (max-width: 1023px) {
    :root {
        --space-2xl: 4rem;
        --space-3xl: 6rem;
    }

    .main-nav {
        position: fixed;
        top: var(--header-height);
        left: 0;
        width: 100%;
        height: calc(100vh - var(--header-height));
        background: var(--bg-glass-strong);
        backdrop-filter: blur(30px);
        flex-direction: column;
        justify-content: flex-start;
        padding: 2rem;
        gap: 0;
        transform: translateX(100%);
        transition: transform var(--transition-base);
        border-top: 1px solid var(--border-line);
        overflow-y: auto;
    }

    .main-nav.active {
        transform: translateX(0);
    }

    .main-nav .nav-link {
        width: 100%;
        padding: 1.25rem 0;
        font-size: 1rem;
        border-bottom: 1px solid var(--border-line);
        justify-content: flex-start;
    }

    .main-nav .nav-cta {
        width: 100%;
        margin: 1.5rem 0 0;
        justify-content: center;
    }

    .mobile-toggle {
        display: flex;
    }

    .hero {
        min-height: auto;
        padding: calc(var(--header-height) + 3rem) 0 3rem;
    }

    .hero-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .hero-stat:nth-child(2)::after {
        display: none;
    }

    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

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

    .services-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

    .news-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

    .two-col {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .two-col-image {
        max-width: 480px;
        margin: 0 auto;
    }

    .contact-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }

    .legal-toc ul {
        column-count: 1;
    }
}

/* ---------- MOBILE (≤767px) ---------- */
@media (max-width: 767px) {
    :root {
        --container-padding: 1rem;
        --space-2xl: 3rem;
        --space-3xl: 4rem;
    }

    h1 { font-size: 2.25rem; }
    h2 { font-size: 1.85rem; }
    h3 { font-size: 1.4rem; }
    h4 { font-size: 1.2rem; }

    .section {
        padding: 3rem 0;
    }

    .section-header {
        margin-bottom: 2.5rem;
    }

    .section-tag {
        font-size: 0.7rem;
        padding: 0.4rem 0.85rem;
    }

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

    .section-subtitle {
        font-size: 0.95rem;
    }

    .header-inner {
        padding: 0 1rem;
    }

    .logo-text {
        font-size: 1rem;
    }

    .logo-text small {
        font-size: 0.55rem;
    }

    .hero {
        min-height: 90vh;
        padding-top: calc(var(--header-height) + 2rem);
    }

    .hero-badge {
        font-size: 0.7rem;
        padding: 0.4rem 1rem;
    }

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

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

    .hero-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        padding: 1.5rem 1rem;
    }

    .hero-stat-value {
        font-size: 1.75rem;
    }

    .hero-stat-label {
        font-size: 0.65rem;
        letter-spacing: 0.1em;
    }

    .hero-stat::after {
        display: none !important;
    }

    .btn {
        padding: 0.85rem 1.5rem;
        font-size: 0.8rem;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

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

    .card,
    .service-card,
    .feature-card {
        padding: 1.5rem;
    }

    .stats-panel {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-block {
        padding: 1.5rem 1rem;
    }

    .stat-value {
        font-size: 2rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .feature-grid,
    .services-grid,
    .news-grid {
        grid-template-columns: 1fr;
    }

    .service-icon {
        width: 60px;
        height: 60px;
        padding: 12px;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    .contact-card {
        padding: 1.5rem;
    }

    .form-input,
    .form-textarea,
    .form-select {
        padding: 0.85rem 1rem;
        font-size: 0.95rem;
    }

    .form-label {
        font-size: 0.75rem;
    }

    .page-header {
        padding: calc(var(--header-height) + 2rem) 0 2rem;
    }

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

    .page-description {
        font-size: 1rem;
    }

    .legal-content h2 {
        font-size: 1.4rem;
        margin-top: 2rem;
    }

    .legal-content h3 {
        font-size: 1.15rem;
    }

    .legal-content h4 {
        font-size: 1rem;
    }

    .legal-content table {
        font-size: 0.8rem;
    }

    .legal-content th,
    .legal-content td {
        padding: 0.6rem 0.75rem;
    }

    .legal-toc {
        padding: 1.25rem 1.5rem;
    }

    .legal-meta {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .legal-meta-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .tabs-nav {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .tab-button {
        flex-shrink: 0;
        padding: 0.85rem 1rem;
        font-size: 0.8rem;
    }

    .accordion-header {
        padding: 1rem 1.25rem;
        font-size: 0.9rem;
    }

    .accordion-body {
        padding: 0 1.25rem 1.25rem;
    }

    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 42px;
        height: 42px;
    }

    .toast {
        top: 80px;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }

    .marquee-track {
        gap: 2.5rem;
    }

    .marquee-item {
        font-size: 0.8rem;
    }

    .terminal-block {
        padding: 1rem;
        font-size: 0.75rem;
    }

    .news-image {
        height: 180px;
    }

    .news-body {
        padding: 1.25rem;
    }

    .bar-chart {
        gap: 0.5rem;
    }

    .radar {
        width: 220px;
        height: 220px;
    }

    .orbit {
        width: 160px;
        height: 160px;
    }

    .orbit-ring-3 {
        width: 160px;
        height: 160px;
    }

    .orbit-ring-2 {
        width: 130px;
        height: 130px;
    }

    .orbit-ring-1 {
        width: 90px;
        height: 90px;
    }
}

/* ---------- VERY SMALL SCREENS (≤480px) ---------- */
@media (max-width: 479px) {
    h1 { font-size: 1.85rem; }

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

    .hero-stats {
        grid-template-columns: 1fr;
    }

    .stats-panel {
        grid-template-columns: 1fr;
    }

    .footer-legal {
        flex-direction: column;
        gap: 0.75rem;
    }

    .card-corner {
        display: none;
    }
}

/* ---------- LANDSCAPE PHONE FIXES ---------- */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: calc(var(--header-height) + 2rem) 0 2rem;
    }

    .hero-stats {
        margin-top: 2rem;
    }
}

/* ---------- PRINT STYLES ---------- */
@media print {
    body {
        background: white;
        color: black;
    }

    .site-header,
    .site-footer,
    .back-to-top,
    .loader,
    .matrix-bg,
    .particles-canvas {
        display: none !important;
    }

    a {
        color: black;
        text-decoration: underline;
    }

    .card,
    .service-card,
    .feature-card {
        break-inside: avoid;
        border: 1px solid #ccc;
    }
}

/* ---------- REDUCED MOTION ---------- */
@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;
    }
}

/* ---------- HIGH CONTRAST MODE ---------- */
@media (prefers-contrast: high) {
    :root {
        --text-secondary: #ffffff;
        --text-tertiary: #cccccc;
        --border-line: rgba(0, 240, 255, 0.5);
        --border-glow: rgba(0, 240, 255, 0.7);
    }
}

/* ---------- FOCUS STATES ---------- */
*:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
    border-radius: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline-color: var(--accent-cyan);
}

/* ---------- DARK MODE LOCK (ALWAYS DARK) ---------- */
@media (prefers-color-scheme: light) {
    /* Site is dark mode only - force dark theme */
    :root {
        color-scheme: dark;
    }
}