/* ============================================
   PIRANOT V5 — RESPONSIVE
   Padrão UOL: mobile-first, tipografia e
   espaçamentos profissionais
   Última revisão: 18/02/2026
   ============================================ */

/* ============================================
   RESET GLOBAL
   ============================================ */
html {
    overflow-x: hidden;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

*, *::before, *::after {
    box-sizing: border-box;
}

img, video, iframe, embed, object {
    max-width: 100%;
    height: auto;
}

p, h1, h2, h3, h4, h5, h6, li, td, th {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: none;
}

a { word-break: normal; hyphens: none; }

.grid-featured__card-title,
.grid-featured__main-title,
.section-category__card-title,
.section-trending__link,
.section-trending__headline,
.section-trending__headline a,
.hero-slider__title,
.hero-slider__title a,
.hero .side .card h3,
.pira-ticker a,
h3 a, h2 a {
    word-break: normal !important;
    overflow-wrap: normal !important;
    hyphens: none !important;
}

.container,
.wrap,
.content-layout,
.home-container {
    width: 100%;
    max-width: 100%;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
}

/* ============================================
   TABLET LARGO (1100px)
   ============================================ */
@media (max-width: 1100px) {
    .container { flex-direction: column; gap: 24px; }
    .sidebar-content { flex: 1 1 100%; }
    .hero .main { flex: 1 1 100%; }
    .hero .side { flex: 1 1 100%; flex-direction: row; }
    .hero .side .card { flex: 1 1 calc(50% - 8px); }

    .content-layout { gap: 24px !important; padding: 24px 20px !important; }
    .main-content { flex: 1 1 100% !important; max-width: 100% !important; }
    .sidebar { flex: 1 1 100% !important; width: 100% !important; max-width: 100% !important; position: relative !important; top: 0 !important; }
}

/* ============================================
   TABLET PAISAGEM (900px)
   ============================================ */
@media (max-width: 900px) {
    .hero { flex-direction: column; }
    .hero .main { order: 1; }
    .hero .side { order: 2; flex-wrap: wrap; }
    .hero .side .card { flex: 1 1 calc(50% - 6px); }
    .topbar .wrap { flex-wrap: wrap; }
    .top-search-form { order: 3; width: 100%; margin-top: 8px; max-width: none; }
    .brand-link { order: 1; flex-basis: auto; }
    .topbar .tools { order: 2; }
    .section .grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
}

/* ============================================
   MOBILE GRANDE (768px) - ponto critico UOL
   ============================================ */
@media (max-width: 768px) {

    /* Geral */
    html, body { overflow-x: hidden !important; width: 100% !important; }

    .container { padding: 16px; gap: 16px; }
    .content-layout { padding: 16px !important; gap: 20px !important; flex-direction: column !important; }

    .home-container, .content-layout, .single-article, .post-content {
        max-width: 100vw !important; overflow-x: hidden !important;
    }

    /* Post content */
    .post-content { font-size: 17px !important; line-height: 1.8 !important; padding: 0 !important; word-wrap: break-word; overflow-wrap: break-word; }
    .post-content p { margin-bottom: 1.4em; }
    .post-content img, .post-content iframe, .post-content video, .post-content table, .post-content figure {
        max-width: 100% !important; height: auto !important;
    }
    .post-content iframe { aspect-ratio: 16/9; width: 100% !important; height: auto !important; }
    .post-content table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Single article */
    .single-article { padding: 16px !important; margin: 0 !important; }
    .single-title { font-size: 22px !important; line-height: 1.3 !important; margin-bottom: 12px !important; }
    .single-subtitle { font-size: 15px !important; line-height: 1.5 !important; }
    .single-meta { flex-wrap: wrap !important; gap: 10px !important; font-size: 12px !important; }
    .single-thumb img { border-radius: 8px; width: 100%; height: auto; }

    /* Esconder sidebar */
    .sidebar, .home-sidebar { display: none !important; }

    /* Section head */
    .section-head { flex-wrap: wrap; }
    .section-head h2 { flex-basis: 100%; margin-bottom: 8px; font-size: 18px; }
    .section-head a { align-self: flex-end; font-size: 12px; }

    /* Grid cards */
    .section .grid { grid-template-columns: 1fr; gap: 10px; }
    .section .grid .card { display: flex; flex-direction: row; height: 120px; }
    .section .grid .card .thumb { width: 120px; height: 120px; padding-top: 0; flex-shrink: 0; }
    .section .grid .card h3 { margin: 6px 8px; font-size: 14px; }
    .section .grid .card .meta { margin: 0 8px 6px 8px; font-size: 11px; }

    /* Hero */
    .hero .main .overlay { padding: 16px; }
    .hero .main .overlay h2 { font-size: 20px; }
    .hero .main .overlay .cat { font-size: 10px; padding: 4px 7px; }
    .hero .side .card { flex: 1 1 100%; }
    .hero .side .card h3 { font-size: 14px; }
    .hero .side .card .meta { font-size: 11px; }

    /* Header UOL */
    .pira-top { padding: 0; }
    .pira-wrap { padding: 0 14px; }
    .pira-trending-row { padding: 10px 0 !important; }
    .pira-tag { padding: 6px 10px !important; font-size: 10px !important; }
    .pira-search-bar, .pira-tools { display: none !important; }

    /* Menu mobile — painel lateral */
    .pira-nav {
        position: fixed !important;
        top: 0; left: -100%;
        width: 280px; max-width: 85vw;
        height: 100dvh; overflow-y: auto;
        background: #0b3b8f;
        z-index: 9995;
        transition: left 0.3s cubic-bezier(.4,0,.2,1);
        box-shadow: 4px 0 24px rgba(0,0,0,0.35);
        padding-top: 60px;
    }
    .pira-nav.is-open { left: 0 !important; }

    .pira-nav ul { flex-direction: column !important; gap: 0 !important; flex-wrap: nowrap !important; overflow-x: visible !important; padding: 0 !important; }
    .pira-nav li { width: 100%; border-bottom: 1px solid rgba(255,255,255,0.1); }
    .pira-nav a { display: block !important; padding: 15px 24px !important; font-size: 15px !important; border-radius: 0 !important; white-space: normal !important; }

    /* Overlay quando menu aberto */
    body.menu-open { overflow: hidden !important; }
    body.menu-open::after {
        content: '';
        position: fixed; inset: 0;
        background: rgba(0,0,0,0.55);
        z-index: 9990;
    }

    /* Homepage */
    .home-container { padding: 0 !important; }
    .home-hero-row { display: flex !important; flex-direction: column !important; gap: 0 !important; padding: 0 !important; margin-bottom: 0 !important; }
    .home-hero-sidebar { display: flex !important; flex-direction: column !important; gap: 16px !important; padding: 12px 14px !important; position: static !important; max-height: none !important; overflow: visible !important; }
    .hero-slider { border-radius: 0 !important; margin: 0 !important; }
    .section-trending { margin: 0 !important; border-radius: 0; }
    .home-layout { display: flex !important; flex-direction: column !important; gap: 20px !important; padding: 0 14px !important; }
    .home-main { width: 100% !important; }
    .grid-featured__container { display: flex !important; flex-direction: column !important; gap: 14px !important; }
    .section-category__grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }

    /* Ads */
    .ad-slot { margin: 14px 0 !important; padding: 0 !important; }
    .ad-placeholder { min-height: 100px !important; }
    .pira-banner-slot { min-height: 60px !important; }
    .pira-banner-placeholder { width: 100% !important; max-width: 320px !important; height: 50px !important; font-size: 11px !important; }

    /* Mobile sticky ad */
    .piranot-ad-slot-12 {
        position: fixed; bottom: 0; left: 0; right: 0;
        z-index: 9000; background: #fff;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.15);
        text-align: center; padding: 4px 0;
    }

    /* Footer V5 */
    .site-footer { padding: 0; text-align: center; }
    .footer-wrap { padding: 0 16px; flex-direction: column; gap: 12px; }
    .footer-top-inner { flex-direction: column; text-align: center; gap: 12px; padding: 16px; }
    .footer-logo { font-size: 18px; }
    .footer-social { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 4px 0; }
    .footer-social a { width: 36px; height: 36px; }
    .footer-mid-inner { padding: 12px 16px; }
    .footer-nav { justify-content: center; gap: 6px 14px; }
    .footer-nav li a { font-size: 12px; }
    .footer-bottom-inner { flex-direction: column; text-align: center; gap: 6px; padding: 12px 16px; }
    .footer-copy { font-size: 11px; }
    .footer-made { font-size: 10px; }

    /* Hero Slider */
    .hero-slider__slide { min-height: 240px !important; max-height: 320px !important; }
    .hero-slider__caption { padding: 12px !important; }
    .hero-slider__category { font-size: 10px !important; padding: 3px 8px !important; }
    .hero-slider__title { font-size: 18px !important; line-height: 1.3 !important; margin-bottom: 8px !important; }
    .hero-slider__meta { font-size: 11px !important; }
    .hero-slider__nav { bottom: 8px !important; }
    .hero-slider__nav button { width: 8px !important; height: 8px !important; }

    /* Títulos */
    .grid-featured__main-title { font-size: 20px !important; line-height: 1.3 !important; }
    .grid-featured__card-title { font-size: 14px !important; line-height: 1.35 !important; -webkit-line-clamp: 3 !important; }
    .section-category__card-title { font-size: 14px !important; line-height: 1.35 !important; }
    .section-trending__link { font-size: 14px !important; line-height: 1.4 !important; }

    /* Widgets */
    .widget { padding: 14px; margin-bottom: 14px; }
    .widget-title { font-size: 15px; margin-bottom: 12px; }
    .widget-whatsapp-modern__btn { padding: 12px 20px !important; font-size: 14px !important; }
    .widget-popular ol li a { font-size: 13px; }
    .services-hub__grid { grid-template-columns: repeat(3, 1fr) !important; }
    .services-hub__item { padding: 10px 6px !important; }
    .services-hub__icon { font-size: 20px !important; }
    .services-hub__label { font-size: 11px !important; }

    /* Share buttons */
    .post-share { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
    .post-share a { flex: 1 1 auto; min-width: 120px; text-align: center; padding: 10px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; text-decoration: none; }

    /* Related posts */
    .related-posts { display: flex; flex-direction: column; gap: 12px; }
    .related-posts .card { display: flex; flex-direction: row; gap: 12px; }
    .related-posts .card .thumb { width: 100px; height: 68px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
    .related-posts .card h3 { font-size: 14px; line-height: 1.35; }

    /* Ticker */
    .pira-ticker { scroll-snap-type: x mandatory; }
    .pira-ticker a { scroll-snap-align: start; }
}

/* ============================================
   MOBILE MÉDIO (576px)
   ============================================ */
@media (max-width: 576px) {
    body { font-size: 14px; }
    .container { padding: 14px; gap: 12px; }
    .content-layout { padding: 14px; flex-direction: column; }
    .post-content { font-size: 16px; }
    .single-title { font-size: 20px; }
    .section { margin-bottom: 20px; }
    .section-head h2 { font-size: 16px; }
    .section-head a { font-size: 12px; }
    .section .grid { grid-template-columns: 1fr; gap: 10px; }
    .widget { padding: 14px; margin-bottom: 12px; }
    .widget-title { font-size: 16px; }
}

/* ============================================
   MOBILE PEQUENO (480px)
   ============================================ */
@media (max-width: 480px) {
    .pira-topbar { padding: 10px !important; }
    .pira-brand img { max-width: 160px !important; min-width: 120px !important; }
    .content-layout { padding: 12px !important; }
    .single-article { padding: 12px !important; }
    .single-title { font-size: 20px !important; }
    .post-content { font-size: 16px !important; }
    .home-hero-sidebar { padding: 0 12px !important; }
    .home-layout { padding: 0 12px !important; }

    /* 1 coluna em telas muito pequenas */
    .section-category__grid { grid-template-columns: 1fr !important; }

    /* Cards horizontais */
    .section-category__card, .section-category__card-link { display: flex !important; flex-direction: row !important; width: 100%; }
    .section-category__card-image { width: 100px !important; height: 72px !important; flex-shrink: 0 !important; aspect-ratio: auto !important; object-fit: cover; border-radius: 6px 0 0 6px !important; }
    .section-category__card-body { flex: 1; padding: 8px 10px !important; }
    .section-category__card-title { font-size: 13px !important; -webkit-line-clamp: 2; }

    .hero-slider__title { font-size: 18px !important; }
    .grid-featured__main-title { font-size: 17px !important; }
    .grid-featured__card-title, .section-category__card-title { font-size: 13px !important; }
}

/* ============================================
   MOBILE MÍNIMO (374px)
   ============================================ */
@media (max-width: 374px) {
    .topbar .wrap { padding: 6px 10px; gap: 6px; }
    .brand-link { font-size: 14px; }
    .topbar .brand-text { display: none; }
    .brand-badge { padding: 3px 6px; font-size: 12px; }
    .container { padding: 10px 12px; gap: 10px; }
    .content-layout { padding: 10px 12px; }
    .post-content { font-size: 15px; }
    .single-title { font-size: 18px; }
    .section-head h2 { font-size: 15px; }
    .hero .main .overlay h2 { font-size: 15px; }
    .widget { padding: 10px; margin-bottom: 10px; }
    .widget-title { font-size: 14px; }
    .section-category__card-image { width: 85px !important; height: 64px !important; }
    .section-category__card-title { font-size: 12px !important; }
}

/* ============================================
   LANDSCAPE CURTO
   ============================================ */
@media (max-height: 600px) and (orientation: landscape) {
    .hero .main .thumb { height: 220px; }
    .container { padding: 10px 14px; }
    .section { margin-bottom: 16px; }
}

/* ============================================
   UTILITÁRIOS
   ============================================ */
.mobile-only { display: none !important; }

@media (max-width: 768px) {
    .mobile-only  { display: block !important; }
    .desktop-only { display: none !important; }
}

@supports (padding: env(safe-area-inset-bottom)) {
    .site-footer, .piranot-ad-slot-12 {
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
    }
}
