/* Design tokens (site público) */
:root {
    --color-golden: #C5A572;
    --color-golden-dark: #B8975A;
    --color-blue: #4A90E2;
    --color-blue-hover: #3a7bc8;
    --color-surface: #ffffff;
    --color-surface-alt: #f8fafc;
    --color-text: #374151;
    --color-text-muted: #6b7280;
    --radius-card: 1rem;
    --shadow-card: 0 4px 24px rgb(0 0 0 / 0.06);
    --shadow-cta: 0 8px 24px rgb(197 165 114 / 0.35);
    --header-height: 88px;
}

@media (max-width: 768px) {
    :root {
        --header-height: 70px;
    }
}

/* Acessibilidade / SEO: título principal oculto visualmente */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Fonts */
@font-face {
    font-family: 'Intro';
    src: url('../fonts/Intro-Regular.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Intro';
    src: url('../fonts/Intro-Bold.otf') format('opentype');
    font-weight: bold;
    font-style: normal;
}

@font-face {
    font-family: 'Intro';
    src: url('../fonts/Intro-Book.otf') format('opentype');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'Knockout-JuniorSumo';
    src: url('../fonts/Knockout HTF34-JuniorSumo Regular.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Knockout-Cruiserweight';
    src: url('../fonts/Knockout-HTF52-Cruiserweight.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

/* Smooth scroll - desabilitado para usar JavaScript customizado */
html {
    /* scroll-behavior: smooth; */
}

/* Page transition animations - transição suave sem flash branco */
body {
    padding-top: var(--header-height);
    transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
    overflow-x: hidden; /* Previne scroll horizontal */
    min-height: 100vh; /* Garante altura mínima da página */
    font-family: 'Inter', 'Roboto', sans-serif !important;
}

section[id] {
    scroll-margin-top: var(--header-height);
}

/* Override font-intro class to use Roboto */
.font-intro {
    font-family: 'Roboto', 'Inter', sans-serif !important;
}

/* Keep Knockout only for specific titles */
.font-knockout {
    font-family: 'Knockout-JuniorSumo', 'Roboto', 'Inter', 'Arial Black', 'Helvetica', sans-serif !important;
}

/* Mobile specific fixes */
@media (max-width: 768px) {
    body {
        padding-top: var(--header-height);
        -webkit-overflow-scrolling: touch; /* Smooth scrolling no iOS */
    }
    
    .header {
        padding: 12px 16px !important; /* Header mais compacto */
        min-height: 70px; /* Altura mínima fixa */
    }
    
    /* Fix para textos longos */
    h1, h2, h3 {
        word-wrap: break-word;
        hyphens: auto;
    }
    
    /* Previne overflow horizontal */
    * {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Otimizações touch */
    button, .nav-link, .menu-toggle, a {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        user-select: none;
        -webkit-user-select: none;
    }
    
    /* Melhora performance em animações */
    .nav, .menu-toggle, .nav-link {
        will-change: transform;
        transform: translateZ(0); /* Force hardware acceleration */
    }
}

/* Fade out animation for page changes */
body.page-changing {
    opacity: 0.8;
    transform: translateY(-10px);
}

/* Header fixed at top */
.header {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000 !important;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

/* Navigation Links */
.nav-link {
    cursor: pointer !important;
    transition: color 0.3s ease;
    text-decoration: none;
    outline: 2px solid transparent; /* Adiciona uma borda transparente para verificar clicabilidade */
    padding: 5px 6px; /* Aumenta a área clicável */
    font-family: 'Roboto', 'Inter', sans-serif !important;
    font-size: 0.8rem; /* Reduz um pouco a fonte em telas menores */
}

@media (min-width: 1280px) {
    .nav-link {
        padding: 5px 10px;
        font-size: 0.875rem; /* Volta ao tamanho normal em telas grandes */
    }
}

.nav-link:hover {
    color: var(--color-golden) !important;
    cursor: pointer !important;
}

.nav-link.text-golden,
.nav-link.nav-link--active {
    color: var(--color-golden) !important;
    box-shadow: inset 0 -2px 0 var(--color-golden);
}

.nav-link:active {
    transform: scale(0.95); /* Feedback visual de clique */
    transition: transform 0.1s ease;
}

/* Mobile menu toggle animation */
.menu-toggle {
    cursor: pointer !important;
}

.menu-toggle span {
    transition: all 0.3s ease;
}

.menu-toggle.active span:first-child {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:last-child {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Navigation Menu */
@media (max-width: 767px) {
    .nav {
        display: none; /* Esconde por padrão */
        position: fixed; /* Posicionamento fixo */
        top: 70px; /* Altura do header mobile */
        left: 0;
        width: 100vw; /* Largura da viewport */
        height: calc(100vh - 70px); /* Altura menos o header */
        height: calc(100dvh - 70px); /* Suporte para dynamic viewport height */
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        z-index: 999; /* Abaixo do header */
        overflow-y: auto; /* Rolagem se necessário */
        overflow-x: hidden; /* Previne scroll horizontal */
        padding: 20px 0; /* Espaço interno */
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* Transição mais suave */
    }
    
    .nav.active {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
    }
    
    .nav.active .nav-link {
        width: 100%;
        max-width: 320px;
        text-align: center;
        padding: 12px 16px;
        margin: 3px 0;
        border-radius: 8px;
        font-size: 13px;
        font-weight: 600;
        letter-spacing: 0.5px;
        white-space: nowrap;
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: transparent; /* Remove highlight azul no iOS */
        touch-action: manipulation; /* Otimiza para touch */
    }
    
    .nav.active .nav-link:hover,
    .nav.active .nav-link:active {
        background-color: #f3f4f6;
        transform: scale(0.98);
    }
    
    /* Botão de inscrição no menu mobile */
    .nav.active .nav-link:last-child {
        background-color: #C5A572;
        color: white !important;
        margin-top: 16px;
        font-weight: bold;
        text-transform: uppercase;
        font-size: 13px;
        padding: 12px 16px;
    }
    
    .nav.active .nav-link:last-child:hover {
        background-color: #B8975A;
    }
    
    /* Estilo para o botão de menu mobile */
    .menu-toggle {
        z-index: 1100; /* Acima do menu */
        position: relative;
        padding: 8px;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        cursor: pointer;
    }
    
    /* Overlay para fechar menu ao tocar fora */
    .nav.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.1);
        z-index: -1;
    }
}

/* Container responsivo (substitui padding fixo 60px) */
.site-container {
    width: 100%;
    max-width: 80rem;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .site-container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .site-container {
        padding-left: 4rem;
        padding-right: 4rem;
    }
}

.site-container-wide {
    max-width: 87.5rem;
}

/* Títulos longos: quebra no mobile, uma linha em telas maiores */
.text-responsive-headline {
    white-space: normal;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

@media (min-width: 640px) {
    .text-responsive-headline {
        white-space: nowrap;
    }
}

/* Imagem lateral da home — somente desktop (evita min-width 1150px) */
.premio-lateral-desktop {
    position: absolute;
    right: -8rem;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    max-width: min(52vw, 52rem);
    height: auto;
    z-index: 1;
    pointer-events: none;
}

@media (min-width: 1280px) {
    .premio-lateral-desktop {
        right: -12rem;
        max-width: min(48vw, 56rem);
    }
}

/* Acordeão */
.accordion-trigger,
.category-toggle {
    min-height: 44px;
    cursor: pointer;
    text-align: left;
}

.accordion-trigger:focus-visible,
.category-toggle:focus-visible,
.menu-toggle:focus-visible,
.nav-link:focus-visible {
    outline: 2px solid #C5A572;
    outline-offset: 2px;
}

.accordion-arrow,
.category-arrow {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
    .accordion-arrow,
    .category-arrow,
    body,
    .nav {
        transition: none !important;
    }
}

/* Footer — redes sociais */
.footer-social {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.footer-social a {
    min-width: 0;
    flex: 1 1 auto;
    max-width: 100%;
}

.footer-social span {
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
}

@media (min-width: 640px) {
    .footer-social span {
        white-space: nowrap;
    }
}

/* Acordeão nativo (regulamento) — conteúdo permanece no DOM */
details.accordion-details {
    border-radius: 0.5rem;
    overflow: hidden;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
}

details.accordion-details summary {
    list-style: none;
    cursor: pointer;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

details.accordion-details summary::-webkit-details-marker {
    display: none;
}

details.accordion-details summary::after {
    content: '';
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23C5A572'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    transition: transform 0.2s ease;
}

details.accordion-details[open] summary::after {
    transform: rotate(180deg);
}

details.accordion-details summary:focus-visible {
    outline: 2px solid #C5A572;
    outline-offset: 2px;
}

/* Mídias dinâmicas (data-midia): URL definida só após API — evita flash do fallback no HTML */
[data-midia]:not([data-midia-ready]) {
    visibility: hidden;
}

img[data-midia="banner_principal"]:not([data-midia-ready]) {
    visibility: visible;
    opacity: 0;
    width: 100%;
    aspect-ratio: 16 / 5;
    min-height: 12rem;
    background-color: #f3f4f6;
}

/* ——— Modernização visual (branch test) ——— */

.header.header--scrolled {
    box-shadow: 0 4px 20px rgb(0 0 0 / 0.08);
    background: rgba(255, 255, 255, 0.98);
}

/* Hero home */
.hero-home {
    overflow: hidden;
}

.hero-home__link {
    display: block;
    position: relative;
    text-decoration: none;
}

.hero-home__media img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease, opacity 0.3s ease;
}

.hero-home__link:hover .hero-home__media img {
    transform: scale(1.01);
    opacity: 0.98;
}

.hero-home__overlay {
    pointer-events: none;
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        transparent 55%,
        rgb(0 0 0 / 0.12) 100%
    );
}

/* Hero páginas internas */
.page-hero {
    position: relative;
    background-color: #e5e7eb;
    background-size: cover;
    background-position: center;
}

.page-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        transparent 40%,
        rgb(0 0 0 / 0.15) 100%
    );
    pointer-events: none;
}

/* Seções alternadas */
.section-surface-alt {
    background: linear-gradient(180deg, var(--color-surface-alt) 0%, #fff 100%);
}

/* Grade de homenageados (reforço além do Tailwind CDN) */
.homenageados-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    width: 100%;
}

@media (min-width: 640px) {
    .homenageados-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .homenageados-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) {
    .homenageados-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.homenageado-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.homenageado-card__media {
    flex-shrink: 0;
    height: 14rem;
    overflow: hidden;
    background: #e5e7eb;
}

.homenageado-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.homenageado-card__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.homenageado-card__categoria {
    color: var(--color-golden, #c5a572);
    letter-spacing: 0.04em;
}

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

/* Cards de conteúdo */
.content-card {
    background: var(--color-surface);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    border-left: 4px solid var(--color-golden);
}

.premio-lateral-desktop,
.premio-lateral-mobile {
    filter: drop-shadow(0 20px 40px rgb(0 0 0 / 0.12));
}

.premio-lateral-mobile {
    display: block;
}

/* CTA */
.btn-cta {
    display: inline-block;
    box-shadow: var(--shadow-cta);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgb(74 144 226 / 0.35);
}

.btn-cta:focus-visible {
    outline: 2px solid var(--color-blue);
    outline-offset: 3px;
}

.btn-inscricao {
    box-shadow: var(--shadow-cta);
}

/* Footer */
.site-footer {
    background: var(--color-surface-alt);
    border-top: 1px solid rgb(0 0 0 / 0.06);
}

.site-footer .footer-social a {
    border-radius: 9999px;
    padding: 0.75rem 1rem;
    background: var(--color-surface);
    border: 1px solid rgb(0 0 0 / 0.06);
    transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.site-footer .footer-social a:hover {
    border-color: var(--color-golden);
    color: var(--color-golden);
    transform: translateY(-2px);
}

/* Entrada suave de seções */
.section-reveal {
    opacity: 0;
    transform: translateY(1.25rem);
    transition: opacity 0.55s ease, transform 0.55s ease;
}

.section-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .section-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .hero-home__link:hover .hero-home__media img {
        transform: none;
    }
}

/* Conteúdo dinâmico (site-content.js) — evita flash de texto legado no HTML */
body.site-content-loading [data-site-dynamic] {
    visibility: hidden;
}

body.site-content-ready [data-site-dynamic] {
    visibility: visible;
}

img[data-midia]:not([src]) {
    background-color: #f3f4f6;
}

.page-hero[data-midia]:not([data-midia-ready]) {
    background-color: #e5e7eb;
}
