/* ═══════════════════════════════════════════════════════════════════════════
   TRESSIA — Estilos Customizados
   Complementa o Tailwind CSS com estilos que exigem CSS puro.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Reset & Base ──────────────────────────────────────────────────────────── */
body {
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ══════════════════════════════════════════════════════════════════════════════
   INTRO SCREEN — Animações de entrada
   ══════════════════════════════════════════════════════════════════════════════ */

/* Logo: entra deslizando de baixo para cima */
.intro-logo-text {
    opacity: 0;
    transform: translateY(40px);
    animation: introSlideUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

/* Tagline: aparece logo depois */
.intro-tagline-text {
    opacity: 0;
    transform: translateY(20px);
    animation: introSlideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.75s forwards;
}

/* Linha decorativa que cresce horizontalmente */
.intro-line {
    animation: introLineGrow 0.8s cubic-bezier(0.16, 1, 0.3, 1) 1.1s forwards;
}

@keyframes introSlideUp {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes introLineGrow {
    to { width: 6rem; }
}

/* Loader dots — pulso sequencial */
.intro-dot {
    opacity: 0;
    animation: introDotPulse 1.2s ease-in-out infinite;
}
@keyframes introDotPulse {
    0%, 100% { opacity: 0.2; transform: scale(0.8); }
    50%       { opacity: 1;   transform: scale(1.3); }
}

/* Barra de progresso */
.intro-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, #9E8568, #7E4B2B);
    border-radius: 0 2px 2px 0;
    transition: width 0.1s linear;
}

/* Fade-out da intro ao sair */
#intro-screen {
    transition: opacity 0.7s ease, visibility 0.7s ease;
}
#intro-screen.intro-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ── Textura de Ruído (overlay fixo) ─────────────────────────────────────── */
.bg-noise {
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* ── Glassmorphism ────────────────────────────────────────────────────────── */
.glass-panel {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 10px 40px rgba(11, 65, 56, 0.04);
}

.glass-nav {
    background: rgba(245, 242, 237, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(11, 65, 56, 0.08);
}

/* ── Scroll Reveal ────────────────────────────────────────────────────────── */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 1s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.active {
    opacity: 1;
    transform: translateY(0);
}
.reveal-delay-1 { transition-delay: 100ms; }
.reveal-delay-2 { transition-delay: 200ms; }

/* ── Layout Bento ─────────────────────────────────────────────────────────── */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* ── SPA: controle de visibilidade das "páginas" ──────────────────────────── */
/*
 * IMPORTANTE: usamos !important aqui intencionalmente.
 * O Tailwind CDN injeta a classe `hidden` (display:none !important) em alguns
 * elementos. Para garantir que o JS consiga mostrar as seções corretamente
 * independente de qualquer classe Tailwind residual, o .view-section precisa
 * de especificidade máxima no display.
 */
.view-section {
    display: none !important;
    opacity: 0;
    transition: opacity 0.4s ease;
}

/* Estado ativo: visível e opaco */
.view-section.active {
    display: block !important;
    opacity: 1;
}

/* ── Logo: lambda estilizado ──────────────────────────────────────────────── */
.tressia-lambda {
    font-family: serif;
    display: inline-block;
    transform: scaleY(1.15) translateY(-1px);
    margin-left: -2px;
}

/* ── Timeline (detalhes do Workshop) ─────────────────────────────────────── */
.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.75rem;
    top: 0.5rem;
    width: 0.75rem;
    height: 0.75rem;
    background: #9E8568;
    border-radius: 50%;
    border: 2px solid #F5F2ED;
    z-index: 10;
}
.timeline-item::after {
    content: '';
    position: absolute;
    left: -1.45rem;
    top: 1rem;
    width: 2px;
    height: calc(100% + 1rem);
    background: rgba(11, 65, 56, 0.1);
    z-index: 0;
}
.timeline-item:last-child::after {
    display: none;
}

/* ── Scrollbar personalizada ──────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #9E8568; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #7E4B2B; }

/* ── Estado de carregamento (loading skeleton) ────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, rgba(11,65,56,.06) 25%, rgba(11,65,56,.1) 50%, rgba(11,65,56,.06) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 1rem;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Toast de notificação (feedback de operações assíncronas) ─────────────── */
#toast-container {
    position: fixed;
    bottom: 5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    pointer-events: none;
}

.toast {
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #fff;
    box-shadow: 0 4px 24px rgba(0,0,0,.15);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}
.toast.show {
    opacity: 1;
    transform: translateY(0);
}
.toast.success { background: #0B4138; }
.toast.error   { background: #7E4B2B; }
.toast.info    { background: #8A9DB0; }

/* ── Ticker de palavras (faixa entre hero e manifesto) ────────────────────── */
.ticker-scroll {
    animation: ticker 30s linear infinite;
    will-change: transform;
}
.ticker-scroll:hover {
    animation-play-state: paused;
}
.ticker-item {
    display: inline-block;
    padding: 0 2rem;
    font-family: 'Marcellus', serif;
    font-size: 0.85rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #E8DAC8;
    opacity: 0.85;
    transition: opacity 0.3s ease, color 0.3s ease;
    white-space: nowrap;
}
.ticker-item:hover {
    opacity: 1;
    color: #9E8568;
}
.ticker-sep {
    display: inline-block;
    color: #9E8568;
    opacity: 0.5;
    font-size: 0.5rem;
    vertical-align: middle;
    white-space: nowrap;
}

@keyframes ticker {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ── Números de impacto — contador animado via CSS ────────────────────────── */
.stat-number {
    display: inline-block;
    background: linear-gradient(135deg, #0B4138 0%, #7E4B2B 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.5s ease;
}
/* Divide x entre stats com bordas adaptadas */
@media (max-width: 768px) {
    .grid.divide-x > div {
        border-right: none;
        border-bottom: 1px solid rgba(11, 65, 56, 0.08);
    }
    .grid.divide-x > div:last-child {
        border-bottom: none;
    }
}

/* ── Galeria editorial — overlay hover suave ──────────────────────────────── */
.gallery-overlay {
    background: linear-gradient(
        to top,
        rgba(11, 65, 56, 0.85) 0%,
        rgba(11, 65, 56, 0.2) 40%,
        transparent 70%
    );
}

/* ── CTA Footer: garante que o CTA seja o último elemento memorável ──────── */
.cta-final-section {
    background: radial-gradient(ellipse at 30% 50%, #1a6b5a 0%, #0B4138 60%);
}

/* ── Scroll indicator (bounce mouse) ─────────────────────────────────────── */
@keyframes mouse-scroll {
    0%, 100% { transform: translateY(0); opacity: 1; }
    50%       { transform: translateY(6px); opacity: 0.4; }
}
.mouse-dot {
    animation: mouse-scroll 1.8s ease-in-out infinite;
}

/* ══════════════════════════════════════════════════════════════════════════════
   CURSOR PERSONALIZADO
   ══════════════════════════════════════════════════════════════════════════════ */

/* cursor: none apenas no index — admin fica com cursor padrão */
body.cursor-active:not(.admin-page),
body.cursor-active:not(.admin-page) a,
body.cursor-active:not(.admin-page) button,
body.cursor-active:not(.admin-page) [onclick],
body.cursor-active:not(.admin-page) .ws-card { cursor: none; }

#custom-cursor {
    position: fixed;
    top: 0; left: 0;
    width: 40px; height: 40px;
    border: 1.5px solid #9E8568;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: width .25s ease, height .25s ease, border-color .25s ease, opacity .3s ease;
    mix-blend-mode: multiply;
}

#custom-cursor-dot {
    position: fixed;
    top: 0; left: 0;
    width: 8px; height: 8px;
    background: #9E8568;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    opacity: 0;
    transition: opacity .3s ease;
}

#custom-cursor.cursor-hover {
    width: 60px; height: 60px;
    border-color: #7E4B2B;
    background: rgba(158,133,104,.08);
}

/* ── Gradiente animado nas palavras-chave ─────────────────────────────────── */
@keyframes gradientShift {
    0%   { background-position: 0%   50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0%   50%; }
}

/* ── Linha do footer animada ─────────────────────────────────────────────── */
.footer-animated-line {
    height: 2px;
    background: linear-gradient(90deg, transparent, #9E8568, #7E4B2B, transparent);
    width: 0%;
    transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
    margin-bottom: 2rem;
}
.footer-animated-line.footer-line-grow { width: 100%; }

/* ── Wave divider ────────────────────────────────────────────────────────── */
.wave-divider {
    line-height: 0;
    overflow: hidden;
    margin-bottom: -1px;
}
.wave-divider svg { display: block; width: 100%; height: 40px; }

/* ── Tilt 3D — transição ao entrar no card ───────────────────────────────── */
.ws-card {
    transition: transform 0.1s ease, box-shadow 0.3s ease;
}
.ws-card:hover {
    box-shadow: 0 32px 64px rgba(11,65,56,.25);
}

/* ══════════════════════════════════════════════════════════════════════════ */
/* Upload de Imagens — componente img-picker                                 */
/* ══════════════════════════════════════════════════════════════════════════ */

.img-drop-zone {
    position: relative;
    border: 2px dashed rgba(11,65,56,.18);
    border-radius: 1.25rem;
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    background: #F5F2ED;
    transition: border-color .2s, background .2s;
    overflow: hidden;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.img-drop-zone:hover {
    border-color: rgba(126,75,43,.45);
    background: rgba(126,75,43,.04);
}

.img-drop-zone.drag-over {
    border-color: #7E4B2B;
    background: rgba(126,75,43,.08);
}

.img-drop-placeholder {
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.img-drop-preview {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: .75rem;
    display: block;
}

.img-upload-spinner {
    position: absolute;
    inset: 0;
    background: rgba(245,242,237,.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 1.25rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   AWWWARDS — ONDA 1
   Tear Vivo · Fio Condutor · Tipografia Tecida · Spotlight/Borda Viva ·
   Magnético · Palavras-fantasma · Underline Tecido · Reveal por Máscara
   Tudo respeita prefers-reduced-motion.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 1. Tear Vivo (canvas do hero) ───────────────────────────────────────── */
.tear-canvas {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.2s ease;
}
.tear-canvas.tear-on { opacity: 1; }

/* ── 3. Fio Condutor (linha SVG scroll-driven) ───────────────────────────── */
.fio-condutor {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 30;
    pointer-events: none;
    overflow: visible;
}
.fio-condutor path {
    fill: none;
    stroke: #9E8568;
    stroke-width: 1.5;
    stroke-linecap: round;
    opacity: 0.32;
}
.fio-condutor circle {
    fill: #7E4B2B;
    opacity: 0.35;
}

/* ── 9. Tipografia Tecida (títulos-âncora que se tecem) ───────────────────── */
.woven-title .woven-word {
    display: inline-block;
    overflow: hidden;
    vertical-align: top;
    padding-bottom: 0.12em;
    margin-bottom: -0.12em;
}
.woven-title .woven-inner {
    display: inline-block;
    transform: translateY(112%);
    opacity: 0;
    transition: transform 0.95s cubic-bezier(0.16,1,0.3,1),
                opacity   0.95s cubic-bezier(0.16,1,0.3,1);
}
.woven-title.woven-in .woven-inner {
    transform: translateY(0);
    opacity: 1;
}

/* ── 10. Spotlight (luz que segue o cursor) ──────────────────────────────── */
.spotlight { position: relative; }
.spotlight::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
        260px circle at var(--mx, 50%) var(--my, 50%),
        rgba(232, 218, 200, 0.16),
        transparent 62%
    );
    opacity: 0;
    transition: opacity 0.45s ease;
    pointer-events: none;
    z-index: 3;
}
.spotlight:hover::after { opacity: 1; }

/* ── 10b. Borda Viva (contorno trançado por fios de luz no hover) ─────────── */
@property --fio-ang {
    syntax: '<angle>';
    inherits: false;
    initial-value: 0deg;
}
.living-border { position: relative; }
.living-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1.5px;
    background: conic-gradient(from var(--fio-ang, 0deg),
        #9E8568, #7E4B2B, #0B4138, #9E8568);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
            mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.45s ease;
    pointer-events: none;
    z-index: 4;
}
.living-border:hover::before {
    opacity: 0.9;
    animation: fioSpin 4.5s linear infinite;
}
@keyframes fioSpin { to { --fio-ang: 360deg; } }

/* ── 12. Magnético (CTAs que deslizam em direção ao cursor) ───────────────── */
.magnetic {
    transition: transform 0.35s cubic-bezier(0.16,1,0.3,1);
    will-change: transform;
}

/* ── 14. Palavras-fantasma (urdidura tipográfica de fundo) ────────────────── */
.ghost-word {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Marcellus', serif;
    font-size: 22vw;
    line-height: 0.9;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
    z-index: 0;
    color: rgba(11, 65, 56, 0.035);
    will-change: transform;
}
.ghost-word.ghost-light {
    color: transparent;
    -webkit-text-stroke: 1px rgba(232, 218, 200, 0.10);
}

/* ── 15. Underline Tecido (fio desenhado da esquerda no hover) ────────────── */
.link-weave {
    position: relative;
    text-decoration: none;
}
.link-weave::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    height: 1.5px;
    width: 100%;
    background-image: linear-gradient(90deg, #9E8568, #7E4B2B);
    background-size: 0% 100%;
    background-repeat: no-repeat;
    transition: background-size 0.45s cubic-bezier(0.16,1,0.3,1);
}
.link-weave:hover::after { background-size: 100% 100%; }

/* ── 8. Reveal por Máscara — imagens entram como pano puxado ──────────────── */
.wv-img {
    clip-path: inset(0 0 100% 0);
    transition: clip-path 1.15s cubic-bezier(0.16,1,0.3,1) 0.12s;
}
.reveal.active .wv-img { clip-path: inset(0 0 0 0); }

/* ── Acessibilidade: desliga motion pesado ───────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .tear-canvas { display: none; }
    .woven-title .woven-inner { transform: none; opacity: 1; transition: none; }
    .living-border:hover::before { animation: none; }
    .ghost-word { display: none; }
    .wv-img { clip-path: none; transition: none; }
    .magnetic { transition: none; }
}
