/* ==========================================================================
   Coframax · a abertura («A parede monta-se»)
   O logótipo do topo vem para o meio do ecrã, em grande, sobre a parede de betão. Os seis painéis descem da grua um a um,
   coluna a coluna (primeiro o de baixo), pendurados pelo topo (balançam 2–3° e endireitam ao assentar). A palavra sai de
   trás do último painel, o logótipo volta ao seu lugar no topo (ainda sobre a parede, para não passar por cima do texto
   da página) e só então a parede abre como a cofragem das fotos (descofrar).
   Tudo em CSS, a partir do primeiro fotograma; só corre com html.intro (ver site/_intro.blade.php).
   Tempos: painéis 0–0,76 s · palavra 0,5–1 s · volta ao topo 0,9–1,4 s · parede a abrir 1,1–1,65 s.
   A ordem, a descida e as curvas são as dos SVG animados (coframax/entregas/logo-animado-08-11/LEIA-ME.md), ~20 % mais
   depressa: aqui a pessoa está à espera da página.
   ========================================================================== */

html.intro {
  /* o logótipo no meio do ecrã: no topo está encostado à esquerda da .wrap (1280 px) e centrado na altura do topo */
  --intro-w: 200px;            /* largura do .logo no topo, medida no Chrome a 1440 (200,4 px) */
  --intro-s: 2.6;              /* em grande: ~520 px de largura */
  --intro-x: calc(50vw - max(0px, (100vw - 1280px) / 2) - var(--gutter) - var(--intro-w) / 2);
  --intro-y: calc(50vh - var(--top-h) / 2);
  --intro-y: calc(50svh - var(--top-h) / 2);
}
@media (max-width: 1100px) { html.intro { --intro-s: 2.1; } }
@media (max-width: 760px) { html.intro { --intro-w: 181px; --intro-s: 1.7; } }

/* ── A parede: o betão do site, em duas metades com o corte inclinado do símbolo (sobrepostas 0,4 %, sem costura) ── */
html.intro body::before,
html.intro body::after {
  content: ""; position: fixed; inset: 0; z-index: 49;
  background-color: #0F0806;   /* igual a .concrete em site.css */
  background-image:
    radial-gradient(90% 70% at 100% 0%, rgba(244, 77, 37, .20), transparent 62%),
    radial-gradient(70% 60% at 0% 100%, rgba(244, 77, 37, .07), transparent 70%),
    url("../img/betao.svg"),
    url("../img/grao.svg");
  background-size: auto, auto, 720px 360px, 220px 220px;
  animation: intro-open-l .55s var(--move) 1.15s both;
}
html.intro body::before { clip-path: polygon(0 0, 56.4% 0, 44.4% 100%, 0 100%); }
html.intro body::after { clip-path: polygon(56% 0, 100% 0, 100% 100%, 44% 100%); animation-name: intro-open-r; animation-delay: 1.1s; }
@keyframes intro-open-l { to { transform: translateX(-60%); } }
@keyframes intro-open-r { to { transform: translateX(60%); } }

/* ── O topo: só o logótipo; o resto aparece quando a parede abre ── */
html.intro .top { background: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
html.intro .top__nav, html.intro .top__act, html.intro .consent { animation: intro-fade .4s linear 1.25s both; }

/* O logótipo: no meio e em grande, depois volta ao topo (a curva «muda de sítio»). Acaba em transform: none,
   por isso pousa exatamente no sítio dele, seja qual for o ecrã. */
html.intro .top__brand .logo { transform-origin: 50% 50%; animation: intro-home .5s var(--move) .9s both; }
@keyframes intro-home { from { transform: translate(var(--intro-x), var(--intro-y)) scale(var(--intro-s)); } }

/* Os painéis (x-symbol: 1 grande cima, 2 grande baixo, 3 meio cima, 4 meio baixo, 5 direita cima, 6 direita baixo).
   Ordem: grande baixo, grande cima, meio baixo, meio cima, direita baixo, direita cima. */
html.intro .top__brand .logo__mark { overflow: visible; }
html.intro .top__brand .logo__mark polygon {
  transform-box: fill-box; transform-origin: 50% 0;
  animation: intro-block .38s var(--move) both, intro-fade .07s linear both;
  animation-delay: calc(var(--k) * .075s);
}
html.intro .top__brand .logo__mark polygon:nth-child(1) { --k: 1; --r: -3deg; }
html.intro .top__brand .logo__mark polygon:nth-child(2) { --k: 0; --r: -3deg; }
html.intro .top__brand .logo__mark polygon:nth-child(3) { --k: 3; --r: 2deg; }
html.intro .top__brand .logo__mark polygon:nth-child(4) { --k: 2; --r: 2deg; }
html.intro .top__brand .logo__mark polygon:nth-child(5) { --k: 5; --r: 3deg; }
html.intro .top__brand .logo__mark polygon:nth-child(6) { --k: 4; --r: 3deg; }
@keyframes intro-block { from { transform: translateY(-51px) rotate(var(--r)); } }

/* A palavra sai de trás do último painel; o lema assenta por baixo. */
html.intro .top__brand .logo__name { animation: intro-word .45s var(--arrive) .5s both, intro-fade .22s linear .5s both; }
html.intro .top__brand .logo__tag { animation: intro-tag .4s var(--arrive) .62s both, intro-fade .24s linear .62s both; }
@keyframes intro-word { from { transform: translateX(-10px); } }
@keyframes intro-tag { from { transform: translateY(3px); } }
@keyframes intro-fade { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  html.intro body::before, html.intro body::after { display: none; }
  html.intro *, html.intro *::before, html.intro *::after { animation: none !important; }
}
