/* Uniflow Home — mobile UX refinements
   Scoped to the Home via body.home-page to avoid affecting internal pages. */

@media (max-width: 768px) {
    body.home-page {
        overflow-x: clip;
    }

    body.home-page section[id] {
        scroll-margin-top: 84px;
    }

    /* Keep section rhythm compact and consistent. */
    body.home-page .section {
        padding-block: 3.25rem;
    }

    body.home-page .section-heading {
        max-width: 34rem;
        margin-inline: auto;
        margin-bottom: 2rem;
    }

    body.home-page .section-heading h2 {
        text-wrap: balance;
    }

    /* Cards: improve breathing room without desktop-sized padding. */
    body.home-page .pain-card,
    body.home-page .service-card,
    body.home-page .timeline-step .glass-card {
        border-radius: 20px;
    }

    body.home-page .services-grid,
    body.home-page .cards-grid {
        gap: 1.25rem;
    }

    /* Case study: inline desktop styles were forcing content outside the card. */
    body.home-page #cases {
        margin-bottom: 3.5rem !important;
        scroll-margin-top: 120px;
    }

    body.home-page #cases > .section-heading {
        margin-bottom: 2rem !important;
    }

    body.home-page .case-card {
        width: 100%;
        padding: 1.5rem !important;
        border-radius: 22px !important;
    }

    body.home-page .case-card > div[style*="display: flex"] {
        gap: 2rem !important;
    }

    body.home-page .case-header {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start !important;
        gap: 1rem !important;
        padding-bottom: 1.5rem !important;
    }

    body.home-page .case-header > div:first-child {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
        min-width: 0;
    }

    body.home-page .case-header > div:first-child > div:last-child {
        gap: 0.75rem !important;
    }

    body.home-page .case-header > div:last-child {
        width: 52px !important;
        height: 52px !important;
    }

    body.home-page .case-header h4 {
        font-size: 1.35rem !important;
        line-height: 1.15 !important;
    }

    body.home-page .case-metrics {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1.75rem !important;
    }

    body.home-page .case-metrics .metric-box {
        box-sizing: border-box;
        flex: none !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    body.home-page .case-metrics .metric-box > span {
        max-width: 100%;
        font-size: 0.82rem !important;
        line-height: 1.45 !important;
        letter-spacing: 0.08em !important;
    }

    body.home-page .case-metrics .metric-box > div[style*="align-items: baseline"] {
        max-width: 100%;
        gap: 0.35rem !important;
        flex-wrap: nowrap;
    }

    body.home-page .case-metrics .metric-box > div[style*="align-items: baseline"] > span:first-child {
        flex: 0 0 auto;
        font-size: 1.15rem !important;
    }

    body.home-page .case-metrics .text-gradient {
        min-width: 0;
        font-size: clamp(2.7rem, 13vw, 3.35rem) !important;
        letter-spacing: -0.04em !important;
        white-space: nowrap;
    }

    body.home-page .case-metrics .text-gradient > span {
        font-size: 1.15rem !important;
    }

    body.home-page .case-metrics .metric-box:last-child {
        padding: 1.25rem !important;
    }

    body.home-page .case-metrics .metric-box:last-child div[style*="font-size: 3.5rem"] {
        font-size: clamp(2.5rem, 12vw, 3rem) !important;
    }

    body.home-page .case-metrics .metric-box:last-child span[style*="font-size: 2rem"] {
        font-size: 1.5rem !important;
    }

    /* Testimonials: use the available content width exactly. */
    body.home-page .testimonials-slider-container {
        padding-inline: 0;
    }

    body.home-page .testimonial-card {
        flex-basis: 100%;
        min-width: 100%;
    }

    body.home-page .testimonial-text-wrapper {
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    body.home-page .testimonial-text-content {
        font-size: 1rem;
        line-height: 1.65;
    }

    /* Final CTA: restore mobile hierarchy and remove excessive height. */
    body.home-page #contato {
        padding-block: 3rem;
    }

    body.home-page #contato .main-cta-panel {
        padding: 2.25rem 1.25rem !important;
        border-radius: 22px;
    }

    body.home-page #contato .main-cta-panel h2 {
        max-width: 17ch !important;
        margin-inline: auto !important;
        font-size: clamp(1.75rem, 8vw, 2rem) !important;
        line-height: 1.16 !important;
        letter-spacing: -0.025em;
        text-wrap: balance;
    }

    body.home-page #contato .main-cta-panel p {
        max-width: 30ch;
        margin-inline: auto;
        font-size: 1rem !important;
        line-height: 1.6;
    }

    body.home-page #contato .main-cta-panel .btn {
        width: 100%;
        min-height: 54px;
        justify-content: center;
    }

    /* Floating WhatsApp: smaller and less intrusive on narrow screens. */
    body.home-page .whatsapp-container {
        right: 1rem;
        bottom: 1rem;
        transition: opacity 0.25s ease, transform 0.25s ease;
    }

    body.home-page .fab-whatsapp {
        width: 52px;
        height: 52px;
    }

    body.home-page .fab-whatsapp svg {
        width: 27px;
        height: 27px;
    }

    body.home-page.mobile-bottom-area-visible .whatsapp-container {
        opacity: 0;
        pointer-events: none;
        transform: translateY(18px);
    }

    /* Footer: proportional branding, compact spacing and readable legal copy. */
    body.home-page .footer {
        padding: 5rem 0 1.5rem;
    }

    body.home-page .footer-content {
        gap: 1.75rem !important;
        margin-bottom: 2rem;
    }

    body.home-page .footer .brand {
        display: flex;
        flex-direction: column;
        align-items: center;
        min-width: 0 !important;
    }

    body.home-page .footer-logo {
        display: block;
        width: min(100%, 260px);
        height: auto !important;
        max-height: 62px;
        margin: 0 auto 1rem !important;
        object-fit: contain;
    }

    body.home-page .footer-tagline {
        max-width: 32ch;
        margin: 0 auto;
        font-size: 0.94rem;
        line-height: 1.65;
        text-align: center;
    }

    body.home-page .footer-contact-block {
        gap: 0;
    }

    body.home-page .footer-whatsapp-link {
        font-size: 1.05rem !important;
        gap: 0.55rem !important;
    }

    body.home-page .footer-contact-block > a[href^="mailto:"] {
        max-width: 100%;
        gap: 0.55rem !important;
        font-size: 0.9rem !important;
        overflow-wrap: anywhere;
    }

    body.home-page .footer-social-icons {
        gap: 1.25rem !important;
    }

    body.home-page .footer-navigation {
        margin-top: 0.25rem;
    }

    body.home-page .footer-navigation > div {
        gap: 0.6rem !important;
    }

    body.home-page .footer-navigation a {
        font-size: 0.9rem;
    }

    body.home-page .copyright {
        box-sizing: border-box;
        width: 100%;
        padding: 1.5rem 0 0 !important;
        gap: 0.65rem !important;
    }

    body.home-page .copyright p {
        box-sizing: border-box;
        max-width: 34ch;
        margin-inline: auto !important;
        padding-inline: 0.25rem;
        white-space: normal !important;
        overflow-wrap: anywhere;
        line-height: 1.55;
    }
}

@media (max-width: 360px) {
    body.home-page .container {
        padding-inline: 1rem;
    }

    body.home-page .case-card {
        padding: 1.25rem !important;
    }

    body.home-page .case-header > div:last-child {
        width: 46px !important;
        height: 46px !important;
    }

    body.home-page .case-metrics .text-gradient {
        font-size: 2.55rem !important;
    }

    body.home-page #contato .main-cta-panel {
        padding: 2rem 1rem !important;
    }

    body.home-page #contato .main-cta-panel h2 {
        font-size: 1.65rem !important;
    }

    body.home-page .footer-logo {
        width: min(100%, 230px);
    }

    body.home-page .testimonial-card .stars {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    body.home-page .testimonial-card .stars > div:last-child {
        margin-left: 0 !important;
    }
}
