/* ==========================================================================
   TrocaDireta — Breakpoints (mobile-first)
   sm 480 · md 768 · lg 1024 · xl 1280
   ========================================================================== */

/* ---- Telefones muito estreitos ---- */
@media (min-width: 1024px) and (max-width: 1279px) {
    .header .header__nav { display: none; }
    .header .header__toggle { display: inline-grid; }
}

@media (max-width: 479px) {
    .header__inner { gap: 8px; }
    .header__inner > .brand { min-width: 0; flex: 1; }
    .header__inner .brand__logo { max-width: 100%; width: 150px; height: auto; }
    .header__actions { gap: 4px; flex-shrink: 0; }
}

@media (max-width: 379px) {
    :root {
        --stub-w: 104px;
        --notch: 11px;
    }

    .coupon-card__body { padding: var(--space-4) var(--space-4) var(--space-3); }
    .coupon-card__title { font-size: var(--fs-md); }
    .redeem-choice { grid-template-columns: 1fr; }
    .redeem-choice__btn { min-height: 112px; }
    .otp input { width: 40px; height: 52px; }
}

/* ---- sm ---- */
@media (min-width: 480px) {
    .form-grid--2 { grid-template-columns: repeat(2, 1fr); }
    .form-grid--2 .is-full { grid-column: 1 / -1; }

    .toast-region {
        left: auto;
        right: var(--space-5);
        bottom: var(--space-5);
        width: 380px;
    }

    .steps__label { display: block; }

    .coupon-detail__facts { grid-template-columns: repeat(3, 1fr); }
}

/* ---- md ---- */
@media (min-width: 768px) {
    :root {
        --gutter: 24px;
        --stub-w: 140px;
        --notch: 14px;
    }

    .section { padding-block: var(--space-16); }

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

    .form-grid--3 { grid-template-columns: repeat(3, 1fr); }
    .form-grid--3 .is-full { grid-column: 1 / -1; }

    .header__city { display: inline-flex; }

    .search-bar__field--city { display: flex; }

    .footer__grid { grid-template-columns: 1.4fr repeat(3, 1fr); }

    /* modal centralizado */
    .modal { place-items: center; padding: var(--space-6); }
    .modal__dialog {
        width: min(560px, 100%);
        border-radius: var(--radius-lg);
        padding: var(--space-8);
    }
    .modal--lg .modal__dialog { width: min(820px, 100%); }

    .hero { padding-block: var(--space-16) var(--space-20); }

    .page-hero { padding-block: var(--space-16) var(--space-10); }
    .page-hero__title { font-size: var(--fs-4xl); }

    .merchant-band {
        grid-template-columns: 1.5fr 1fr;
        align-items: center;
        padding: var(--space-12) var(--space-10);
    }

    .merchant-band__free { justify-self: end; }

    .benefits { grid-template-columns: repeat(3, 1fr); }

    .how-steps { grid-template-columns: repeat(2, 1fr); }

    .store-profile__cover { height: 280px; }

    .store-profile__head {
        grid-template-columns: auto 1fr auto;
        align-items: end;
        margin-top: -48px;
    }

    .wallet-hello {
        grid-template-columns: 1fr auto;
        align-items: end;
        padding: var(--space-8);
    }

    .onboarding__card { padding: var(--space-10); }

    .offer-sticky { display: none; }
    .has-offer-sticky { padding-bottom: 0; }

    .auth { grid-template-columns: 1fr 1fr; }

    .auth__aside {
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        gap: var(--space-8);
        padding: var(--space-10);
        background: var(--color-ink);
        color: #dbe5ee;
        overflow: hidden;
    }

    .auth__aside-title {
        font-family: var(--font-display);
        font-weight: var(--fw-black);
        line-height: 1.02;
        letter-spacing: -0.02em;
        max-width: 14ch;
        font-size: var(--fs-3xl);
        font-variation-settings: "wdth" var(--wdth-expanded);
        color: #fff;
    }

    .auth__aside .coupon-card { max-width: 420px; transform: rotate(-4deg); }

    .auth__main { padding: var(--space-10); }
    .auth__aside ~ .auth__main .auth__brand { display: none; }

    .redemption-confirm { padding: var(--space-8); }
    .redemption-confirm__banner { margin: calc(var(--space-8) * -1) calc(var(--space-8) * -1) 0; padding: var(--space-6) var(--space-8); }
    .redemption-confirm__actions { grid-template-columns: 1fr 1fr; }

    .scan-fab { bottom: var(--space-6); right: var(--space-6); }

    .checkout { grid-template-columns: 1.4fr 1fr; align-items: start; }

    .legal { grid-template-columns: 220px 1fr; }
    .legal__toc { display: block; position: sticky; top: calc(var(--header-h) + var(--space-6)); align-self: start; }
}

/* ---- lg ---- */
@media (min-width: 1024px) {
    .grid--3 { grid-template-columns: repeat(3, 1fr); }

    .header__nav { display: flex; }
    .header__toggle { display: none; }

    .hero__inner { grid-template-columns: 1.15fr 1fr; }
    .hero__stack { min-height: 440px; }
    .hero__stack .coupon-card:nth-child(2) { top: 140px; }
    .hero__stack .coupon-card:nth-child(3) { top: 280px; }

    .split { grid-template-columns: 1fr 1fr; align-items: center; gap: var(--space-12); }

    .how-steps { grid-template-columns: repeat(5, 1fr); }
    .how-steps__item { grid-template-columns: 1fr; }

    .catalog { grid-template-columns: 260px 1fr; align-items: start; }
    .catalog__filters { display: block; }
    .catalog__filter-toggle { display: none; }

    .offer-layout { grid-template-columns: 1.25fr 1fr; align-items: start; }
    .offer-layout__aside { position: sticky; top: calc(var(--header-h) + var(--space-6)); }

    /* App shell com sidebar fixa visível */
    .app { grid-template-columns: var(--sidebar-w) 1fr; }
    .app__sidebar {
        position: sticky;
        top: 0;
        height: 100dvh;
        grid-row: 1 / -1;
        transform: none;
        box-shadow: none;
    }
    .app__sidebar.is-open { box-shadow: none; }
    .app__menu-toggle { display: none; }
    .app__main { padding: var(--space-8) var(--space-8) var(--space-16); }

    .area-cliente .bottom-nav { display: none; }
    .area-cliente .app__main { padding-bottom: var(--space-16); }

    .dash-grid { grid-template-columns: 1.4fr 1fr; }
    .dash-grid > .is-wide { grid-column: 1 / -1; }

    .campaign-editor { grid-template-columns: 1fr 380px; align-items: start; }

    .scan-shortcut { display: inline-flex; }
    .area-lojista .scan-fab { display: none; }
    .area-lojista .scan-fab.is-always { display: inline-flex; }
}

/* ---- xl ---- */
@media (min-width: 1280px) {
    .app__main { padding-inline: var(--space-12); }
}

/* ---- Movimento reduzido: tickets da home sem animação ---- */
@media (prefers-reduced-motion: reduce) {
    .hero__stack .coupon-card { animation: none; }
    .scanner__line { animation: none; top: 50%; }
    .coupon-card:hover { transform: none; }
}

/* ---- Contraste alto ---- */
@media (forced-colors: active) {
    .coupon-card__ticket,
    .coupon-detail__ticket,
    .brand__logo { forced-color-adjust: none; }
    .status-pill,
    .button { border: 1px solid ButtonText; }
}
