/* ==========================================================
   Mobile Optimization Stylesheet
   Fixes for improved mobile rendering, accessibility, and
   touch interaction. Loaded after styles.css.
   ========================================================== */

/* ── Prevent zoom on input focus (iOS) ── */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="search"],
    input[type="password"],
    input[type="tel"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* ── Touch-friendly tap targets ── */
button,
input[type="button"],
input[type="submit"],
[role="button"] {
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 768px) {
    button,
    input[type="button"],
    input[type="submit"],
    [role="button"] {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ── Prevent horizontal overflow ── */
body {
    overflow-x: hidden;
}

/* ── Table horizontal scroll wrapper ── */
.table-wrapper {
    overflow-x: auto;
}

/* ── Responsive images (only inside content areas, not header) ── */
main img,
.content-section img,
article img,
.container img:not(.logo-img) {
    max-width: 100%;
    height: auto;
}

/* ── Fix double-tap delay ── */
a, button {
    touch-action: manipulation;
}

/* ── Focus states for keyboard navigation ── */
*:focus-visible {
    outline: 2px solid #FF6600;
    outline-offset: 2px;
}

/* ── Mobile nav dropdown overrides ──
   On mobile, the JS toggles display:flex/none via data-open.
   We must reset the desktop opacity/visibility/pointer-events
   so the JS toggle actually works.
   ──────────────────────────────────── */
@media (max-width: 768px) {
    .nav-dropdown-menu {
        /* Reset desktop hover-based show/hide */
        position: static;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        display: none;            /* hidden by default; JS sets flex */
        box-shadow: none;
        border: none;
        border-radius: 0;
        min-width: 0;
        max-width: none;
        margin-top: 0;
        padding-left: var(--spacing-md);
        background: rgba(0, 51, 153, 0.03);
        border-left: 3px solid var(--orange);
        transition: none;
    }

    /* When JS opens it */
    .nav-dropdown-menu[data-open="true"] {
        display: flex;
    }

    .nav-dropdown-menu a {
        font-size: 0.95rem !important;
        padding: var(--spacing-sm) var(--spacing-md) !important;
        min-height: 44px;
        display: flex !important;
        align-items: center;
        border-bottom: 1px solid rgba(0, 51, 153, 0.06);
        white-space: normal;
    }

    .nav-dropdown-menu a:last-child {
        border-bottom: none;
    }

    .nav-dropdown {
        width: 100%;
    }

    .nav-dropdown-toggle {
        width: 100%;
        justify-content: space-between;
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 1rem;
        min-height: 44px;
    }

    .nav-dropdown:hover .nav-dropdown-menu {
        /* Disable hover-based show on mobile — JS handles it */
        opacity: 1;
        visibility: visible;
    }
}

/* ── Consistent heading sizes on mobile ──
   All page heroes use clamp() for h1 already.
   These set consistent sizes for section headings.
   ──────────────────────────────────── */
@media (max-width: 768px) {
    h1,
    .hero h1,
    .hero--simple h1,
    .page-hero h1 {
        font-size: clamp(1.5rem, 5vw, 2.2rem);
    }

    h2,
    .services h2,
    .newsletter-signup h2,
    .content-section h2,
    .section-title,
    .team-section-title,
    .about-values-title {
        font-size: clamp(1.3rem, 4vw, 1.8rem);
    }

    h3,
    .pillar-card h3,
    .blog-card h3,
    .newsletter-card-title {
        font-size: clamp(1rem, 3vw, 1.25rem);
    }
}

@media (max-width: 480px) {
    h1,
    .hero h1,
    .hero--simple h1 {
        font-size: 1.5rem;
    }

    h2,
    .services h2,
    .newsletter-signup h2,
    .content-section h2 {
        font-size: 1.25rem;
    }

    h3,
    .pillar-card h3 {
        font-size: 1rem;
    }
}

/* ── Footer mobile ── */
@media (max-width: 768px) {
    .footer-links {
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-sm);
    }

    .footer-links span[aria-hidden] {
        display: none;
    }

    .disclaimer-text {
        font-size: 0.78rem;
    }

    .disclaimer-text p {
        margin-bottom: var(--spacing-sm);
    }
}

/* ── Ensure forms don't overflow ── */
form {
    max-width: 100%;
}

/* ── Improve spacing for touch devices ── */
@media (hover: none) {
    button:active,
    a:active,
    [role="button"]:active {
        opacity: 0.85;
    }
}

/* ── Reduce motion for accessibility ── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Content text readability ── */
@media (max-width: 480px) {
    body {
        font-size: 16px;
        line-height: 1.6;
    }

    .container {
        padding: 0 var(--spacing-lg);
    }
}

/* ── Hero art image on mobile ── */
@media (max-width: 768px) {
    .hero-art {
        display: none;
    }
}

/* ── List spacing ── */
@media (max-width: 480px) {
    ul, ol {
        margin-left: 16px;
    }
}

/* ── Select dropdown arrow (only for unstyled selects) ── */
select:not([class]) {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 36px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
