/*
 * Te Explico — Etapa 24
 * Responsividade, acessibilidade e SEO visual.
 * Carregado por último para complementar as Etapas 19–23.
 */

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
}

img,
svg,
video,
canvas {
    max-width: 100%;
}

a,
button,
input,
select,
textarea,
summary {
    -webkit-tap-highlight-color: transparent;
}

a,
button,
summary {
    touch-action: manipulation;
}

.te-skip-link {
    position: fixed;
    top: .65rem;
    left: .65rem;
    z-index: 9999;
    padding: .75rem 1rem;
    border: 3px solid #fff;
    border-radius: .75rem;
    background: var(--te-color-navy-900, #102A56);
    color: #fff;
    box-shadow: 0 8px 28px rgba(16, 42, 86, .28);
    font-weight: 800;
    text-decoration: none;
    transform: translateY(-180%);
    transition: transform .18s ease;
}

.te-skip-link:focus {
    color: #fff;
    transform: translateY(0);
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 3px solid var(--te-color-yellow-500, #FFC83D);
    outline-offset: 3px;
}

#conteudo-principal:focus {
    outline: none;
}

.te-site-nav a,
.te-mobile-panel a,
.te-public-footer a,
.te-legal-header a {
    text-underline-offset: .18em;
}

.te-mobile-menu-button,
.te-site-header__actions .te-btn,
.te-mobile-panel__actions .te-btn {
    min-width: 44px;
    min-height: 44px;
}

.te-mobile-panel[aria-hidden="true"] {
    pointer-events: none;
}

.te-faq-item summary {
    cursor: pointer;
}

.te-faq-item summary::marker {
    color: var(--te-primary, #3154C8);
}

.te-faq-item summary:focus-visible {
    border-radius: .7rem;
}

.te-legal-content {
    overflow-wrap: anywhere;
}

.te-legal-content p,
.te-home-faq p,
.te-public-footer span,
.te-public-footer p {
    max-width: 75ch;
}

.te-home-hero__copy {
    text-wrap: pretty;
}

.te-home-faq__intro h2,
.te-legal-hero h1 {
    text-wrap: balance;
}

/* Diagnóstico da Etapa 24 */
.te-home-stage24-diagnostics {
    padding: 2.5rem 0 4rem;
    border-top: 1px solid var(--te-border-default);
    background: var(--te-bg-page);
}

.te-home-stage24-diagnostics__banner {
    margin-bottom: 1.4rem;
    padding: 1.45rem 1.6rem;
    border-radius: var(--te-radius-xl);
    background: var(--te-color-success-600);
    color: #fff;
    box-shadow: var(--te-shadow-md);
}

.te-home-stage24-diagnostics__banner h2 {
    color: inherit;
    font-size: 1.45rem;
}

.te-home-stage24-diagnostics__banner p {
    margin-top: .25rem;
}

.te-home-stage24-diagnostics__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.te-home-stage24-diagnostics__note {
    margin-top: 1rem;
    padding: 1rem 1.15rem;
    border-radius: var(--te-radius-lg);
    background: var(--te-color-blue-100);
    color: var(--te-color-navy-900);
}

/* Tablet */
@media (max-width: 900px) {
    .te-site-header__inner,
    .te-legal-header__inner {
        padding-inline: max(1rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-right));
    }

    .te-mobile-panel {
        max-height: calc(100dvh - 88px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .te-home-stage24-diagnostics__grid {
        grid-template-columns: 1fr;
    }
}

/* Celulares */
@media (max-width: 620px) {
    .te-container {
        width: min(100% - 1.25rem, var(--te-container-max, 1180px));
    }

    .te-site-header__brand img,
    .te-legal-header__brand img {
        height: auto;
    }

    .te-home-hero__actions .te-btn,
    .te-mobile-panel__actions .te-btn {
        min-height: 48px;
    }

    .te-how-step,
    .te-subject-card,
    .te-discovery-panel,
    .te-faq-item,
    .te-legal-content,
    .te-legal-hero {
        min-width: 0;
    }

    .te-home-hero__copy,
    .te-ai-copy p,
    .te-faq-item__answer,
    .te-legal-content p {
        overflow-wrap: anywhere;
    }

    .te-public-footer__column a {
        display: inline-flex;
        min-height: 44px;
        align-items: center;
    }
}

/* Telas muito estreitas */
@media (max-width: 390px) {
    .te-container {
        width: min(100% - .9rem, var(--te-container-max, 1180px));
    }

    .te-home-hero__actions {
        gap: .6rem;
    }

    .te-home-hero__actions .te-btn {
        width: 100%;
    }

    .te-subject-grid {
        grid-template-columns: 1fr;
    }

    .te-discovery-panel--ai {
        grid-template-columns: 1fr;
    }

    .te-ai-phone {
        display: none;
    }

    .te-legal-header nav {
        gap: .5rem;
        font-size: .76rem;
    }
}

/* Acessibilidade: usuário que prefere menos animações */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto !important;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

/* Contraste alto do sistema */
@media (prefers-contrast: more) {
    :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
        outline-width: 4px;
        outline-color: currentColor;
    }

    .te-faq-item,
    .te-legal-content,
    .te-discovery-panel {
        border-color: #64748b;
    }
}
