/* =========================
   Musinga Advocates — Responsive Enhancements
   Mobile-First, Touch-Optimized
   ========================= */

/* ===== LARGE DESKTOP (> 1400px) ===== */
@media (min-width: 1400px) {
    .container {
        max-width: 1400px;
    }

    .hero {
        min-height: 95vh;
    }
}

/* ===== DESKTOP (1020px - 1400px) ===== */
@media (min-width: 1020px) and (max-width: 1400px) {
    .container {
        padding: 0 2rem;
    }
}

/* ===== TABLET LANDSCAPE (768px - 1020px) ===== */
@media (max-width: 1020px) {

    /* Grid Adjustments */
    .grid.two {
        grid-template-columns: 1fr !important;
        gap: 2rem;
    }

    .grid.three {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem;
    }

    .grid.four {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Header & Navigation */
    .nav-toggle {
        display: flex !important;
    }

    .site-header .nav {
        position: absolute;
        inset: 68px 0 auto 0;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--soft-gray);
        display: none;
        padding: 0.8rem 0;
        box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
    }

    .site-header .nav.open {
        display: block;
    }

    .nav-list {
        flex-direction: column;
        align-items: flex-start;
        padding: 0 1.5rem;
        gap: 0.3rem;
    }

    .nav-list a {
        display: block;
        width: 100%;
        padding: 0.9rem 1rem;
        border-radius: var(--radius-sm);
    }

    /* Hero Section */
    .hero {
        min-height: 75vh;
        padding: 140px 20px 100px;
    }

    .hero .brandline {
        font-size: clamp(2.2rem, 5vw, 3.2rem);
    }

    .hero .eyebrow {
        font-size: 1.2rem;
    }

    /* Sections */
    .section {
        padding: 4rem 0;
    }

    .section-head {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Practice Areas */
    #practice .cards.grid.three {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Team */
    #team .cards {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Clients */
    .client-card {
        min-width: 220px !important;
        max-width: 220px !important;
        padding: 1.2rem 1rem;
    }

    .client-card img {
        height: 70px;
    }

    /* Branches/Offices */
    #branches .grid.three {
        grid-template-columns: 1fr !important;
    }

    #branches .card {
        margin-bottom: 1.5rem;
    }

    #branches iframe {
        height: 280px !important;
    }
}

/* ===== TABLET PORTRAIT (460px - 768px) ===== */
@media (max-width: 768px) {

    /* Typography */
    h1 {
        font-size: clamp(2rem, 5vw, 2.6rem);
    }

    h2 {
        font-size: clamp(1.6rem, 4vw, 2rem);
    }

    h3 {
        font-size: clamp(1.2rem, 3vw, 1.5rem);
    }

    /* Header - Center brand name, hide logo on mobile */
    .nav-row {
        padding: 0.6rem 0;
        position: relative;
    }

    .brand {
        margin: 0 auto;
        max-width: calc(100% - 60px);
        /* Leave space for hamburger */
        overflow: visible;
    }

    .brand-container {
        gap: 0;
        justify-content: center;
        overflow: visible;
    }

    /* Hide logo on mobile/tablet */
    .brand-logo {
        display: none;
    }

    /* Show brand text on mobile/tablet - single line */
    .brand-text {
        display: flex !important;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        text-align: center;
        white-space: nowrap;
        gap: 0.35rem;
        width: 100%;
    }

    .brand-name {
        font-size: 0.95rem;
        font-weight: 700;
    }

    .brand-suffix {
        font-size: 0.8rem;
        margin-top: 0;
        margin-left: 0;
        font-weight: 700;
    }

    .nav-toggle {
        position: absolute;
        right: 1rem;
        top: 50%;
        transform: translateY(-50%);
        z-index: 10;
    }

    /* Spacing */
    .section {
        padding: 3.5rem 0;
    }

    .container {
        padding: 0 1.2rem;
    }

    /* Grid */
    .grid {
        gap: 1.5rem;
    }

    .grid.three {
        grid-template-columns: 1fr !important;
    }

    /* Practice Areas - Full width cards on mobile like Mission/Vision */
    #practice .cards.grid.three {
        grid-template-columns: 1fr !important;
    }

    #practice .card.practice-card {
        width: 100%;
        max-width: 100%;
    }

    /* Fix Our Evolution section - stack zigzag rows vertically on mobile */
    .zigzag-row {
        flex-direction: column !important;
    }

    .zigzag-row.reverse {
        flex-direction: column !important;
    }

    .zigzag-text,
    .zigzag-image {
        width: 100% !important;
        flex: none !important;
    }

    .zigzag-row img {
        height: auto !important;
        max-height: 300px;
    }

    /* Hero */
    .hero {
        min-height: 65vh;
        padding: 120px 20px 80px;
    }

    .hero .brandline {
        font-size: clamp(2rem, 6vw, 2.8rem);
    }

    .hero .tagline {
        font-size: 1.1rem;
    }

    .hero .sub {
        font-size: 0.95rem;
    }

    /* Ribbon */
    .ribbon .container {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem 1.5rem;
    }

    .ribbon .r-item {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        font-size: 0.9rem;
    }

    /* Cards */
    .card {
        padding: 1.5rem;
    }

    /* Practice Areas */
    #practice .filters {
        justify-content: center;
    }

    /* Team */
    #team .cards {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem;
    }

    .team-card img {
        width: 140px;
        height: 140px;
    }

    .team-card .meta h3 {
        font-size: 1.05rem;
    }

    /* Clients */
    .marquee {
        padding: 1.5rem 1rem;
        gap: 1.5rem;
    }

    .client-card {
        min-width: 70% !important;
        max-width: 70% !important;
        padding: 1.2rem 1rem;
    }

    .client-card img {
        height: 65px;
    }

    .client-card .name {
        font-size: 0.9rem;
    }

    /* Contact Form */
    #contact form>div {
        grid-template-columns: 1fr !important;
    }

    /* Modal */
    .modal-dialog {
        width: 95%;
        max-height: 85vh;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .modal .bio-head {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .modal .bio-head img {
        width: 120px;
        height: 120px;
    }
}

/* ===== MOBILE (< 460px) ===== */
@media (max-width: 460px) {

    /* Typography - Mobile Optimized */
    h1 {
        font-size: clamp(1.8rem, 6vw, 2.2rem);
    }

    h2 {
        font-size: clamp(1.4rem, 5vw, 1.8rem);
    }

    h3 {
        font-size: clamp(1.1rem, 4vw, 1.3rem);
    }

    body {
        padding-top: 64px;
    }

    /* Container */
    .container {
        padding: 0 1rem;
    }

    /* Spacing */
    .section {
        padding: 2.5rem 0;
    }

    .grid {
        gap: 1.2rem;
    }

    /* Header */
    .site-header {
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
    }

    .nav-row {
        padding: 0.7rem 0;
    }

    .logo-type {
        font-size: 1.1rem;
    }

    .nav-toggle {
        padding: 0.4rem;
    }

    .nav-toggle span {
        width: 24px;
        height: 2.5px;
    }

    /* Hero - Mobile First */
    .hero {
        min-height: 60vh;
        padding: 100px 16px 60px;
    }

    .hero .eyebrow {
        font-size: 1rem;
        margin-bottom: 0.8rem;
    }

    .hero .brandline {
        font-size: clamp(1.8rem, 7vw, 2.5rem);
        gap: 0.3ch;
    }

    .hero .tagline {
        font-size: 1rem;
        margin: 1rem 0 0.6rem;
    }

    .hero .sub {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    .hero .cta {
        margin-top: 2rem;
        margin-bottom: 0;
    }

    /* Fix scroll indicator - ensure it's not hidden by Learn More button, positioned independently below */
    .scroll-indicator {
        bottom: 20px !important;
        z-index: 10;
        position: absolute !important;
    }

    /* Ensure hero has enough bottom padding for scroll indicator */
    .hero {
        padding-bottom: 80px !important;
    }

    /* Speed up client marquee on mobile - faster and closer together */
    .clients-marquee {
        gap: 0.75rem !important;
        animation: marqueeScroll 20s linear infinite !important;
    }

    /* Buttons - Touch Friendly */
    .btn {
        padding: 0.85rem 1.4rem;
        font-size: 0.95rem;
        min-height: 44px;
        /* Touch target */
    }

    .btn-sm {
        padding: 0.7rem 1.1rem;
        font-size: 0.9rem;
        min-height: 40px;
    }

    /* Ribbon */
    .ribbon {
        padding: 1.2rem 0;
    }

    .ribbon .container {
        flex-direction: column;
        gap: 0.8rem;
    }

    .ribbon .r-item {
        justify-content: center;
        text-align: center;
        font-size: 0.85rem;
    }

    .ribbon i {
        font-size: 1.2rem;
    }

    /* Cards */
    .card {
        padding: 1.2rem;
        border-radius: var(--radius-sm);
    }

    /* Section Headers */
    .section-head {
        margin-bottom: 1.8rem;
    }

    .section-head h2 {
        margin-bottom: 0.8rem;
    }

    /* Filters - Mobile Friendly */
    .filters {
        gap: 0.5rem;
        justify-content: center;
    }

    .chip {
        padding: 0.55rem 1rem;
        font-size: 0.85rem;
        min-height: 40px;
    }

    /* Practice Areas */
    #practice .cards {
        gap: 1.2rem;
    }

    #practice .card .icon {
        font-size: 2rem;
    }

    /* Team - Single Column */
    #team .cards {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }

    .team-card img {
        width: 160px;
        height: 160px;
        margin: 1.2rem auto 0.8rem;
    }

    .team-card .meta {
        padding: 0 1rem 0.6rem;
    }

    .team-card .meta h3 {
        font-size: 1.1rem;
    }

    .team-card .meta p {
        font-size: 0.85rem;
    }

    .team-card .actions {
        padding: 0.6rem 1rem 1.2rem;
    }

    .team-card .btn-bio {
        padding: 0.65rem 1.3rem;
        font-size: 0.85rem;
        min-height: 44px;
    }

    /* Clients - Mobile Optimized */
    .marquee {
        padding: 1.2rem 0.8rem;
        gap: 1rem;
        animation-duration: 20s !important;
    }

    .clients-marquee-wrapper {
        padding: 1.5rem 0;
        mask-image: linear-gradient(to right,
                transparent 0%,
                black 5%,
                black 95%,
                transparent 100%);
        -webkit-mask-image: linear-gradient(to right,
                transparent 0%,
                black 5%,
                black 95%,
                transparent 100%);
    }

    .clients-marquee {
        gap: 0.75rem !important;
        animation: marqueeScroll 20s linear infinite !important;
    }

    .client-card {
        min-width: 140px !important;
        max-width: 140px !important;
        padding: 1rem 0.75rem;
        border-radius: var(--radius-sm);
        flex-shrink: 0;
    }

    .client-card img {
        height: 60px;
    }

    .client-card .name {
        font-size: 0.88rem;
    }

    /* Branches/Offices */
    #branches .card {
        padding: 1.2rem;
    }

    #branches h3 {
        font-size: 1.2rem;
    }

    #branches iframe {
        height: 240px !important;
        border-radius: var(--radius-sm);
    }

    /* Contact Form - Mobile */
    .contact form label {
        font-size: 0.9rem;
    }

    .contact input,
    .contact select,
    .contact textarea {
        padding: 0.85rem 0.9rem;
        font-size: 0.95rem;
        min-height: 44px;
    }

    .contact textarea {
        min-height: 120px;
    }

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

    .form-actions button {
        width: 100%;
        min-height: 48px;
    }

    /* Footer */
    .site-footer {
        padding: 2.5rem 0 1.5rem;
    }

    .site-footer .grid.three {
        grid-template-columns: 1fr !important;
        gap: 2rem;
    }

    .site-footer h4 {
        font-size: 1.05rem;
    }

    .slogan {
        font-size: 0.85rem;
        letter-spacing: 1px;
    }

    /* Modal - Mobile */
    .modal {
        padding: 1rem;
    }

    .modal-dialog {
        width: 100%;
        max-height: 88vh;
        border-radius: var(--radius-sm);
    }

    .modal-close {
        top: 0.8rem;
        right: 0.8rem;
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }

    .modal-body {
        padding: 1.2rem;
    }

    .modal .bio-head {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1rem;
        margin-bottom: 1.2rem;
        padding-bottom: 1.2rem;
    }

    .modal .bio-head img {
        width: 110px;
        height: 110px;
    }

    .modal .bio-head h3 {
        font-size: 1.3rem;
    }

    .modal .bio-body p {
        font-size: 0.95rem;
        line-height: 1.7;
    }
}

/* ===== EXTRA SMALL MOBILE (< 360px) ===== */
@media (max-width: 360px) {
    .container {
        padding: 0 0.8rem;
    }

    .hero .brandline {
        font-size: 1.6rem;
    }

    .btn {
        padding: 0.75rem 1.2rem;
        font-size: 0.9rem;
    }

    .client-card {
        min-width: 92% !important;
        max-width: 92% !important;
    }

    .team-card img {
        width: 140px;
        height: 140px;
    }
}

/* ===== LANDSCAPE MODE FIXES ===== */
@media (max-height: 600px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 80px 20px 60px;
    }

    .modal-dialog {
        max-height: 95vh;
    }
}

/* ===== PRINT STYLES ===== */
@media print {

    .site-header,
    .nav-toggle,
    .ribbon,
    .filters,
    .btn,
    .modal,
    .site-footer {
        display: none !important;
    }

    body {
        padding-top: 0;
        background: white;
        color: black;
    }

    .section {
        page-break-inside: avoid;
        padding: 1rem 0;
    }

    .card {
        border: 1px solid #ccc;
        box-shadow: none;
        page-break-inside: avoid;
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .marquee {
        animation: none;
    }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    .card {
        border-width: 2px;
    }

    .btn {
        border-width: 3px;
    }
}