/* ========== CTM MOBILE RESPONSIVE ========== */
/* California Technical Media Corp. */
/* Include after inline <style> block in each page */

/* Header — prevent wrapping on mid-width screens */
.header__inner {
    flex-wrap: nowrap;
}

/* Mobile-nav-cta: always hidden on desktop, shown only in mobile drawer */
.mobile-nav-cta {
    display: none;
}

/* Hamburger button — hidden on desktop */
.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 201;
    -webkit-tap-highlight-color: transparent;
}
.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--black, #1a1a1a);
    margin: 6px 0;
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}
.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);
}

/* Mobile CTA — hidden on desktop */
.mobile-nav-cta {
    display: none;
}

/* Mobile nav overlay */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 199;
    opacity: 0;
    transition: opacity 0.3s;
}
.mobile-nav-overlay.active {
    opacity: 1;
}

/* ========== BREAKPOINT: TABLET (max-width: 1024px) ========== */
@media (max-width: 1024px) {

    .header__contact .header__phone {
        display: none;
    }

    .header__nav {
        gap: 20px;
    }
}

/* ========== BREAKPOINT: MOBILE (max-width: 900px) ========== */
@media (max-width: 900px) {

    /* Raise header above the overlay so the nav drawer is clickable */
    .header {
        z-index: 201;
    }

    /* Show hamburger */
    .hamburger {
        display: block;
        order: 3;
    }

    /* Header layout */
    .header__inner {
        padding: 12px 16px;
    }

    .header__contact {
        gap: 12px;
    }

    .header__contact .header__phone {
        display: none;
    }

    .header__contact .btn {
        display: none;
    }

    /* Mobile nav drawer */
    .header__nav {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: -300px;
        width: 280px;
        height: 100vh;
        background: var(--white, #ffffff);
        z-index: 200;
        padding: 80px 24px 32px;
        gap: 0;
        box-shadow: -4px 0 24px rgba(0,0,0,0.12);
        transition: right 0.3s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .header__nav.mobile-open {
        right: 0;
    }

    .mobile-nav-overlay.active {
        display: block;
        opacity: 1;
    }

    /* Top-level nav link (non-dropdown) */
    .nav-link {
        display: block;
        width: 100%;
        padding: 16px 0;
        font-size: 16px !important;
        font-weight: 600 !important;
        color: var(--black, #1a1a1a) !important;
        border-bottom: 1px solid #e5e5e5;
    }

    /* Dropdown behavior on mobile — click-to-expand */
    .nav-dropdown {
        width: 100%;
        border-bottom: 1px solid #e5e5e5;
    }

    .nav-dropdown__trigger {
        display: flex;
        justify-content: space-between;
        width: 100%;
        padding: 16px 0;
        font-size: 16px;
        font-weight: 600;
        color: var(--black, #1a1a1a);
    }

    .nav-dropdown__trigger::after {
        content: '+';
        font-size: 18px;
        font-weight: 400;
        transition: transform 0.2s;
    }

    .nav-dropdown.open .nav-dropdown__trigger::after {
        content: '−';
    }

    /* Disable desktop hover */
    .nav-dropdown:hover .nav-dropdown__menu {
        display: none;
    }

    .nav-dropdown__menu {
        display: none !important;
        position: static;
        box-shadow: none;
        border: none;
        padding: 0 0 12px 12px;
        min-width: unset;
    }

    .nav-dropdown.open .nav-dropdown__menu {
        display: block !important;
    }

    .nav-dropdown__menu a {
        padding: 10px 0;
        font-size: 15px;
        color: var(--grey-dark, #4a4a4a);
    }

    /* Mobile CTA inside drawer */
    .mobile-nav-cta {
        display: block;
        margin-top: 24px;
        padding-top: 24px;
        border-top: 1px solid #e5e5e5;
    }

    .mobile-nav-cta a.btn {
        display: block;
        text-align: center;
        width: 100%;
        margin-bottom: 12px;
    }

    .mobile-nav-cta .mobile-phone {
        display: block;
        text-align: center;
        font-size: 16px;
        font-weight: 600;
        color: var(--black, #1a1a1a);
        padding: 8px 0;
    }

    /* Hero adjustments */
    .hero {
        height: auto !important;
        min-height: 400px;
    }

    .hero__content {
        padding: 60px 16px !important;
    }

    .hero__text {
        max-width: 100% !important;
    }

    .hero__quote {
        font-size: 30px !important;
        line-height: 1.25 !important;
    }

    .hero__subtext {
        font-size: 17px !important;
    }

    .hero__tagline {
        font-size: 22px !important;
        margin-bottom: 24px !important;
    }

    .hero__overlay {
        background: linear-gradient(
            to bottom,
            rgba(20, 18, 16, 0.85) 0%,
            rgba(20, 18, 16, 0.7) 40%,
            rgba(20, 18, 16, 0.5) 70%,
            rgba(20, 18, 16, 0.3) 100%
        ) !important;
    }

    /* Sections */
    .section {
        padding: 48px 0 !important;
    }

    .container {
        padding: 0 16px !important;
    }

    .section__title {
        font-size: 28px !important;
        margin-bottom: 16px !important;
    }

    .section__subtitle {
        font-size: 17px !important;
        margin-bottom: 32px !important;
    }

    /* Services grid — stack on mobile */
    .services__grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .service-card {
        padding: 24px !important;
    }

    /* Why CTM grid — stack on mobile */
    .why-ctm__grid {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }

    /* Solution questions box */
    .solution__questions {
        padding: 20px !important;
        margin: 24px 0 !important;
    }

    /* CTA section */
    .cta-section {
        padding: 48px 0 !important;
    }

    .cta-section__title {
        font-size: 28px !important;
    }

    .cta-section__contact {
        font-size: 17px !important;
    }

    /* Footer */
    .footer__inner {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .footer__links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 16px;
    }

    /* Buttons — full width on very small screens */
    .btn--large {
        padding: 14px 24px !important;
        font-size: 16px !important;
    }

    /* Page header (inner pages) */
    .page-header {
        padding: 48px 0 !important;
    }

    .page-header h1 {
        font-size: 30px !important;
    }

    /* Two-column layouts — stack */
    .about-grid,
    .team-grid,
    .capabilities__grid,
    .method__grid,
    .content-grid {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }

    /* Tables — horizontal scroll */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Vimeo embeds — responsive */
    .video-embed,
    .vimeo-embed {
        position: relative;
        padding-bottom: 56.25%;
        height: 0;
        overflow: hidden;
    }

    .video-embed iframe,
    .vimeo-embed iframe {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

    /* Image gallery modals */
    .modal-content img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Accessibility widget adjustments */
    #ctm-a11y-trigger {
        bottom: 16px !important;
        right: 16px !important;
        width: 48px !important;
        height: 48px !important;
    }

    #ctm-a11y-panel {
        right: 8px !important;
        left: 8px !important;
        bottom: 72px !important;
        width: auto !important;
        max-height: 70vh !important;
    }

    .ctm-a11y-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .ctm-a11y-btn {
        padding: 12px 8px !important;
    }
}

/* ========== BREAKPOINT: SMALL MOBILE (max-width: 480px) ========== */
@media (max-width: 480px) {

    .hero__quote {
        font-size: 26px !important;
    }

    .hero__tagline {
        font-size: 20px !important;
    }

    .section__title {
        font-size: 24px !important;
    }

    .btn--large {
        display: block !important;
        text-align: center;
    }

    /* Accessibility panel — almost full width */
    #ctm-a11y-panel {
        right: 4px !important;
        left: 4px !important;
    }

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

/* Touch-friendly tap targets */
@media (pointer: coarse) {
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .nav-dropdown__menu a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .footer__links a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}
