/* =====================================================================
   responsive.css — mobile-first additions to the existing design system
   ---------------------------------------------------------------------
   CASCADE STRATEGY
   ---------------------------------------------------------------------
   Existing files (tokens.css, components.css) are DESKTOP-FIRST and use
   `@media (max-width: 960px)` for mobile overrides. This file is loaded
   LAST in app.blade.php, after tokens/components/app, so its rules win
   any cascade ties at equal specificity.

   Rules of engagement:
     1. Use `@media (min-width: …)` only — never max-width.
     2. The unprefixed (default) block IS the mobile baseline.
     3. To beat existing `@media (max-width: 960px) { .nav { display:none } }`
        we use a slightly higher selector specificity (`.nav-drawer .nav`)
        rather than `!important`.
     4. Breakpoint scale: 480 / 768 / 1024 / 1280 (matches Tailwind sm/md/lg/xl).
     5. Add NEW responsive rules here, do not edit tokens.css/components.css —
        keeps desktop output bit-for-bit identical when this file is removed.
   ===================================================================== */


/* ---------------------------------------------------------------------
   Body scroll-lock (driven by Alpine x-effect on <header>)
   --------------------------------------------------------------------- */
body.menu-open {
    overflow: hidden;
    /* iOS Safari: extra belt-and-suspenders to pin scroll */
    touch-action: none;
}


/* ---------------------------------------------------------------------
   Mobile-first nav drawer (default = mobile, off-canvas)
   --------------------------------------------------------------------- */
.nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 26, 20, 0.45);
    z-index: 49; /* below header (50), above content */
}

.nav-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(360px, 86vw);
    background: var(--paper);
    border-left: 1px solid var(--rule);
    box-shadow: -20px 0 40px -20px rgba(15, 26, 20, 0.25);
    z-index: 51; /* above header */
    padding: 96px 28px 28px;
    transform: translateX(100%);
    transition: transform .28s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 28px;
}
.nav-drawer.is-open { transform: translateX(0); }

/* Inside the drawer, force nav + CTA visible.
   Specificity 0,2,0 beats existing `.nav { display:none }` (0,1,0)
   inside `@media (max-width: 960px)` from tokens.css. */
.nav-drawer .nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: stretch;
}
.nav-drawer .nav a {
    padding: 14px 4px;
    font-size: 17px;
    border-bottom: 1px solid var(--rule);
}
.nav-drawer .nav a.active::after { display: none; }
.nav-drawer .nav a.active { color: var(--green-900); font-weight: 600; }

.nav-drawer .header-cta {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--rule);
}
.nav-drawer .header-cta .btn {
    display: inline-flex;
    width: 100%;
    justify-content: center;
}
.nav-drawer .header-phone a {
    color: var(--green-900);
    text-decoration: none;
    font-size: 20px;
}

/* Burger touch target (44x44 minimum per WCAG) */
.burger {
    min-width: 44px;
    min-height: 44px;
}
.burger:focus-visible {
    outline: 2px solid var(--green-700);
    outline-offset: 2px;
}


/* ---------------------------------------------------------------------
   Reduced-motion guard for the drawer slide
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .nav-drawer { transition: none; }
}


/* ---------------------------------------------------------------------
   Tablet (>= 768px) — fill the missing 2-col tier
   --------------------------------------------------------------------- */
@media (min-width: 768px) {
    .services-preview .cards { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
    .hero .meta-row { grid-template-columns: repeat(3, 1fr); }
}


/* ---------------------------------------------------------------------
   Desktop (>= 1024px) — drawer collapses back to inline header
   --------------------------------------------------------------------- */
@media (min-width: 1024px) {
    /* Drawer becomes the inline flex container that previously held nav + CTA */
    .nav-drawer {
        position: static;
        width: auto;
        background: transparent;
        border: 0;
        box-shadow: none;
        padding: 0;
        transform: none;
        overflow: visible;
        flex-direction: row;
        gap: 24px;
        align-items: center;
    }
    .nav-drawer .nav {
        flex-direction: row;
        gap: 28px;
        align-items: center;
    }
    .nav-drawer .nav a {
        padding: 4px 0;
        font-size: 15px;
        border-bottom: 0;
    }
    .nav-drawer .nav a.active::after {
        display: block;
        content: "";
        position: absolute;
        left: 0; right: 0; bottom: -4px;
        height: 2px;
        background: var(--green-800);
    }
    .nav-drawer .header-cta {
        flex-direction: row;
        gap: 16px;
        margin-top: 0;
        padding-top: 0;
        border-top: 0;
    }
    .nav-drawer .header-cta .btn { width: auto; }

    .nav-backdrop { display: none; }
    .burger { display: none; }

    .services-preview .cards { grid-template-columns: repeat(3, 1fr); }
    .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; }
}


/* ---------------------------------------------------------------------
   Phone-specific safety: kill sticky chrome below 768px
   Sticky header + sidebar combined eat ~30% of small viewports.
   --------------------------------------------------------------------- */
@media (max-width: 767.98px) {
    /* exception to the "min-width only" rule — these unstick existing
       desktop-first sticky declarations that misbehave on phones. */
    .site-header { position: relative; }
}


/* ---------------------------------------------------------------------
   Responsive image defaults — when <picture>/srcset is used, ensure the
   <img> fills its container without breaking aspect ratio.
   --------------------------------------------------------------------- */
.responsive-img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
}


/* ---------------------------------------------------------------------
   Shared service-detail blocks: quick-facts + process-steps grids.
   Mobile-first: single column on phones, two columns from 480px up.
   --------------------------------------------------------------------- */
.svc-quick-facts,
.svc-process-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
.svc-process-grid { gap: 24px; counter-reset: step; margin-top: 20px; }
@media (min-width: 480px) {
    .svc-quick-facts { grid-template-columns: 1fr 1fr; }
    .svc-process-grid { grid-template-columns: 1fr 1fr; }
}


/* ---------------------------------------------------------------------
   In-content CTA block (used inside service detail pages).
   Stacks on phones, becomes row at ~600px.
   --------------------------------------------------------------------- */
.svc-cta-band {
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: 8px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
@media (min-width: 600px) {
    .svc-cta-band {
        flex-direction: row;
        align-items: center;
        gap: 24px;
        padding: 32px;
    }
    .svc-cta-band > div { flex: 1 1 60%; }
}


/* ---------------------------------------------------------------------
   Global CTA band (the heading + phone + buttons strip).
   Mobile-first single column; two-column row from 768px.
   --------------------------------------------------------------------- */
.cta-band .inner {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: stretch;
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    padding: 28px;
}
.cta-band__contact {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}
.cta-band__buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-start;
}
@media (min-width: 768px) {
    .cta-band .inner {
        grid-template-columns: 1.5fr 1fr;
        gap: 48px;
        align-items: center;
        padding: 48px;
    }
    .cta-band__contact { text-align: right; }
    .cta-band__buttons { justify-content: flex-end; }
}


/* ---------------------------------------------------------------------
   Form components: honeypot (visually hidden, screen-reader hidden via
   aria-hidden in markup) and Cloudflare Turnstile width guard.
   --------------------------------------------------------------------- */
.honeypot {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
.cf-turnstile {
    max-width: 100%;
    overflow: hidden;
}
/* Cloudflare injects an inline width on its iframe — !important is the
   only way to override without a JS shim. */
.cf-turnstile iframe { max-width: 100% !important; }


/* ---------------------------------------------------------------------
   Topbar contacts (the right-hand cluster of phone + email + telegram).
   The inner flex container used to be an inline style — moved here so
   we can selectively hide low-priority links on narrow phones.
   --------------------------------------------------------------------- */
.topbar-contacts {
    display: flex;
    gap: 28px;
    align-items: center;
}


/* ---------------------------------------------------------------------
   Phone polish (<= 479px) — tighter gutters, narrower license strip,
   drop email/telegram from the topbar so the phone number stays
   readable without horizontal scroll.
   Exception to the "min-width only" rule — these target the phone tier
   specifically and cannot be expressed as a min-width breakpoint.
   --------------------------------------------------------------------- */
@media (max-width: 479.98px) {
    .container { padding: 0 16px; }
    .license-strip .items { gap: 14px; }
    .license-strip .item b { font-size: 20px; }
    .topbar .container { gap: 12px; font-size: 11px; }
    .topbar-contacts { gap: 12px; }
    /* Keep the phone visible — it's the most critical contact.
       Email and Telegram are still in the drawer + footer. */
    .topbar-email,
    .topbar-tg { display: none; }
}
