/*
 * Atelier Joias — main.css
 * Estilos complementares ao Tailwind CDN.
 * Contém: variáveis CSS, masonry grid, animações, utilitários customizados.
 */

/* ─── Reset & Base ───────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

/* ─── Variáveis CSS (Design Tokens) ──────────────────────────────────────── */
:root {
    --color-gold-50:  #FBF7F1;
    --color-gold-100: #F5ECD9;
    --color-gold-200: #E8D4A8;
    --color-gold-300: #D4AF37;
    --color-gold-400: #C5A028;
    --color-gold-500: #B8941D;

    --color-stone-50:  #FAFAF9;
    --color-stone-100: #F5F5F4;
    --color-stone-200: #E7E5E4;
    --color-stone-300: #D6D3D1;
    --color-stone-400: #A8A29E;
    --color-stone-500: #78716C;
    --color-stone-600: #57534E;
    --color-stone-700: #44403C;
    --color-stone-800: #292524;
    --color-stone-900: #1C1917;
    --color-stone-950: #0C0A09;

    --font-serif: 'Cormorant Garamond', Georgia, serif;
    --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ─── Animações ──────────────────────────────────────────────────────────── */
.fade-in {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ─── Masonry Grid ───────────────────────────────────────────────────────── */
.masonry-grid {
    column-count: 1;
    column-gap: 1.5rem;
}

@media (min-width: 768px) {
    .masonry-grid {
        column-count: 2;
    }
}

@media (min-width: 1024px) {
    .masonry-grid {
        column-count: 3;
    }
}

.gallery-item {
    break-inside: avoid;
    margin-bottom: 1.5rem;
}

/* ─── Imagens ────────────────────────────────────────────────────────────── */
.image-hover {
    transition: transform var(--transition-slow), filter var(--transition-slow);
}

.image-hover:hover {
    transform: scale(1.03);
}

img {
    display: block;
    max-width: 100%;
}

/* ─── Scrollbar Customizada ──────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--color-stone-100);
}

::-webkit-scrollbar-thumb {
    background: var(--color-gold-300);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-gold-400);
}

/* ─── Seleção de Texto ───────────────────────────────────────────────────── */
::selection {
    background: var(--color-gold-200);
    color: var(--color-stone-900);
}

/* ─── Focus Acessível ────────────────────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--color-gold-400);
    outline-offset: 3px;
}

/* ─── Formulário — Inputs com animação de borda ──────────────────────────── */
input, textarea, select {
    transition: border-color var(--transition-base);
}

/* ─── Utilitários extras ─────────────────────────────────────────────────── */
.smooth-scroll {
    scroll-behavior: smooth;
}

.text-balance {
    text-wrap: balance;
}

/* ─── Loading de Imagens ─────────────────────────────────────────────────── */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.5s ease;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* ─── Hero Slideshow ─────────────────────────────────────────────────────── */
.hero-section {
    position: relative;
    height: 100vh;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

@media (max-width: 768px) {
    .hero-section {
        height: 70vh; /* Shorter on mobile to reduce cropping */
        min-height: 450px;
    }
}

.hero-slides {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.hero-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: transform 0.8s ease;
}

/* Animations will be applied via JS for dynamic timing */
.hero-slide.animating {
    animation: hero-crossfade var(--slide-duration) linear infinite;
}

@keyframes hero-crossfade {
    0% {
        opacity: 0;
        transform: scale(1.08);
    }
    5%, 25% {
        opacity: 1;
    }
    30% {
        opacity: 0;
        transform: scale(1);
    }
    100% {
        opacity: 0;
    }
}

/* Hero Content Tuning */
@media (max-width: 640px) {
    .hero-section h1 {
        font-size: 2.75rem !important;
        line-height: 1.1 !important;
    }
    .hero-section p {
        font-size: 1rem !important;
        padding: 0 1rem;
    }
}

/* ─── Marquee (Carrossel Infinito) ───────────────────────────────────────── */
.marquee-container {
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    width: 100%;
}

/* Máscara de suavização nas bordas */
.marquee-container::before,
.marquee-container::after {
    content: "";
    position: absolute;
    top: 0;
    width: 15%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.marquee-container::before {
    left: 0;
    background: linear-gradient(to right, var(--color-stone-50), transparent);
}

.marquee-container::after {
    right: 0;
    background: linear-gradient(to left, var(--color-stone-50), transparent);
}

.marquee-content {
    display: inline-flex;
    animation: marquee 120s linear infinite;
    gap: 1.5rem;
    cursor: pointer;
}

.marquee-content.reverse {
    animation-direction: reverse;
}

.marquee-item {
    flex: 0 0 auto;
    width: 350px;
    height: 480px;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.marquee-item:hover {
    transform: scale(1.02);
    z-index: 10;
}

.marquee-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(0.2);
    transition: filter 0.5s ease;
}

.marquee-item:hover img {
    filter: grayscale(0);
}

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Lightbox Modal */
#lightbox-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(12, 10, 9, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

#lightbox-modal.active {
    opacity: 1;
    pointer-events: auto;
}

#lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    transform: scale(0.9);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#lightbox-modal.active #lightbox-img {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    color: white;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.lightbox-close:hover {
    transform: rotate(90deg) scale(1.1);
    color: var(--color-gold-300);
}

@media (max-width: 768px) {
    .marquee-item {
        width: 200px;
        height: 280px;
    }
}
