/* =====================================================================
   LG Ensino · abertura animada (antes da página inicial)
   A marca é "construída" sobre uma prancheta: grade, linhas-guia,
   círculos e cotas; depois o lg se desenha com luz, ENSINO aparece
   letra por letra e tudo se desfaz em partículas revelando o site.
   ===================================================================== */

html.com-abertura, html.com-abertura body { overflow: hidden; background: #2A1A55; }
html.com-abertura body > *:not(.abertura) { visibility: hidden; }

.abertura {
  --fundo: #2A1A55;
  --linha: rgba(196, 182, 240, .38);
  --linha-fraca: rgba(196, 182, 240, .12);
  position: fixed; inset: 0; z-index: 1000;
  background: radial-gradient(ellipse at center, #34216A 0%, var(--fundo) 70%);
  background-color: var(--fundo);
  display: grid; place-items: center;
  transition: opacity .7s ease;
}
.abertura::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(var(--linha-fraca) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, var(--linha-fraca) 1px, transparent 1px) 0 0 / 28px 28px;
  animation: grade-entra 1.2s ease both; }
.abertura.saindo { opacity: 0; pointer-events: none; }
@keyframes grade-entra { from { opacity: 0; } to { opacity: 1; } }

.abertura svg, .abertura-secao svg { width: min(92vmin, 760px); height: auto; overflow: visible; }
.abertura canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* linhas de construção */
:is(.abertura, .abertura-secao) .guia { fill: none; stroke: var(--linha); stroke-width: 1.2; stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: desenha 1.1s cubic-bezier(.55, 0, .25, 1) forwards; animation-delay: var(--d, 0s); }
:is(.abertura, .abertura-secao) .tracejada { fill: none; stroke: var(--linha); stroke-width: 1.2; stroke-dasharray: 6 7; opacity: 0;
  animation: aparece .8s ease forwards; animation-delay: var(--d, 0s); }
:is(.abertura, .abertura-secao) .no { fill: var(--fundo-no, #2A1A55); stroke: #fff; stroke-width: 1.5; opacity: 0; transform-box: fill-box; transform-origin: center;
  filter: url(#brilho-leve); animation: no-entra .5s cubic-bezier(.3, 1.6, .5, 1) forwards; animation-delay: var(--d, 0s); }
:is(.abertura, .abertura-secao) .cota { opacity: 0; animation: aparece .7s ease forwards; animation-delay: var(--d, 0s); }
:is(.abertura, .abertura-secao) .cota :is(line, path) { stroke: rgba(255, 255, 255, .7); stroke-width: 1.2; fill: none; }
:is(.abertura, .abertura-secao) .cota text { fill: rgba(255, 255, 255, .8); font: 500 15px "Figtree", system-ui, sans-serif; }
:is(.abertura, .abertura-secao) .construcao { transition: opacity .9s ease; }
:is(.abertura, .abertura-secao).limpa .construcao { opacity: 0; }

/* a marca */
:is(.abertura, .abertura-secao) .tracos path { fill: none; stroke: #fff; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; filter: url(#brilho); }
:is(.abertura, .abertura-secao) .faisca { fill: #fff; filter: url(#brilho-forte); opacity: 0; }
:is(.abertura, .abertura-secao) .palavra text { fill: #fff; font: 300 78px/1 "Antonio", "Oswald", "Arial Narrow", sans-serif; letter-spacing: 16px; }
:is(.abertura, .abertura-secao) .palavra tspan { opacity: 0; }
:is(.abertura, .abertura-secao) .palavra tspan.on { animation: letra .45s cubic-bezier(.2, .7, .2, 1) forwards; }
:is(.abertura, .abertura-secao) .marca-final { transition: opacity .5s ease, filter .5s ease; }
:is(.abertura, .abertura-secao).desfaz .marca-final { opacity: 0; filter: blur(3px); }

@keyframes desenha { to { stroke-dashoffset: 0; } }
@keyframes aparece { to { opacity: 1; } }
@keyframes no-entra { from { opacity: 0; transform: scale(0); } to { opacity: 1; transform: scale(1); } }
@keyframes letra { from { opacity: 0; } 60% { opacity: 1; } to { opacity: 1; } }

:is(.abertura, .abertura-secao) .pular {
  position: absolute; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  font: 600 14px/1 "Figtree", system-ui, sans-serif; color: rgba(255, 255, 255, .85);
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .25); border-radius: 999px;
  padding: 10px 16px; cursor: pointer;
}
:is(.abertura, .abertura-secao) .pular:hover { background: rgba(255, 255, 255, .16); color: #fff; }
:is(.abertura, .abertura-secao) .pular:focus-visible { outline: 2px solid #F2B84B; outline-offset: 2px; }

/* versão dentro do quadro da seção "Por que a LG" */
.abertura-secao { --linha: rgba(255, 255, 255, .42); --fundo-no: #7352BA; position: absolute; inset: 0; display: grid; place-items: center; }
.abertura-secao::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, .08) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(90deg, rgba(255, 255, 255, .08) 1px, transparent 1px) 0 0 / 22px 22px; }
.abertura-secao svg { width: 112%; max-width: none; position: relative; }
.abertura-secao.espera * { animation-play-state: paused !important; }
/* sem animação (ou parada): a marca aparece pronta */
.abertura-secao.pronta .construcao { opacity: 0; }
.abertura-secao.pronta .tracos path { stroke-dashoffset: 0 !important; }
.abertura-secao.pronta .palavra tspan { opacity: 1; }
