/**
 * Energy Future Insights - Home V3 CSS
 * Hero 3 colunas (6+3+3) com sidebar EF Cast + carrossel horizontal de episódios
 * Versão: 3.2
 */

:root {
    --color-primary: #7c3aed;
    --color-primary-dark: #6d28d9;
    --max-width: 1320px;
}

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

/* ============================================
   TIPOGRAFIA
   ============================================ */
h2, h3 {
    letter-spacing: 0.02em;
}

/* ============================================
   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);
}

.aspect-\[16\/10\] { aspect-ratio: 16 / 10; }
.aspect-\[16\/9\]  { aspect-ratio: 16 / 9; }
.aspect-\[3\/2\]   { aspect-ratio: 3 / 2; }
.aspect-\[9\/16\]  { aspect-ratio: 9 / 16; }
.aspect-\[4\/3\]   { aspect-ratio: 4 / 3; }

/* ============================================
   EF CAST - SIDEBAR (desktop, coluna direita)
   ============================================ */
.efcast-sidebar {
    position: relative;
}

/* ============================================
   EF CAST - CARROSSEL HORIZONTAL DE EPISÓDIOS
   ============================================ */
.efcast-episodes-scroll {
    position: relative;
}

.efcast-episodes-track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
}

.efcast-episodes-track::-webkit-scrollbar {
    display: none;
}

.efcast-episode-card {
    flex: 0 0 auto;
    scroll-snap-align: start;
    width: 220px;
}

@media (min-width: 640px) {
    .efcast-episode-card {
        width: 240px;
    }
}

@media (min-width: 1024px) {
    .efcast-episode-card {
        width: 260px;
    }
    
    .efcast-episodes-track {
        gap: 20px;
    }
}

.efcast-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-70%);
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #374151;
    transition: all 0.2s ease;
}

.efcast-nav:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.efcast-nav-prev {
    left: -18px;
}

.efcast-nav-next {
    right: -18px;
}

/* ============================================
   EF CAST - BADGES & ANIMAÇÕES
   ============================================ */
.efcast-pulse {
    animation: efcast-pulse-anim 2s ease-in-out infinite;
}

@keyframes efcast-pulse-anim {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.efcast-player-btn {
    animation: efcast-play-glow 2.5s ease-in-out infinite;
}

@keyframes efcast-play-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(124, 58, 237, 0); }
}

/* ============================================
   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-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.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
   ============================================ */
.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
   ============================================ */
.sticky {
    position: sticky;
}

/* ============================================
   MOBILE - OTIMIZAÇÕES
   ============================================ */
@media (max-width: 1023px) {
    .mobile-header {
        margin-bottom: 0 !important;
    }
    
    .hero-section {
        padding: 0 !important;
        margin-top: 0 !important;
        border-top: none !important;
    }
    
    .hero-section > div:first-child {
        padding: 0 !important;
    }
    
    .hero-section h2 {
        font-size: 1.25rem;
        line-height: 1.35;
        font-weight: 700;
    }
    
    section {
        padding-top: 0;
        padding-bottom: 0;
        margin-top: 0;
    }
    
    section:first-of-type {
        margin-top: 0 !important;
    }
    
    body {
        padding-top: 0 !important;
    }
    
    .text-sm.font-bold.uppercase {
        font-size: 0.75rem;
    }
    
    .space-y-2 > * + * {
        margin-top: 0.5rem;
    }

    .efcast-episode-card {
        width: 200px;
    }
    
    .efcast-episodes-track {
        gap: 12px;
    }
}

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

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

/* ============================================
   TOUCH DEVICES
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    .hero-section a:hover img:not(.lazy-image) {
        transform: none;
    }
    
    article:hover {
        box-shadow: none;
    }
    
    a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .space-y-3 a {
        min-height: auto;
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }

    .efcast-episode-card {
        min-height: auto;
    }

    .efcast-sidebar a {
        min-height: auto;
        display: inline-flex;
    }
    
    .efcast-sidebar button {
        min-height: auto;
        display: flex;
    }
}

/* ============================================
   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;
}

a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

::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));
    }
}

/* ============================================
   EF CAST - PÁGINAS DEDICADAS
   ============================================ */
.efcast-convidado-card {
    transition: box-shadow 0.2s ease;
}

.efcast-convidado-card:hover {
    box-shadow: 0 2px 12px rgba(124, 58, 237, 0.08);
}

section article {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

@media (max-width: 1023px) {
    .efcast-convidado-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .efcast-convidado-card img {
        margin-bottom: 0.5rem;
    }
}

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

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

/* ============================================
   REDUCE MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .efcast-pulse {
        animation: none !important;
        opacity: 1;
    }
    
    .efcast-player-btn {
        animation: none !important;
    }
}
