/* ============================================================
   Viadireta — Mobile / responsive refinements
   Loaded AFTER site.css. Improves the experience on phones and
   small tablets without altering the desktop design.
   ============================================================ */

/* ---- Prevent accidental horizontal scrolling (phones/tablets only) ---- */
html { -webkit-text-size-adjust: 100%; }
@media (max-width: 900px) {
    html, body { overflow-x: clip; }
}

/* ============================================================
   Home "services-cta" block (replaces former inline styles)
   ============================================================ */
.home-cta-inner { position: relative; }
.home-cta-text { padding-right: 380px; text-align: left; }
.home-cta-img { position: absolute; right: 0; bottom: -60px; width: 340px; }

@media (max-width: 860px) {
    /* Section is the positioning context; pad-bottom reserves space for the image */
    .home-cta { overflow: hidden !important; padding-bottom: 240px !important; }
    .home-cta-inner { position: static; padding-bottom: 0; }
    .home-cta-text { padding-right: 0; text-align: center; }
    .home-cta-img {
        position: absolute;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        width: min(260px, 68%);
        right: auto;
        margin: 0;
    }
}

/* ============================================================
   Mobile navigation (drawer shown at <= 900px)
   ============================================================ */
@media (max-width: 900px) {
    .nav { position: relative; flex-wrap: wrap; }

    /* Make the open menu a comfortable, scrollable drawer */
    .nav.open ul {
        gap: 2px;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
        box-shadow: 0 12px 28px rgba(0,0,0,0.35);
        padding: 12px 14px 18px;
    }
    .nav.open ul > li { width: 100%; }

    /* Full-width, finger-friendly tap targets */
    .nav.open .nav-link,
    .nav.open .nav-btn {
        width: 100%;
        justify-content: space-between;
        padding: 13px 14px;
        font-size: 1rem;
        border-radius: 6px;
    }
    .nav.open .nav-btn { background: rgba(255,255,255,0.06); }
    .nav.open .nav-link { background: rgba(255,255,255,0.06); display: flex; align-items: center; }
    .nav.open .dropdown.open > .nav-btn { background: rgba(255,255,255,0.14); }

    /* Sub-menu items inside the drawer */
    .nav.open .dropdown-menu { padding: 2px 0 6px; }
    .nav.open .dropdown-menu a {
        padding: 12px 14px 12px 26px;
        font-size: 0.95rem;
        border-radius: 6px;
    }
    .nav.open .dropdown-menu a:hover { background: rgba(255,255,255,0.1); }

    /* Reset the "myVD" button's desktop negative margins so it fits the drawer */
    .nav.open .nav-myvd {
        margin: 8px 0 0;
        align-self: stretch;
    }
    .nav.open .nav-myvd .nav-cta {
        width: 100%;
        justify-content: center;
        border-radius: 6px;
        padding: 10px 16px;
    }
    .nav.open .nav-myvd .nav-cta img { height: 30px; }

    /* Bigger, easier hamburger hit area */
    .mobile-toggle {
        padding: 6px 10px;
        line-height: 1;
        border-radius: 6px;
    }
    .mobile-toggle:hover { background: rgba(255,255,255,0.12); }
}

/* ============================================================
   Typography & spacing scaling on phones
   ============================================================ */
@media (max-width: 600px) {
    section { padding: 46px 0; }
    .section-title { font-size: 1.45rem; margin-bottom: 32px; letter-spacing: 0.5px; }

    .hero { min-height: 360px; }
    .hero-content { padding: 240px 20px 20px; gap: 0; }
    .hero h1 { font-size: 1.95rem; margin-bottom: 10px; }
    .hero .tagline { font-size: 1.02rem; margin-bottom: 0; }
    .quote-form { padding: 20px 18px; }
    .quote-form h2 { font-size: 1.3rem; margin-bottom: 14px; }

    .page-header { padding: 22px 18px 18px; }
    .page-header h1 { font-size: 1.8rem; }
    .page-header p { font-size: 1rem; }

    .banner-bottom { font-size: 1.1rem; padding: 40px 18px; }

    .services-cta { padding: 48px 18px; }
    .services-cta h2 { font-size: 1.4rem; }

    .about-historia, .about-quote-section, .about-mv-section,
    .about-valores-section, .about-join-section { padding: 44px 18px; }
    .about-section-title { font-size: 1.2rem; }
    .about-quote { font-size: 1.1rem; padding-left: 16px; }

    /* Single column for value cards on phones */
    .valores-grid { grid-template-columns: 1fr; }
    /* Steps: one per row reads better than cramped pairs on small phones */
    .steps { gap: 18px; }
}

@media (max-width: 400px) {
    .hero h1 { font-size: 1.65rem; }
    .section-title { font-size: 1.3rem; }
    .page-header h1 { font-size: 1.55rem; }
    .steps { grid-template-columns: 1fr; }
}

/* ============================================================
   Forms: 16px inputs prevent iOS Safari auto-zoom on focus
   ============================================================ */
@media (max-width: 600px) {
    .form-field input,
    .form-field select,
    .form-field textarea,
    .cand-field input,
    .cand-field select,
    .cand-field textarea,
    .footer-track-controls input,
    .tracking-bar input { font-size: 16px; }

    /* Tracking bar stacks cleanly */
    .tracking-bar .container { gap: 12px; }
    .tracking-bar form { flex-direction: column; width: 100%; }
    .tracking-bar form .btn { width: 100%; }
}

/* ============================================================
   Comparison-style service grid: tidy stacked appearance
   (site.css collapses it to a single column at <= 900px)
   ============================================================ */
@media (max-width: 900px) {
    .services-grid { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
    .services-grid .head { padding: 16px 14px; }
    .services-grid > div { padding: 12px; }
}

/* ============================================================
   Services section: card layout on phones (replaces the grid)
   Built dynamically by JS in home.blade.php
   ============================================================ */
.svc-mobile-cards { display: none; } /* hidden by default, JS shows on mobile */

@media (max-width: 640px) {
    .svc-mobile-cards {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    .svc-mobile-card {
        background: #fff;
        border-radius: 10px;
        overflow: hidden;
        box-shadow: 0 3px 14px rgba(0,0,0,0.09);
    }
    .svc-mobile-head {
        background: #0d3a6d;
        color: #fff;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        padding: 18px 16px;
    }
    .svc-mobile-head a { color: #fff; font-weight: 700; font-size: 1rem; text-decoration: none; }
    .svc-mobile-head .svc-icon {
        width: 46px; height: 46px;
        background: rgba(255,255,255,0.15);
        border-radius: 50%;
        display: grid; place-items: center;
    }
    .svc-mobile-head .svc-icon svg { width: 24px; height: 24px; }
    .svc-mobile-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 11px 16px;
        border-top: 1px solid #e5e7eb;
        font-size: 0.88rem;
    }
    .svc-mobile-row:nth-child(odd) { background: #f8fafc; }
    .svc-mobile-lbl { color: #0d3a6d; font-weight: 600; flex: 1; padding-right: 12px; }
    .svc-mobile-val { color: #374151; text-align: right; }
}

/* ============================================================
   Tracking result card stacks on narrow screens
   ============================================================ */
@media (max-width: 540px) {
    .tracking-status-card { flex-direction: column; text-align: center; gap: 14px; padding: 20px 18px; }
    .ts-meta { min-width: 0; }
    .contact-tracking-notice { flex-direction: column; align-items: flex-start; }
    .contact-tracking-btn { width: 100%; text-align: center; }
}

/* ============================================================
   Custom date picker must never overflow a small viewport
   ============================================================ */
@media (max-width: 360px) {
    .dp-cal { width: min(294px, calc(100vw - 28px)); }
}

/* ============================================================
   API docs: let wide tables scroll instead of breaking layout
   ============================================================ */
@media (max-width: 700px) {
    .api-table { display: block; overflow-x: auto; white-space: nowrap; }
    .api-section h2 { font-size: 1.1rem; }
}

/* ============================================================
   Footer: stack columns on phones for readability
   ============================================================ */
@media (max-width: 560px) {
    .footer-top { grid-template-columns: 1fr; gap: 28px; }
}

/* ============================================================
   Footer tracking strip — mobile clean-up
   ============================================================ */
@media (max-width: 640px) {
    /* Remove the fancy diagonal ::before — looks broken on narrow screens */
    .footer-track-strip::before { display: none; }

    /* Stretch to full viewport width cancelling the parent's padding */
    .footer-track-strip {
        margin-left: -20px;
        margin-right: -20px;
        padding: 24px 20px;
        min-height: 0;
    }
    .footer-track-inner { justify-content: center; min-height: 0; padding: 0; }

    /* Stack: title → input → button, all full-width */
    .footer-track-form {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
        max-width: 420px;
        margin: 0 auto;
    }
    .footer-track-form label {
        font-size: 1.1rem;
        text-align: center;
        white-space: normal;
        margin-bottom: 2px;
    }

    /* Controls stack vertically too */
    .footer-track-controls {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }
    .footer-track-controls input {
        width: 100%;
        font-size: 16px; /* prevent iOS zoom */
        height: 46px;
    }
    .footer-track-controls button {
        height: 46px;
        width: 100%;
        font-size: 1rem;
    }
}
