/**
 * Energy Future Insights - Home V2 CSS
 * Layout profissional estilo portal de notícias
 * Versão: 2.4 - Otimizado para Mobile
 */

/* ============================================
   VARIÁVEIS E BASE
   ============================================ */
:root {
    --color-primary: #7c3aed;
    --color-primary-dark: #6d28d9;
    --max-width: 1320px;
    --font-heading: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-code: 'Courier New', Courier, monospace;
}

.max-w-custom {
    max-width: var(--max-width);
}

/* ============================================
   TIPOGRAFIA
   ============================================ */
body {
    font-family: var(--font-body);
    font-optical-sizing: auto;
    letter-spacing: -0.005em;
}

h1, h2, h3, h4, h5, h6,
.hero-title,
.ef-hero-split__lead-title,
.ef-index-row__title,
.ef-card-item__title,
.ef-cat-featured-title,
.ef-cat-featured__title,
.ef-mais-lidas__heading,
.ef-mais-lidas__featured-title,
.ef-pdi-header h2,
.ef-pdi-card__title {
    font-family: var(--font-heading);
    letter-spacing: -0.025em;
}

p,
a,
span,
button,
input,
select,
textarea,
label,
.ef-index-row__excerpt,
.ef-index-row__meta,
.ef-link-muted,
.ef-pdi-card__excerpt,
.ef-pdi-card__meta {
    font-family: var(--font-body);
}

code,
pre,
kbd,
samp,
.font-mono {
    font-family: var(--font-code);
}

h2, h3 {
    letter-spacing: -0.025em;
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero-section img:not(.lazy-image) {
    transition: transform 0.4s ease;
}

.hero-section a:hover img:not(.lazy-image) {
    transform: scale(1.02);
}

.mobile-hero-card {
    min-height: 0;
}

.mobile-hero-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 40px;
    background: #7c3aed;
    z-index: 3;
    pointer-events: none;
}

.hero-card {
    position: relative;
    display: block;
    width: 100%;
    height: 70vh;
    min-height: 420px;
    max-height: 520px;
    overflow: hidden;
    cursor: pointer;
    background: linear-gradient(140deg, #0F0A1E 0%, #2D1165 55%, #6B21E8 100%);
}

.hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.hero-section a:hover img.hero-img:not(.lazy-image) {
    transform: none;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(10, 3, 28, 0.92) 0%,
        rgba(10, 3, 28, 0.50) 45%,
        transparent 100%
    );
}

.hero-live-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 100px;
    padding: 5px 12px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #c4b5fd;
    animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.4;
        transform: scale(0.65);
    }
}

.hero-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 18px 22px;
}

.hero-content .ef-cat-badge {
    background: #7c3aed;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.07em;
    padding: 4px 12px;
    border-radius: 100px;
    margin-bottom: 10px;
}

.hero-tag {
    display: inline-block;
    background: #6B21E8;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 100px;
    margin-bottom: 10px;
}

.hero-title {
    font-size: clamp(20px, 5vw, 26px);
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
    margin-bottom: 10px;
}

.hero-meta {
    display: block;
}

.hero-source {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.65);
    font-weight: 600;
    margin-right: 8px;
}

.hero-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.40);
}

/* Aspect ratios */
.aspect-\[16\/10\] {
    aspect-ratio: 16 / 10;
}

.aspect-\[16\/9\] {
    aspect-ratio: 16 / 9;
}

/* ============================================
   COLUNAS DE CATEGORIA
   ============================================ */
.categoria-coluna h4 {
    transition: color 0.2s ease;
}

/* ============================================
   CARDS
   ============================================ */
article {
    transition: box-shadow 0.2s ease;
}

article:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

article img.lazy-image {
    transform: none !important;
}

/* ============================================
   LINE CLAMP
   ============================================ */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   LAZY LOADING - APENAS OPACIDADE
   ============================================ */
.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    transform: none !important;
    will-change: opacity;
}

.lazy-image.lazy-loaded,
.lazy-image.loaded {
    opacity: 1;
}

.lazy-image,
.lazy-image:hover,
.lazy-image.lazy-loading,
.lazy-image.lazy-loaded {
    transform: none !important;
    animation: none !important;
}

/* ============================================
   STICKY SIDEBAR
   ============================================ */
.sticky {
    position: sticky;
}

/* ============================================
   MOBILE FIRST - OTIMIZAÇÕES
   ============================================ */

/* Espaçamentos mobile */
@media (max-width: 1023px) {
    /* Mobile header - sem margin bottom */
    .mobile-header {
        margin-bottom: 0 !important;
    }
    
    /* Hero section mobile - colado no header */
    .hero-section {
        padding: 0 !important;
        margin-top: 0 !important;
        border-top: none !important;
    }
    
    .hero-section > div:first-child {
        padding: 0 !important;
    }
    
    /* Títulos do hero mobile - maiores e mais legíveis */
    .hero-section h2 {
        font-size: 1.5rem;
        line-height: 1.15;
        font-weight: 700;
    }

    .hero-section .hero-title {
        font-size: clamp(20px, 5vw, 26px);
        line-height: 1.2;
        font-weight: 800;
    }

    .mobile-hero-card {
        display: block !important;
        align-items: stretch !important;
        min-height: 420px !important;
    }

    .hero-card.mobile-hero-card {
        height: 70vh;
        min-height: 420px !important;
        max-height: 520px;
    }
    
    /* Primeira section após header - sem margin */
    section:first-of-type {
        margin-top: 0 !important;
    }
    
    /* Body - garantir sem padding extra */
    body {
        padding-top: 0 !important;
    }
    
    /* Fonte dos títulos de seção */
    .text-sm.font-bold.uppercase {
        font-size: 0.75rem;
    }
    
    /* Espaçamento vertical entre itens */
    .space-y-2 > * + * {
        margin-top: 0.5rem;
    }
    
    /* Line clamp 3 para títulos mais completos */
    .line-clamp-3 {
        -webkit-line-clamp: 3;
    }

    .scrollbar-hide::-webkit-scrollbar {
        display: none;
    }

    .scrollbar-hide {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .mobile-categories-section h2 {
        font-size: 1.25rem;
    }

    .mobile-categories-section > div {
        padding-top: 1.25rem;
        padding-bottom: 1.5rem;
    }
}

/* Tablet */
@media (min-width: 641px) and (max-width: 1023px) {
    .max-w-custom {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    /* Hover effects apenas no desktop */
    .categoria-coluna a:hover h4 {
        color: var(--color-primary);
    }
}

/* ============================================
   TOUCH DEVICES - MELHORIAS
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects em touch */
    .hero-section a:hover img:not(.lazy-image) {
        transform: none;
    }
    
    article:hover {
        box-shadow: none;
    }
    
    /* Aumenta área de toque */
    a {
        min-height: 44px;
    }

    .mobile-hero-card {
        display: block !important;
        align-items: stretch !important;
    }
    
    /* Links em lista podem ser menores */
    .space-y-3 a {
        min-height: auto;
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #d1d1d1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #b1b1b1;
}

/* ============================================
   UTILITÁRIOS
   ============================================ */
.transition-colors {
    transition: color 0.2s ease, background-color 0.2s ease;
}

.transition-shadow {
    transition: box-shadow 0.2s ease;
}

/* Focus acessível */
a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Seleção */
::selection {
    background-color: var(--color-primary);
    color: white;
}

/* ============================================
   SAFE AREA (iPhone X+)
   ============================================ */
@supports (padding: max(0px)) {
    .max-w-custom {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

/* ============================================
   DARK MODE PREVENTION
   ============================================ */
@media (prefers-color-scheme: dark) {
    /* Força light mode */
    :root {
        color-scheme: light;
    }
}

/* ============================================
   PRINT
   ============================================ */
@media print {
    section[class*="bg-gray-50"],
    section[class*="bg-gradient"] {
        background: white !important;
    }
    
    .sticky {
        position: relative !important;
    }
    
    footer {
        display: none !important;
    }
}

/* ============================================
   PERFORMANCE - REDUCE MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
