/*
 * CanalClear — Shared Mobile Responsiveness
 * Injected into all pages via <link rel="stylesheet" href="/css/mobile.css">
 */

/* ── Hamburger Button ─────────────────────────────────────────────── */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: 1px solid rgba(0, 212, 170, 0.3);
    border-radius: 8px;
    cursor: pointer;
    padding: 8px;
    gap: 5px;
    flex-shrink: 0;
    z-index: 9999;
}
.hamburger-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: #00D4AA;
    border-radius: 2px;
    transition: all 0.25s ease;
    transform-origin: center;
}
.hamburger-btn.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.hamburger-btn.open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.hamburger-btn.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ── Mobile Nav Overlay ───────────────────────────────────────────── */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 62px; /* start below nav, so hamburger stays clickable */
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 22, 40, 0.97);
    z-index: 9000;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 1rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-top: 1px solid rgba(0, 212, 170, 0.12);
}

/* Nav stays above overlay */
nav {
    z-index: 9999 !important;
}
.mobile-nav-overlay.open {
    display: flex;
}
.mobile-nav-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: 100%;
    max-width: 320px;
}
.mobile-nav-links a {
    display: block;
    width: 100%;
    text-align: center;
    padding: 1rem 1.5rem;
    color: #C4D0DC;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    font-family: 'DM Sans', sans-serif;
    border-bottom: 1px solid rgba(136, 153, 170, 0.1);
    transition: color 0.15s;
}
.mobile-nav-links a:first-child {
    border-top: 1px solid rgba(136, 153, 170, 0.1);
}
.mobile-nav-links a:hover,
.mobile-nav-links a:active {
    color: #00D4AA;
    background: rgba(0, 212, 170, 0.05);
}
.mobile-nav-links a.mobile-cta {
    background: #00D4AA;
    color: #0A1628;
    font-weight: 700;
    border-radius: 10px;
    margin-top: 1.5rem;
    border: none;
    padding: 0.9rem 2rem;
}
.mobile-nav-links a.mobile-cta:hover {
    background: #00bfa0;
    color: #0A1628;
}

/* ── Hide desktop nav links on mobile ────────────────────────────── */
@media (max-width: 768px) {
    .hamburger-btn {
        display: flex !important;
    }
    /* Hide nav links containers — handled by JS adding class */
    .nav-links {
        display: none !important;
    }
    /* Hide inline nav right divs that get .nav-links-inline class */
    .nav-links-inline {
        display: none !important;
    }
    nav {
        padding: 0.85rem 1.25rem !important;
    }
}

/* ── Common Mobile Layout Fixes ──────────────────────────────────── */
@media (max-width: 768px) {
    /* Typography */
    body {
        font-size: 16px;
    }

    /* Sections */
    section, .section {
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
    }

    /* Grids → single column */
    .grid-2,
    .grid-3,
    .grid-4,
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns: repeat(2"],
    [style*="grid-template-columns: repeat(3"],
    [style*="grid-template-columns: repeat(4"] {
        grid-template-columns: 1fr !important;
    }

    /* Tables → scrollable */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    /* Buttons — minimum 44px tap target */
    button, .btn, [role="button"],
    a[style*="border-radius"][style*="padding"] {
        min-height: 44px;
    }

    /* Images */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Modals */
    .modal-content, .modal-box, .modal-panel, [class*="modal"] {
        width: 95vw !important;
        max-width: 95vw !important;
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    section, .section {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}
