/* Text Rendering Fix - Nitidez de Texto para Mobile e Desktop */

/* ===== CORREÇÃO GLOBAL DE RENDERIZAÇÃO ===== */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Desabilitar aceleração de hardware que causa blur */
body,
html {
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0) scale(1.0, 1.0);
    transform: none;
}

/* ===== REMOÇÃO DE TEXT-SHADOW EXCESSIVO NO MOBILE ===== */
@media (max-width: 768px) {

    /* Reduzir text-shadow no menu mobile */
    #tm-nav li a,
    #tm-nav a.external-link {
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5) !important;
        font-weight: 500 !important;
    }

    /* Remover text-shadow de headings no mobile */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        text-shadow: none !important;
        font-weight: 600 !important;
    }

    /* Textos gerais sem sombra */
    p,
    span,
    div,
    li {
        text-shadow: none !important;
    }

    /* Botões com sombra sutil */
    button,
    .btn,
    a.inline-block {
        text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.3) !important;
    }
}

/* ===== OTIMIZAÇÃO DE FONTES ===== */
body {
    font-family: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    -webkit-font-feature-settings: "kern" 1;
    font-feature-settings: "kern" 1;
    font-kerning: normal;
}

/* Tamanhos de fonte otimizados para legibilidade mobile */
@media (max-width: 768px) {
    body {
        font-size: 16px !important;
        line-height: 1.6 !important;
    }

    /* Headings com tamanhos otimizados */
    h1 {
        font-size: 2rem !important;
        line-height: 1.25 !important;
        margin-bottom: 1rem !important;
    }

    h2 {
        font-size: 1.75rem !important;
        line-height: 1.3 !important;
        margin-bottom: 0.875rem !important;
    }

    h3 {
        font-size: 1.5rem !important;
        line-height: 1.35 !important;
        margin-bottom: 0.75rem !important;
    }

    h4 {
        font-size: 1.25rem !important;
        line-height: 1.4 !important;
    }

    /* Parágrafos legíveis */
    p {
        font-size: 1rem !important;
        line-height: 1.6 !important;
        margin-bottom: 1rem !important;
    }

    /* Links com contraste */
    a {
        font-weight: 500 !important;
    }
}

/* ===== CORREÇÃO DE CONTRASTE ===== */
@media (max-width: 768px) {

    /* Aumentar contraste de texto em fundos claros */
    .bg-white p,
    .bg-white div,
    .bg-white span,
    .bg-white li {
        color: #2d2d2d !important;
    }

    /* Texto em fundos escuros */
    .parallax-window p,
    .parallax-window div:not(.bg-white),
    .parallax-window span:not(.bg-white span),
    #tm-nav {
        color: #ffffff !important;
    }

    /* Headings escuros em fundos claros */
    .bg-white h1,
    .bg-white h2,
    .bg-white h3,
    .bg-white h4,
    .bg-white h5,
    .bg-white h6 {
        color: #1a1a1a !important;
        font-weight: 700 !important;
    }
}

/* ===== REMOVER TRANSFORMAÇÕES QUE CAUSAM BLUR ===== */
@media (max-width: 768px) {
    * {
        transform: none !important;
        will-change: auto !important;
    }

    /* Permitir apenas transições suaves */
    a,
    button {
        transition: background-color 0.3s ease, color 0.3s ease !important;
        transform: none !important;
    }
}

/* ===== OTIMIZAÇÃO DE INPUTS E FORMS ===== */
@media (max-width: 768px) {

    input,
    textarea,
    select {
        font-size: 16px !important;
        /* Previne zoom no iOS */
        line-height: 1.5 !important;
        -webkit-font-smoothing: antialiased !important;
    }

    input::placeholder,
    textarea::placeholder {
        color: #999999 !important;
        opacity: 1 !important;
    }
}

/* ===== WHATSAPP WIDGETS ===== */
@media (max-width: 768px) {

    #whatsAppWidget,
    #whatsAppWidget2,
    #whatsAppWidget3 {
        text-shadow: none !important;
        float: none !important;
        margin-bottom: 0 !important;
    }

    #whatsAppWidget {
        bottom: 20px !important;
    }

    #whatsAppWidget2 {
        bottom: 85px !important;
    }

    #whatsAppWidget3 {
        bottom: 150px !important;
    }

    /* Corrigir alinhamento interno do widget */
    #whatsAppWidget>div,
    #whatsAppWidget2>div,
    #whatsAppWidget3>div {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 8px !important;
    }

    #whatsAppWidget>div>a,
    #whatsAppWidget2>div>a,
    #whatsAppWidget3>div>a {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 8px !important;
    }

    /* Ícone circular */
    #whatsAppWidget>div>a>div,
    #whatsAppWidget2>div>a>div,
    #whatsAppWidget3>div>a>div {
        float: none !important;
        flex-shrink: 0 !important;
    }

    /* Texto alinhado */
    #whatsAppWidget span,
    #whatsAppWidget2 span,
    #whatsAppWidget3 span {
        font-size: 13px !important;
        font-weight: 600 !important;
        text-shadow: none !important;
        float: none !important;
        margin-top: 0 !important;
        display: inline-block !important;
        vertical-align: middle !important;
    }
}

/* ===== CORREÇÃO DE OPACIDADE ===== */
@media (max-width: 768px) {

    /* Opacidade de fundo mantendo texto nítido */
    .bg-opacity-80,
    .bg-opacity-90 {
        background-color: rgba(255, 255, 255, 0.95) !important;
    }

    /* Garantir que texto dentro não fique translúcido */
    .bg-opacity-80 *,
    .bg-opacity-90 * {
        opacity: 1 !important;
    }
}

/* ===== MENU ESPECÍFICO ===== */
@media (max-width: 768px) {

    /* Menu mais compacto e discreto */
    #tm-nav {
        background-color: rgba(0, 0, 0, 0.92) !important;
        padding: 5px 0 !important;
    }

    #tm-nav .tm-container {
        padding: 0 !important;
    }

    #tm-nav li {
        margin: 0 !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    }

    #tm-nav li:last-child {
        border-bottom: none !important;
    }

    #tm-nav li a {
        font-size: 15px !important;
        font-weight: 500 !important;
        padding: 10px 20px !important;
        letter-spacing: 0.3px !important;
        display: block !important;
    }

    /* Botão toggle mais compacto */
    #menu-toggle,
    #menu-toggle-button {
        padding: 6px 10px !important;
    }
}

/* ===== BOTÕES E CTAs ===== */
@media (max-width: 768px) {

    .tm-bg-green,
    .tm-bg-gold,
    .tm-bg-brown,
    .inline-block[class*="bg-"] {
        font-size: 16px !important;
        font-weight: 600 !important;
        padding: 12px 24px !important;
        text-shadow: none !important;
        letter-spacing: 0.5px !important;
    }
}

/* ===== CARDS E CONTAINERS ===== */
@media (max-width: 768px) {

    .tm-menu-item,
    .tm-menu-item-2 {
        padding: 1.5rem !important;
    }

    .tm-menu-item h3,
    .tm-menu-item-2 h3 {
        font-size: 1.35rem !important;
        font-weight: 700 !important;
        margin-bottom: 0.75rem !important;
        text-shadow: none !important;
    }

    .tm-menu-item p,
    .tm-menu-item-2 p {
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
        text-shadow: none !important;
    }
}

/* ===== BASE DE CONHECIMENTO ===== */
@media (max-width: 768px) {

    .category-card h2,
    .category-card h3 {
        text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.4) !important;
        font-weight: 700 !important;
    }

    .problem-card h3 {
        font-size: 1.1rem !important;
        font-weight: 600 !important;
        text-shadow: none !important;
    }

    .problem-card p {
        font-size: 0.95rem !important;
        line-height: 1.55 !important;
        text-shadow: none !important;
    }
}

/* ===== CORREÇÃO PARA RETINA DISPLAYS ===== */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    body {
        -webkit-font-smoothing: subpixel-antialiased !important;
    }
}

/* ===== GARANTIR SCROLL SUAVE SEM BLUR ===== */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* ===== DESABILITAR BLUR DE PARALLAX NO MOBILE ===== */
@media (max-width: 768px) {
    .parallax-window {
        background-attachment: scroll !important;
    }
}

/* ===== FOOTER ===== */
@media (max-width: 768px) {

    footer p,
    footer span,
    footer a {
        font-size: 14px !important;
        text-shadow: none !important;
        line-height: 1.6 !important;
    }
}