/* Brasil em Dados - Design System Inspirado */

/* ========== CSS VARIABLES ========== */
:root {
    /* Paleta de Cores Brasileiras Modernas */
    --verde-brasil: #009b3a;
    --verde-escuro: #006428;
    --amarelo-ouro: #ffd23f;
    --creme: #f7ead3;
    --papel: #faf7f0;
    --tinta: #1a1a1a;
    --cinza-medio: #6b7280;
    --cinza-claro: #e5e7eb;

    /* Cores de Destaque Política */
    --esquerda-primary: #c53030;
    --esquerda-light: #fc8181;
    --direita-primary: #2b6cb0;
    --direita-light: #63b3ed;

    /* Espaçamento Fluido */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-2xl: 4rem;
    --space-3xl: 6rem;

    /* Bordas */
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 2rem;
    --border-width: 2px;

    /* Sombras */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-sticker: 4px 4px 0px rgba(0, 0, 0, 0.1);

    /* Transições */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
}

/* ========== RESET & BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.7;
    -webkit-tap-highlight-color: rgba(0, 155, 58, 0.1);
    color: var(--tinta);
    background: var(--creme);
    overflow-x: hidden;
}

/* ========== TIPOGRAFIA ========== */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Archivo', 'Inter', sans-serif;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

@media (min-width: 768px) {
    .container {
        padding: 0 var(--space-xl);
    }
}

@media (max-width: 767px) {
    .container {
        padding: 0 var(--space-md);
    }
}

/* ========== HEADER ========== */
header {
    background: linear-gradient(135deg, var(--verde-brasil) 0%, var(--verde-escuro) 100%);
    color: white;
    padding: var(--space-2xl) var(--space-md);
    text-align: center;
    position: relative;
    overflow: hidden;
    border-bottom: 4px solid var(--amarelo-ouro);
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 10px,
            rgba(255, 255, 255, 0.03) 10px,
            rgba(255, 255, 255, 0.03) 20px
        );
    pointer-events: none;
}

header .container {
    position: relative;
    z-index: 1;
}

header h1 {
    font-size: clamp(2rem, 7vw, 4rem);
    margin-bottom: var(--space-sm);
    font-weight: 900;
    text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.6s ease;
}

header .subtitle {
    font-size: clamp(1rem, 3vw, 1.3rem);
    opacity: 0.95;
    margin-bottom: var(--space-md);
    font-weight: 600;
    animation: slideDown 0.7s ease;
}

header .description {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    opacity: 0.9;
    max-width: 900px;
    margin: 0 auto;
    line-height: 1.8;
    animation: slideDown 0.8s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== MAIN CONTENT ========== */
main {
    padding: var(--space-2xl) 0;
    min-height: 100vh;
}

/* ========== FILTROS ========== */
.filters {
    background: var(--papel);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    border: var(--border-width) solid var(--verde-escuro);
    box-shadow: var(--shadow-sticker);
    margin-bottom: var(--space-2xl);
    transform: rotate(-0.5deg);
    transition: transform var(--transition-base);
}

.filters:hover {
    transform: rotate(0deg);
}

.filter-group {
    margin-bottom: var(--space-lg);
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-group label {
    display: block;
    font-weight: 700;
    margin-bottom: var(--space-md);
    color: var(--verde-escuro);
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.filter-btn {
    padding: var(--space-sm) var(--space-md);
    border: var(--border-width) solid var(--verde-escuro);
    background: white;
    color: var(--verde-escuro);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all var(--transition-base);
    position: relative;
    clip-path: polygon(
        8px 0, 100% 0, 100% calc(100% - 8px),
        calc(100% - 8px) 100%, 0 100%, 0 8px
    );
}

.filter-btn:hover {
    background: var(--verde-brasil);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.filter-btn.active {
    background: var(--verde-escuro);
    color: var(--amarelo-ouro);
    font-weight: 700;
    box-shadow: var(--shadow-md);
}

/* ========== COMPARAÇÃO ========== */
.comparison {
    position: relative;
    margin-bottom: var(--space-3xl);
    padding: var(--space-2xl) 0;
}

/* Timeline Vertical */
.timeline {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(
        to bottom,
        transparent,
        var(--amarelo-ouro) 5%,
        var(--amarelo-ouro) 95%,
        transparent
    );
    transform: translateX(-50%);
    z-index: 1;
}

.timeline-item {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.timeline-year {
    width: 80px;
    height: 80px;
    background: white;
    border: 4px solid var(--verde-brasil);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.1rem;
    color: var(--verde-escuro);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all var(--transition-base);
    cursor: pointer;
    font-family: 'Archivo', sans-serif;
}

.timeline-year:hover {
    transform: scale(1.15);
    border-color: var(--amarelo-ouro);
    background: var(--amarelo-ouro);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.timeline-year.active {
    background: var(--verde-brasil);
    color: white;
    border-color: var(--verde-escuro);
    animation: pulse-year 2s ease-in-out infinite;
}

@keyframes pulse-year {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(0, 155, 58, 0.3);
    }
    50% {
        box-shadow: 0 6px 24px rgba(0, 155, 58, 0.6);
    }
}

/* Timeline Content */
.timeline-content {
    display: grid;
    grid-template-columns: 1fr 100px 1fr;
    gap: var(--space-xl);
    position: relative;
    z-index: 0;
}

.timeline-side {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.side h2 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    margin-bottom: var(--space-sm);
    text-align: center;
    position: relative;
    padding-bottom: var(--space-md);
}

.side h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    border-radius: 2px;
}

.side.esquerda h2 {
    color: var(--esquerda-primary);
}

.side.esquerda h2::after {
    background: var(--esquerda-primary);
}

.side.direita h2 {
    color: var(--direita-primary);
}

.side.direita h2::after {
    background: var(--direita-primary);
}

.side-description {
    text-align: center;
    color: var(--cinza-medio);
    margin-bottom: var(--space-xl);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.6;
}

.cards-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

/* ========== CARDS ========== */
.card {
    background: var(--papel);
    border-radius: var(--radius-lg);
    border: var(--border-width) solid;
    overflow: hidden;
    transition: all var(--transition-base);
    position: relative;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card:hover {
    transform: translateY(-4px) rotate(0deg);
    box-shadow: var(--shadow-lg);
}

.esquerda .card {
    border-color: var(--esquerda-primary);
    transform: rotate(-0.5deg);
}

.esquerda .card:nth-child(even) {
    transform: rotate(0.5deg);
}

.direita .card {
    border-color: var(--direita-primary);
    transform: rotate(0.5deg);
}

.direita .card:nth-child(even) {
    transform: rotate(-0.5deg);
}

.card-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
    border-bottom: var(--border-width) solid;
}

.esquerda .card-image {
    border-bottom-color: var(--esquerda-light);
}

.direita .card-image {
    border-bottom-color: var(--direita-light);
}

.card-body {
    padding: var(--space-lg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.card-title {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--tinta);
    flex: 1;
    line-height: 1.3;
}

.card-meta {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    flex-wrap: wrap;
}

.year-badge {
    background: var(--amarelo-ouro);
    color: var(--verde-escuro);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 900;
    border: 2px solid var(--verde-escuro);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.category-badge {
    background: white;
    color: var(--verde-escuro);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
    border: 2px solid var(--verde-escuro);
}

.card-content {
    color: var(--tinta);
    line-height: 1.8;
    margin-bottom: var(--space-md);
    font-size: 1rem;
}

.card-data {
    background: linear-gradient(135deg, rgba(0, 155, 58, 0.05) 0%, rgba(255, 210, 63, 0.05) 100%);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-top: var(--space-md);
    border-left: 4px solid var(--amarelo-ouro);
}

.card-data ul {
    list-style: none;
    padding-left: 0;
}

.card-data li {
    padding: var(--space-xs) 0;
    padding-left: var(--space-lg);
    position: relative;
    font-size: 0.95rem;
}

.card-data li:before {
    content: "▸";
    position: absolute;
    left: 0;
    color: var(--verde-brasil);
    font-weight: bold;
    font-size: 1.2rem;
}

.card-sources {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 2px solid var(--cinza-claro);
}

.card-sources strong {
    display: block;
    margin-bottom: var(--space-sm);
    font-size: 0.9rem;
    color: var(--cinza-medio);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card-sources a {
    color: var(--verde-brasil);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-block;
    margin-right: var(--space-md);
    margin-bottom: var(--space-xs);
    transition: all var(--transition-fast);
    border-bottom: 2px solid transparent;
}

.card-sources a:hover {
    color: var(--verde-escuro);
    border-bottom-color: var(--amarelo-ouro);
    transform: translateX(2px);
}

/* ========== METODOLOGIA & FONTES ========== */
.methodology,
.sources {
    background: var(--papel);
    padding: var(--space-2xl);
    border-radius: var(--radius-lg);
    border: var(--border-width) solid var(--verde-escuro);
    box-shadow: var(--shadow-sticker);
    margin-bottom: var(--space-2xl);
    transform: rotate(0.3deg);
}

.methodology h2,
.sources h2 {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    margin-bottom: var(--space-lg);
    color: var(--verde-escuro);
    position: relative;
    padding-bottom: var(--space-sm);
}

.methodology h2::after,
.sources h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 80px;
    height: 4px;
    background: var(--amarelo-ouro);
    border-radius: 2px;
}

.methodology p {
    margin-bottom: var(--space-md);
    line-height: 1.8;
    font-size: 1.05rem;
}

.sources ul {
    list-style: none;
    padding-left: 0;
    display: grid;
    gap: var(--space-sm);
}

.sources li {
    padding: var(--space-md);
    padding-left: var(--space-2xl);
    position: relative;
    background: white;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--verde-brasil);
    transition: all var(--transition-base);
}

.sources li:hover {
    transform: translateX(8px);
    border-left-color: var(--amarelo-ouro);
}

.sources li:before {
    content: "✓";
    position: absolute;
    left: var(--space-md);
    color: var(--verde-brasil);
    font-weight: bold;
    font-size: 1.4rem;
}

/* ========== FOOTER ========== */
footer {
    background: var(--verde-escuro);
    color: white;
    padding: var(--space-3xl) var(--space-md);
    text-align: center;
    border-top: 4px solid var(--amarelo-ouro);
}

footer p {
    margin-bottom: var(--space-md);
    line-height: 1.8;
    font-size: 1.05rem;
}

footer .disclaimer {
    font-size: 0.95rem;
    opacity: 0.9;
    max-width: 800px;
    margin: var(--space-lg) auto 0;
    padding-top: var(--space-lg);
    border-top: 2px solid rgba(255, 255, 255, 0.2);
    font-style: italic;
}

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-md);
    color: var(--cinza-medio);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

/* ========== RESPONSIVIDADE ========== */
@media (max-width: 968px) {
    /* Headers */
    .timeline-headers {
        grid-template-columns: 1fr;
        gap: var(--space-md);
        text-align: center;
        margin-bottom: var(--space-xl);
    }

    .header-center {
        display: none;
    }

    .header-left,
    .header-right {
        max-width: 100%;
        justify-self: center;
    }

    .header-left h2,
    .header-right h2 {
        font-size: 1.8rem;
    }

    /* Year Groups */
    .year-group {
        margin-bottom: var(--space-2xl);
    }

    .year-content {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .year-column-center {
        order: -1;
        padding: 0;
        margin-bottom: var(--space-md);
        display: flex;
        justify-content: center;
    }

    /* Remover linha entre anos em mobile */
    .year-group:not(:last-child) .year-column-center::after {
        display: none;
    }

    .timeline-year {
        width: 70px;
        height: 70px;
        font-size: 1rem;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }

    .year-column-left,
    .year-column-right {
        order: 0;
        justify-self: center;
        max-width: 100%;
        gap: var(--space-lg);
    }

    /* Remover setas em mobile */
    .card-arrow {
        display: none;
    }

    /* Cards em mobile */
    .card {
        height: auto;
        min-height: 400px;
    }

    .card-with-tabs {
        height: auto;
        min-height: 450px;
    }

    .card-body {
        max-height: 600px;
    }

    /* Remover rotação dos cards em mobile */
    .year-column-left .card,
    .year-column-left .card:nth-child(even),
    .year-column-right .card,
    .year-column-right .card:nth-child(even) {
        transform: rotate(0deg);
    }

    .year-column-left .card:hover,
    .year-column-right .card:hover {
        transform: translateY(-4px) rotate(0deg);
    }

    /* Tabs em mobile */
    .tabs-container {
        padding: var(--space-sm) var(--space-md) 0 var(--space-md);
    }

    .tab-counter {
        top: var(--space-xs);
        right: var(--space-md);
        font-size: 0.7rem;
        padding: 2px var(--space-xs);
    }

    .tab-button {
        font-size: 0.85rem;
        padding: var(--space-xs) var(--space-sm);
        max-width: 160px;
    }

    .tabs-content {
        padding: var(--space-md);
    }

    .tabs-list {
        gap: 4px;
        padding-right: 70px;
    }

    /* Filtros em mobile */
    .filters {
        padding: var(--space-md);
    }

    .filter-group {
        margin-bottom: var(--space-md);
    }

    .filter-buttons {
        justify-content: center;
        gap: var(--space-xs);
    }

    .filter-btn {
        font-size: 0.8rem;
        padding: var(--space-xs) var(--space-sm);
    }

    /* Timeline container */
    .timeline-container {
        gap: var(--space-2xl);
    }

    /* Imagens */
    .card-image-container {
        height: 180px;
    }
}

@media (max-width: 640px) {
    header {
        padding: var(--space-xl) var(--space-md);
    }

    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    .description {
        font-size: 0.9rem;
    }

    /* Cards */
    .card {
        min-height: 350px;
    }

    .card-with-tabs {
        min-height: 400px;
    }

    .card-header {
        flex-direction: column;
        padding: var(--space-sm);
    }

    .card-title {
        font-size: 1.2rem;
    }

    .card-content {
        padding: 0 var(--space-sm);
        font-size: 0.95rem;
    }

    .card-data {
        margin: var(--space-sm);
        padding: var(--space-sm);
    }

    .card-sources {
        padding: var(--space-sm);
    }

    .card-meta {
        width: 100%;
    }

    /* Tabs */
    .tab-button {
        font-size: 0.8rem;
        padding: var(--space-xs) var(--space-xs);
        max-width: 140px;
    }

    .tabs-content {
        padding: var(--space-sm);
    }

    /* Filtros */
    .filter-btn {
        font-size: 0.75rem;
        padding: 6px 10px;
    }

    .filter-group label {
        font-size: 0.9rem;
    }

    /* Timeline */
    .timeline-year {
        width: 60px;
        height: 60px;
        font-size: 0.9rem;
    }

    /* Imagens */
    .card-image-container {
        height: 160px;
    }

    /* Seções */
    .methodology,
    .sources {
        padding: var(--space-md);
    }

    .methodology h2,
    .sources h2 {
        font-size: 1.5rem;
    }

    /* Remover animação flutuante em mobile */
    .card:nth-child(3n) {
        animation: fadeInUp 0.6s ease;
    }

    /* Empty state */
    .empty-state {
        padding: var(--space-xl) var(--space-md);
    }

    .empty-state-icon {
        font-size: 3rem;
    }

    /* Footer */
    footer {
        padding: var(--space-xl) var(--space-md);
    }

    footer p {
        font-size: 0.9rem;
    }

    /* Year badges */
    .year-badge,
    .category-badge {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
}

/* ========== ANIMAÇÕES EXTRAS ========== */
@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-10px) rotate(2deg);
    }
}

.card:nth-child(3n) {
    animation: fadeInUp 0.6s ease, float 6s ease-in-out infinite;
}

/* ========== LOADING STATE ========== */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
