/* ============================================================================
 * STYLE.CSS — Site Público (Fase 3 · Template White-Label Premium)
 * ============================================================================
 * REGRA DE OURO: nenhuma cor ou fonte "de verdade" vive aqui. Tudo deriva
 * das CSS Variables que o theme-engine.js injeta em :root. Trocar o tema
 * no Admin repinta o site inteiro — inclusive fontes — sem tocar neste CSS.
 *
 * Variáveis consumidas (com fallback = tema Advocacia):
 *   --primary --accent --bg --surface --texto --font-display --font-body
 * Derivadas locais:
 *   --card (fundo de cartões: branco no claro, surface no escuro)
 * ========================================================================== */

:root {
    --primary: #001f3f;
    --accent: #e5c05b;
    --bg: #ffffff;
    --surface: #f4f4f4;
    --texto: #1c2733;
    --font-display: 'Playfair Display', serif;
    --font-body: 'Montserrat', sans-serif;
    --whatsapp: #25d366;
    --card: #ffffff;
    --sombra-card: 0 10px 30px rgba(0, 0, 0, 0.06);
    --accent-grad: linear-gradient(135deg, #bf953f, #e5c05b, #fcf6ba, #aa771c);
}

/* Temas escuros (cyberpunk, gamer): o theme-engine marca o body e o CSS reage */
body.tema-escuro {
    --card: var(--surface);
    --sombra-card: 0 10px 30px rgba(0, 0, 0, 0.45);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--texto);
    line-height: 1.65;
    overflow-x: hidden;
    transition: background 0.4s, color 0.4s;
}
img { max-width: 100%; }

/* ==================== TELA DE CARREGAMENTO ===============================
 * Enquanto o app.js busca a config no Supabase, o site inteiro (incluindo
 * o fallback estático genérico) fica ESCONDIDO atrás de uma capa sólida
 * com o logo do próprio cliente pulsando no centro. Assim que os dados
 * reais chegam e a classe "carregando" é removida do <body>, a capa
 * desaparece com um fade suave e o conteúdo CERTO já aparece direto —
 * sem "flash" de texto genérico ("Seu nome", "Digite Crea OAB aqui" etc).
 * ========================================================================== */
body.carregando {
    overflow: hidden;
    height: 100vh;
}

body.carregando::before {
    content: '';
    position: fixed;
    inset: 0;
    background: var(--primary);
    z-index: 9999;
    animation: fade-in-capa 0.15s ease both;
}

body.carregando::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 72px;
    height: 72px;
    margin: -36px 0 0 -36px;
    background: url('assets/logo.png') center/contain no-repeat;
    z-index: 10000;
    animation: pulsar-logo 1.4s ease-in-out infinite;
}

@keyframes fade-in-capa {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes pulsar-logo {
    0%, 100% { opacity: 0.45; transform: scale(0.92); }
    50%      { opacity: 1;    transform: scale(1); }
}

/* Transição suave: quando "carregando" some, o site "acende" com fade
 * em vez de aparecer de corte seco — sensação mais premium/polida. */
#mapa-secoes, .main-header, footer, .whats-flutuante {
    opacity: 1;
    transition: opacity 0.35s ease;
}
body.carregando #mapa-secoes,
body.carregando .main-header,
body.carregando footer,
body.carregando .whats-flutuante {
    opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
    body.carregando::after { animation: none; opacity: 1; transform: none; }
}

/* ==================== ANIMAÇÕES DE ENTRADA (scroll reveal) ==============
 * O app.js observa .reveal com IntersectionObserver e adiciona .visivel.  */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visivel { opacity: 1; transform: none; }
/* Cascata: filhos diretos de grades entram escalonados */
.cards-grid > *, .photo-grid > *, .pub-grid > *, .info-grid > * { transition-delay: calc(var(--i, 0) * 90ms); }

/* ============================== HEADER ================================== */
.main-header {
    position: fixed; top: 0; left: 0; width: 100%; z-index: 1000;
    background: var(--primary);
    background: color-mix(in srgb, var(--primary) 94%, transparent);
    backdrop-filter: blur(6px);
    border-bottom: 2px solid var(--accent);
    padding: 14px 5%;
}
.header-container { display: flex; justify-content: space-between; align-items: center; }
.logo-area { display: flex; align-items: center; gap: 10px; }
.nav-logo { height: 44px; }
.logo-text { color: #fff; font-weight: 700; font-size: 1.05rem; }
.nav-menu a {
    color: #fff; text-decoration: none; margin-left: 22px;
    font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase;
    position: relative;
}
.nav-menu a:not(.btn-contato-nav)::after {
    content: ''; position: absolute; left: 0; bottom: -4px;
    width: 0; height: 2px; background: var(--accent); transition: width 0.25s;
}
.nav-menu a:not(.btn-contato-nav):hover::after { width: 100%; }
.btn-contato-nav { background: var(--accent); color: var(--primary) !important; padding: 9px 16px; border-radius: 5px; font-weight: 800; }

/* =============================== HERO =================================== */
#hero { width: 100%; min-height: 92vh; background: var(--primary) no-repeat center center/cover; margin-top: 70px; }
.hero-overlay {
    width: 100%; min-height: 92vh;
    display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--primary) 78%, transparent);
}
.hero-content { text-align: center; color: #fff; padding: 24px; animation: heroEntrada 0.9s ease both; }
@keyframes heroEntrada { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.perfil-foto {
    width: 180px; height: 180px; border-radius: 50%;
    border: 4px solid var(--accent); object-fit: cover; margin-bottom: 20px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
}
#hero h1 { font-family: var(--font-display); font-size: clamp(1.9rem, 4.5vw, 2.8rem); color: var(--accent); margin-bottom: 6px; }
.oab { font-size: 1.05rem; opacity: 0.9; margin-bottom: 14px; letter-spacing: 0.05em; }
.slogan { font-size: 1.25rem; font-style: italic; margin-bottom: 32px; opacity: 0.95; }
.hero-btns { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.btn-primary, .btn-whatsapp {
    padding: 15px 30px; border-radius: 9px; text-decoration: none;
    font-weight: 900; border: 2px solid #fff; transition: transform 0.25s, box-shadow 0.25s;
}
.btn-primary { background: var(--accent); color: var(--primary) !important; }
.btn-whatsapp { background: var(--whatsapp); color: #fff !important; box-shadow: 0 6px 18px rgba(37, 211, 102, 0.35); }
.btn-primary:hover, .btn-whatsapp:hover { transform: translateY(-3px) scale(1.03); }

/* ============================== SEÇÕES ================================== */
.full-section { width: 100%; padding: 88px 5%; text-align: center; }
.container { max-width: 1200px; margin: 0 auto; }
.gray-bg { background: var(--surface); }
h2 {
    font-family: var(--font-display); font-size: clamp(1.7rem, 3.4vw, 2.3rem);
    margin-bottom: 44px; position: relative; padding-bottom: 16px; color: var(--texto);
}
h2::after {
    content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 84px; height: 3px; background: var(--accent-grad); border-radius: 2px;
}
#sobre p { max-width: 850px; margin: 0 auto; font-size: 1.02rem; }

/* ========================= CARDS DE SERVIÇOS ============================ */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 28px; }
.card {
    background: var(--card); padding: 40px 22px; border-radius: 12px;
    box-shadow: var(--sombra-card); border-top: 4px solid var(--accent);
    transition: transform 0.3s, box-shadow 0.3s;
}
.card:hover { transform: translateY(-6px); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12); }
.card h3 { margin-bottom: 8px; }
.gold-3d {
    font-size: 44px; color: var(--accent); margin-bottom: 18px; display: inline-block;
    background: var(--accent-grad);
    background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

/* ============================ DEPOIMENTOS =============================== */
.testimonial-wrapper { overflow-x: auto; padding: 20px 4px; cursor: grab; scrollbar-width: thin; }
.testimonial-slider { display: flex; gap: 20px; min-width: max-content; }
.review-card {
    background: var(--card); padding: 30px; border-radius: 12px;
    box-shadow: var(--sombra-card); width: 350px; max-width: 82vw;
    text-align: left; border-left: 5px solid var(--accent);
}
.stars { color: #f1c40f; margin-bottom: 10px; letter-spacing: 2px; }
.client-name { display: block; margin-top: 15px; font-weight: 800; color: var(--accent); }

/* ============================ NOSSO ESPAÇO ============================== */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 20px; }
.office-photo img {
    width: 100%; height: 260px; object-fit: cover; object-position: top;
    border-radius: 12px; border: 2px solid var(--accent); transition: transform 0.35s;
}
.office-photo img:hover { transform: scale(1.025); }

/* ============================ PUBLICAÇÕES =============================== */
.pub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 22px; }
.pub-desc { font-weight: 700; font-size: 0.88rem; margin-bottom: 10px; }
.pub-item {
    position: relative; border-radius: 12px; overflow: hidden; height: 200px;
    background: #000; border: 1px solid var(--accent);
}
.pub-item img { width: 100%; height: 100%; object-fit: cover; opacity: 0.85; transition: 0.3s; }
.pub-item:hover img { opacity: 1; transform: scale(1.05); }
.play-overlay {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 3rem; color: #ff0000; pointer-events: none;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
}
.insta-placeholder {
    width: 100%; height: 100%; display: flex; flex-direction: column; gap: 8px;
    align-items: center; justify-content: center; font-weight: 800; text-decoration: none;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    color: #fff; font-size: 0.9rem;
}
.insta-placeholder i { font-size: 2rem; }

/* ============================ CARROSSEL =================================
 * Usado em "Nosso Espaço" e "Publicações": 4 itens à vista no desktop,
 * rolagem lateral por arraste/toque + setas. As setas só aparecem quando
 * há mais conteúdo do que cabe (classe .tem-overflow, gerida pelo app.js). */
.carrossel { position: relative; }
.carrossel-trilha {
    display: flex; gap: 20px;
    overflow-x: auto; scroll-snap-type: x mandatory;
    padding: 6px 4px 14px;
    scrollbar-width: none; -ms-overflow-style: none;
}
.carrossel-trilha::-webkit-scrollbar { display: none; }
.carrossel-trilha > * { flex: 0 0 clamp(240px, calc(25% - 15px), 420px); scroll-snap-align: start; }
.carrossel-trilha .office-photo img { height: 240px; }

.seta-carrossel {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
    width: 46px; height: 46px; border-radius: 50%;
    border: 2px solid var(--accent); background: var(--primary); color: var(--accent);
    font-size: 1rem; cursor: pointer;
    display: none; align-items: center; justify-content: center;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, opacity 0.2s;
}
.carrossel.tem-overflow .seta-carrossel { display: flex; }
.seta-carrossel:hover:not(:disabled) { transform: translateY(-50%) scale(1.08); }
.seta-carrossel:disabled { opacity: 0.3; cursor: default; }
.seta-carrossel.esquerda { left: -14px; }
.seta-carrossel.direita { right: -14px; }

/* ========================= INFO DE CONTATO ============================== */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 26px; margin-bottom: 40px; }
.info-item { background: var(--card); padding: 30px 18px; border-radius: 12px; box-shadow: var(--sombra-card); }
.info-item h3 { margin-bottom: 6px; font-size: 1rem; }
.info-item p { font-size: 0.9rem; }
.social-links-contato a, .social-links a {
    color: var(--accent); font-size: 1.9rem; margin: 0 13px;
    display: inline-block; transition: transform 0.25s;
}
.social-links-contato a:hover, .social-links a:hover { transform: scale(1.2) translateY(-2px); }

/* ============================ FORMULÁRIO ================================ */
.contato-form {
    max-width: 800px; margin: 0 auto; background: var(--card);
    padding: 42px; border-radius: 14px; box-shadow: 0 16px 50px rgba(0, 0, 0, 0.1);
    text-align: left;
}
.form-row { display: flex; gap: 20px; margin-bottom: 20px; }
.form-row > input { flex: 1; }
input, textarea {
    width: 100%; padding: 15px; font: inherit; font-size: 0.95rem;
    border: 2px solid color-mix(in srgb, var(--texto) 15%, transparent);
    border-radius: 8px; background: var(--bg); color: var(--texto);
    transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
}
textarea { margin-bottom: 20px; resize: vertical; }
.btn-submit {
    background: var(--primary); color: var(--accent);
    border: 2px solid var(--accent); padding: 18px; width: 100%;
    font: inherit; font-weight: 900; font-size: 0.9rem; letter-spacing: 0.06em;
    cursor: pointer; text-transform: uppercase; border-radius: 8px; transition: 0.3s;
}
.btn-submit:hover:not(:disabled) { background: var(--accent); color: var(--primary); }
.btn-submit:disabled { opacity: 0.7; cursor: wait; }

/* Feedback do formulário (substitui os alert() antigos) */
.form-feedback {
    display: none; margin-top: 16px; padding: 13px 16px;
    border-radius: 9px; font-size: 0.88rem; font-weight: 600;
}
.form-feedback.visivel { display: block; animation: heroEntrada 0.3s ease both; }
.form-feedback.sucesso { background: #e8f7ef; color: #1d7a4c; }
.form-feedback.erro { background: #fdecec; color: #a33030; }

/* =============================== FOOTER ================================= */
footer {
    background: var(--primary); color: #fff; padding: 60px 5% 40px;
    text-align: center; border-top: 5px solid var(--accent);
}
.footer-info p { margin: 4px 0; font-size: 0.9rem; opacity: 0.9; }
.social-links { margin: 24px 0; }
.footer-credits { margin-top: 26px; font-size: 0.78rem; opacity: 0.65; }
.footer-credits a { color: var(--accent); text-decoration: none; }

/* ======================= BOTÃO FLUTUANTE WHATSAPP ======================= */
.whats-flutuante {
    position: fixed; width: 60px; height: 60px; bottom: 36px; right: 36px;
    background: var(--whatsapp); color: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 30px; z-index: 1000; text-decoration: none;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
    animation: pulsar 2.6s infinite;
}
@keyframes pulsar {
    0%, 100% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(37, 211, 102, 0.45); }
    50%      { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3), 0 0 0 14px rgba(37, 211, 102, 0); }
}

/* ============================= RESPONSIVO =============================== */
@media (max-width: 768px) {
    .nav-menu { display: none; }
    .form-row { flex-direction: column; gap: 15px; }
    .hero-btns { flex-direction: column; align-items: center; }
    .full-section { padding: 64px 6%; }
    .whats-flutuante { bottom: 22px; right: 22px; }
    .carrossel-trilha > * { flex-basis: 80vw; }
    .seta-carrossel.esquerda { left: 2px; }
    .seta-carrossel.direita { right: 2px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .reveal { opacity: 1; transform: none; }
}
