/* ============================================================
   NEXUS AI — RESPONSIVE / MOBILE-FIRST STYLESHEET
   Breakpoints:
     lg   : max-width 1200px  (large desktop)
     md   : max-width  992px  (tablet landscape)
     sm   : max-width  768px  (tablet portrait)
     xs   : max-width  576px  (mobile)
   ============================================================ */

/* ============================================================
   LANGUAGE TOGGLE BUTTON
   ============================================================ */
.lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 13px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--color-text-primary, #f0f4ff);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.lang-toggle:hover {
    background: rgba(108, 99, 255, 0.18);
    border-color: var(--color-neon-primary, #6c63ff);
    color: var(--color-neon-primary, #6c63ff);
}

.lang-toggle i { font-size: 0.85rem; }

/* Drawer variant — full-width pill */
.lang-toggle--drawer {
    width: 100%;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

/* LTR body adjustments */
body.lang-en {
    direction: ltr;
    text-align: left;
}

body.lang-en .nexus-breadcrumbs__list { direction: ltr; }

/* ============================================================
   HERO TITLE — AI decode sweep keyframe
   ============================================================ */
@keyframes heroTitleSweep {
    0%   { background-position: 100% center; }
    100% { background-position: -100% center; }
}

/* ============================================================
   GLOBAL OVERFLOW LOCK — prevents any element from causing
   Android / iOS to zoom-out the initial viewport
   ============================================================ */
html {
    overflow-x: hidden;
    max-width: 100%;
}

/* Contain decorative sections that hold large neon-glow blobs */
.page-hero,
.contact-page,
.services-page,
.portfolio-page,
.about-page,
.homepage-cta,
.homepage-partners,
.homepage-stats,
.homepage-testimonials,
.homepage-team {
    overflow: hidden;
}

/* Hard-limit all media and embeds */
img,
video,
iframe,
canvas,
svg,
embed,
object {
    max-width: 100%;
}

/* Prevent wide tables from breaking layout */
table {
    max-width: 100%;
    word-break: break-word;
}

/* ============================================================
   BREADCRUMBS
   ============================================================ */
.nexus-breadcrumbs {
    padding: 12px 0;
    font-size: var(--text-sm, 0.875rem);
}

.nexus-breadcrumbs__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    direction: rtl;
}

.nexus-breadcrumbs__item a {
    color: var(--color-text-muted, #8892b0);
    text-decoration: none;
    transition: color 0.2s ease;
}

.nexus-breadcrumbs__item a:hover {
    color: var(--color-neon-primary, #6c63ff);
}

.nexus-breadcrumbs__item--current {
    color: var(--color-text-body, #ccd6f6);
}

.nexus-breadcrumbs__sep {
    color: var(--color-text-muted, #8892b0);
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    margin: 0 2px;
}

/* ============================================================
   LARGE DESKTOP  ≤1200px
   ============================================================ */
@media (max-width: 1200px) {
    .container {
        max-width: 100%;
        padding-inline: 24px;
    }

    .hero__headline {
        font-size: clamp(2rem, 5vw, 3.5rem);
    }

    .footer__grid {
        grid-template-columns: 1fr 1fr 1fr 1fr;
        gap: 32px;
    }

    .homepage-services__grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .homepage-portfolio__grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .homepage-stats__grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .homepage-team__grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================================
   TABLET LANDSCAPE  ≤992px
   ============================================================ */
@media (max-width: 992px) {
    /* --- Typography scaling --- */
    :root {
        --text-6xl: 3rem;
        --text-5xl: 2.5rem;
        --text-4xl: 2rem;
        --text-3xl: 1.5rem;
    }

    /* --- Container --- */
    .container {
        padding-inline: 20px;
    }

    /* --- Navbar: hide desktop links, show hamburger --- */
    .navbar__menu { display: none; }
    .navbar__actions .navbar__cta { display: none; }
    .navbar__hamburger { display: flex; }

    /* --- Hero --- */
    .hero {
        min-height: 90vh;
        padding-top: 120px;
    }

    .hero__content {
        max-width: 100%;
        text-align: center;
    }

    .hero__cta {
        justify-content: center;
    }

    .hero__stats {
        justify-content: center;
    }

    .hero__visual { display: none; }

    /* --- Services grid: 2 cols --- */
    .homepage-services__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* --- Portfolio grid: 2 cols --- */
    .homepage-portfolio__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* --- Stats grid: 2 cols --- */
    .homepage-stats__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    /* --- Team grid: 2 cols --- */
    .homepage-team__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* --- Testimonials --- */
    .testimonials-slider {
        grid-template-columns: 1fr;
    }

    /* --- About section: stack --- */
    .about__inner {
        flex-direction: column;
        gap: 40px;
    }

    .about__visual { max-width: 100%; }

    /* --- Contact page: stack --- */
    .contact__grid {
        grid-template-columns: 1fr;
    }

    /* --- Footer: 2-col --- */
    .footer__grid {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }

    .footer__col--about {
        grid-column: 1 / -1;
    }

    /* --- CTA card: stack --- */
    .footer__cta-card {
        flex-direction: column;
        text-align: center;
    }

    .footer__cta-buttons {
        justify-content: center;
    }

    .footer__cta-graphic { display: none; }

    /* --- Blog grid: 2 cols --- */
    .blog__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* --- Page sections --- */
    .page-hero__title {
        font-size: clamp(1.8rem, 4vw, 2.5rem);
    }

    /* --- FAQ accordion --- */
    .faq__grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   TABLET LANDSCAPE  ≤992px  (additions)
   ============================================================ */
@media (max-width: 992px) {
    /* Features section: stack — code card goes on top */
    .features__layout {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .features__visual {
        order: -1;          /* code card above the list */
        max-width: 600px;
        margin-inline: auto;
        width: 100%;
    }

    /* Make code horizontally scrollable instead of overflowing */
    .features__code {
        overflow-x: auto;
        font-size: 0.82rem !important;
        white-space: pre;
    }
}

/* ============================================================
   TABLET PORTRAIT  ≤768px
   ============================================================ */
@media (max-width: 768px) {
    /* --- Global spacing --- */
    section { padding-block: 60px; }

    .container { padding-inline: 16px; }

    /* --- Section headings --- */
    .section-title { font-size: clamp(1.5rem, 5vw, 2rem); }
    .section-subtitle { font-size: var(--text-base, 1rem); }

    /* --- Navbar --- */
    .navbar__container {
        padding-inline: 16px;
    }

    /* Mobile drawer full-width */
    .navbar__drawer {
        width: 100%;
    }

    /* --- Hero --- */
    .hero {
        padding-top: 100px;
        padding-bottom: 60px;
    }

    .hero__headline {
        font-size: clamp(1.8rem, 7vw, 2.8rem);
    }

    .hero__subheadline {
        font-size: var(--text-base, 1rem);
    }

    .hero__stats {
        flex-wrap: wrap;
        gap: 16px;
    }

    .hero__stat-value {
        font-size: clamp(1.5rem, 5vw, 2rem);
    }

    /* Particles canvas: reduce on mobile for perf */
    #particles-js { opacity: 0.4; }

    /* --- Services: 1 col --- */
    .homepage-services__grid {
        grid-template-columns: 1fr;
    }

    /* --- Portfolio: 1 col --- */
    .homepage-portfolio__grid {
        grid-template-columns: 1fr;
    }

    .portfolio-filter {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }

    /* --- Stats: 2 col --- */
    .homepage-stats__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* --- Team: 1 col --- */
    .homepage-team__grid {
        grid-template-columns: 1fr;
        max-width: 380px;
        margin-inline: auto;
    }

    /* --- Partners marquee: slower --- */
    .partners-track {
        animation-duration: 25s;
    }

    /* --- Footer: 1 col --- */
    .footer__grid {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .footer__col--about { grid-column: auto; }

    .footer__bottom-inner {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .footer__bottom-links {
        justify-content: center;
    }

    /* --- Newsletter form --- */
    .footer__newsletter-input {
        flex-direction: row;
    }

    /* --- Blog: 1 col --- */
    .blog__grid {
        grid-template-columns: 1fr;
    }

    /* --- Single post --- */
    .single-post__sidebar { display: none; }

    .single-post__layout {
        grid-template-columns: 1fr;
    }

    /* --- Page hero --- */
    .page-hero {
        padding-block: 80px 40px;
    }

    .page-hero__title {
        font-size: clamp(1.6rem, 6vw, 2.2rem);
    }

    /* --- Services page --- */
    .services__grid {
        grid-template-columns: 1fr;
    }

    /* --- Portfolio page --- */
    .portfolio__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* --- Contact page --- */
    .contact-grid {
        grid-template-columns: 1fr;
    }

    .contact-form-wrapper {
        padding: var(--space-6, 24px) !important;
        order: 1;
    }

    .contact-info {
        order: 2;
    }

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

    .contact-info__card {
        padding: var(--space-6, 24px) !important;
    }

    /* --- Testimonials --- */
    .testimonials__grid {
        grid-template-columns: 1fr;
    }

    /* --- CTA section --- */
    .cta-section__inner {
        flex-direction: column;
        gap: 24px;
        text-align: center;
    }

    .cta-section__actions {
        justify-content: center;
    }

    /* --- Process steps: stack --- */
    .process__steps {
        flex-direction: column;
    }

    .process__step-connector { display: none; }

    /* --- AI page features --- */
    .ai-features__grid {
        grid-template-columns: 1fr;
    }

    /* --- Stats bar: stack items --- */
    .stats-bar {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .stats-item { justify-content: center; }

    /* --- Services preview grid: 1 col --- */
    .services-preview__grid {
        grid-template-columns: 1fr;
    }

    /* --- Portfolio preview grid: 1 col --- */
    .portfolio-preview__grid {
        grid-template-columns: 1fr;
    }

    /* --- Hero float cards: show compact row on mobile --- */
    .hero__float-card {
        display: inline-flex;
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    /* --- Features code card: shrink font, allow scroll --- */
    .features__card {
        display: block;
        overflow: hidden;
    }

    .features__code {
        font-size: 0.75rem !important;
        padding: var(--space-4) !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .features__visual {
        max-width: 100%;
    }

    /* --- Prevent decorative glows from causing layout overflow --- */
    .neon-glow,
    .page-hero__glow,
    .hero__orb,
    .footer__glow {
        max-width: 100vw;
        overflow: hidden;
    }

    /* --- Breadcrumbs --- */
    .nexus-breadcrumbs {
        padding: 8px 0;
        font-size: 0.8rem;
    }

    /* --- Back to top offset --- */
    .back-to-top {
        bottom: 80px;
        left: 16px;
    }

    /* --- WhatsApp float --- */
    .whatsapp-float {
        bottom: 16px;
        left: 16px;
    }

    .whatsapp-float__label { display: none; }

    /* --- Cookie bar --- */
    .cookie-bar__inner {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    /* --- Theme toggle --- */
    .theme-toggle {
        top: auto;
        bottom: 80px;
        right: 0;
    }
}

/* ============================================================
   MOBILE  ≤576px
   ============================================================ */
@media (max-width: 576px) {
    /* --- Hard viewport lock for very small screens --- */
    * { max-width: 100%; }
    /* pre/code must scroll, not wrap — override the * rule */
    pre, code {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        word-break: normal;
        white-space: pre;
    }

    .features__code {
        font-size: 0.7rem !important;
        line-height: 1.6;
    }

    /* --- Typography floor --- */
    :root {
        --text-6xl: 2.2rem;
        --text-5xl: 2rem;
        --text-4xl: 1.75rem;
        --text-3xl: 1.375rem;
        --text-2xl: 1.25rem;
    }

    .container { padding-inline: 12px; }

    /* --- Navbar height --- */
    :root { --navbar-height: 64px; }

    .navbar__logo-text { font-size: 1.2rem; }
    .navbar__logo img  { height: 36px; }

    /* --- Hero --- */
    .hero {
        padding-top: 84px;
        text-align: center;
    }

    .hero__badge { font-size: 0.75rem; }

    .hero__headline {
        font-size: clamp(1.6rem, 8vw, 2.2rem);
        line-height: 1.3;
    }

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

    .hero__cta .btn {
        width: 100%;
        justify-content: center;
    }

    .hero__stats {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .hero__stat { min-width: unset; }

    /* --- Cards: full width --- */
    .service-card,
    .portfolio-card,
    .team-card,
    .testimonial-card {
        max-width: 100%;
    }

    /* --- Stats: 1 col on very small screens --- */
    .homepage-stats__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card { padding: 20px 12px; }

    /* --- Portfolio page: 1 col --- */
    .portfolio__grid {
        grid-template-columns: 1fr;
    }

    /* --- Buttons --- */
    .btn {
        padding: 10px 20px;
        font-size: 0.875rem;
    }

    .btn-lg {
        padding: 12px 24px;
        font-size: 1rem;
    }

    /* --- Form elements --- */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    textarea,
    select {
        font-size: 16px; /* prevent iOS zoom */
    }

    /* --- Glass cards on mobile --- */
    .glass-card {
        padding: 20px 16px;
    }

    /* --- Section headings --- */
    .section-header {
        margin-bottom: 32px;
    }

    .section-title {
        font-size: clamp(1.4rem, 6vw, 1.8rem);
    }

    /* --- Footer CTA --- */
    .footer__cta-card {
        padding: 28px 16px;
    }

    .footer__cta h2 {
        font-size: 1.4rem;
    }

    .footer__cta-buttons {
        flex-direction: column;
        gap: 12px;
    }

    .footer__cta-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    /* --- Footer bottom --- */
    .footer__main { padding-block: 40px; }

    /* --- Blog card --- */
    .blog-card__meta { flex-wrap: wrap; gap: 6px; }

    /* --- 404 page --- */
    .error-404__number { font-size: clamp(4rem, 20vw, 8rem); }

    /* --- Dashboard widget responsive --- */
    #nexus_stats_widget .inside > div {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* --- Skip link visible on focus --- */
    .skip-link:focus {
        position: fixed;
        top: 4px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 100000;
        background: var(--color-neon-primary, #6c63ff);
        color: #fff;
        padding: 8px 20px;
        border-radius: 4px;
        font-size: 0.875rem;
        text-decoration: none;
    }
}

/* ============================================================
   REDUCED MOTION (already in premium.css — reinforced here)
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .hero__headline,
    .split-word__inner,
    [data-gsap],
    [data-aos] {
        transition: none !important;
        animation: none !important;
        transform: none !important;
        opacity: 1 !important;
    }

    .partners-track {
        animation: none !important;
    }
}

/* ============================================================
   PRINT — minimal readable layout
   ============================================================ */
@media print {
    .navbar,
    .footer,
    .whatsapp-float,
    .cookie-bar,
    .theme-toggle,
    .back-to-top,
    .hero__cta,
    .page-transition,
    .custom-cursor,
    #particles-js,
    .loading-overlay {
        display: none !important;
    }

    body {
        background: #fff !important;
        color: #000 !important;
        font-size: 12pt;
    }

    a {
        color: #000 !important;
        text-decoration: underline;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    .glass-card {
        border: 1px solid #ccc !important;
        background: #fff !important;
        backdrop-filter: none !important;
        box-shadow: none !important;
    }

    @page {
        margin: 20mm 15mm;
        size: A4;
    }
}
