/* Container do Grid */
.chroma-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    
    /* Variáveis que o JS vai controlar */
    --x: 50%;
    --y: 50%;
}

/* O Efeito de Lanterna Global (Overlay) */
/* Isso cria aquele efeito onde tudo fica meio escuro, exceto onde o mouse está */
.chroma-overlay {
    position: absolute;
    inset: -100px; /* Estende um pouco pra fora */
    pointer-events: none;
    z-index: 10;
    background: rgba(3, 3, 5, 0.6); /* Cor de fundo escura semi-transparente */
    
    /* A mágica da máscara */
    mask-image: radial-gradient(
        circle 600px at var(--x) var(--y),
        transparent 0%,    /* Centro transparente (mostra o card brilhando) */
        transparent 20%,
        black 100%         /* Bordas opacas (escurece o resto) */
    );
    -webkit-mask-image: radial-gradient(
        circle 600px at var(--x) var(--y),
        transparent 10%,
        black 80%
    );
    
    /* Inverte a lógica da máscara para funcionar como "spotlight" */
    /* Na verdade, queremos desenhar a ESCURIDÃO, exceto no centro */
    backdrop-filter: grayscale(100%) brightness(0.5);
    transition: opacity 0.3s ease;
}

/* Cartão Individual */
.chroma-card {
    position: relative;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, border-color 0.3s ease;
    
    /* Variáveis locais do card */
    --mouse-x: 50%;
    --mouse-y: 50%;
}

.chroma-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.3);
    z-index: 20; /* Traz para frente do overlay se necessário */
}

/* Brilho interno no Card (Spotlight individual) */
.chroma-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        800px circle at var(--mouse-x) var(--mouse-y),
        rgba(255, 255, 255, 0.06),
        transparent 40%
    );
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
    z-index: 2;
}

.chroma-card:hover::before {
    opacity: 1;
}

.chroma-content {
    position: relative;
    z-index: 3;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.chroma-image {
    height: 280px;
    width: 100%;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.chroma-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.chroma-card:hover .chroma-image img {
    transform: scale(1.1);
}

.chroma-info {
    padding: 24px;
    background: linear-gradient(180deg, rgba(20,20,30,0) 0%, rgba(10,10,15,0.8) 100%);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.chroma-info h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    margin-bottom: 4px;
}

.chroma-info p {
    color: #94a3b8;
    font-size: 0.9rem;
}

.chroma-info .year {
    font-family: 'Space Grotesk', sans-serif;
    color: #475569;
    font-weight: 700;
}

.tags {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.tags span {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.05);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Animação de entrada */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .chroma-grid {
        grid-template-columns: 1fr;
    }
    .chroma-overlay { display: none; } /* Desativa efeito pesado no mobile */
}



/* --- GRID LAYOUT --- */
.chroma-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 24px;
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    --x: 50%;
    --y: 50%;
}

/* Overlay do Spotlight (Escurece o que não está focado) */
.chroma-overlay {
    position: absolute;
    inset: -50px;
    pointer-events: none;
    z-index: 10;
    background: rgba(3, 3, 5, 0.5); /* Escuridão base */
    
    /* Máscara que revela o brilho onde está o mouse */
    mask-image: radial-gradient(
        circle 500px at var(--x) var(--y),
        transparent 0%,
        black 100%
    );
    -webkit-mask-image: radial-gradient(
        circle 500px at var(--x) var(--y),
        transparent 10%,
        black 80%
    );
    
    backdrop-filter: grayscale(100%) brightness(0.6);
    transition: opacity 0.3s ease;
}

/* --- CARD ESTILOS --- */
.chroma-card {
    position: relative;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.02); /* Fundo quase transparente */
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --mouse-x: 50%;
    --mouse-y: 50%;
}

.chroma-card:hover {
    transform: translateY(-8px);
    z-index: 20; /* Sobe acima do overlay */
}

/* Brilho interno seguindo o mouse */
.chroma-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        600px circle at var(--mouse-x) var(--mouse-y),
        rgba(255, 255, 255, 0.08),
        transparent 40%
    );
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
    z-index: 2;
}

.chroma-card:hover::before {
    opacity: 1;
}

/* Estrutura interna */
.chroma-content {
    position: relative;
    z-index: 3;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.chroma-image {
    height: 240px;
    width: 100%;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.chroma-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease;
}

.chroma-card:hover .chroma-image img {
    transform: scale(1.1);
}

.chroma-info {
    padding: 24px;
    background: linear-gradient(180deg, rgba(15,15,20,0) 0%, rgba(10,10,15,0.9) 100%);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.chroma-info h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    margin-bottom: 4px;
}

.chroma-info p {
    color: #94a3b8;
    font-size: 0.95rem;
}

.chroma-info .year {
    font-family: 'Space Grotesk', sans-serif;
    color: rgba(255,255,255,0.3);
    font-weight: 700;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.tags span {
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.03);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: 0.3s;
}

.chroma-card:hover .tags span {
    background: rgba(79, 70, 229, 0.1);
    border-color: rgba(79, 70, 229, 0.3);
    color: #a5b4fc;
}

/* Responsivo */
@media (max-width: 768px) {
    .chroma-overlay { display: none; } /* Desativa efeito pesado no mobile */
    .chroma-grid { grid-template-columns: 1fr; }
    .page-transition { background: #000; } /* Garante fundo preto no mobile */
}

.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
}