/* ==================================================================
   GERADOR DE FOTOS — Delegada Lia Valechi 4440
   Marinho, dourado e o escudo da campanha. Página única, sem build.
================================================================== */

:root {
  --marinho: #05163a;
  --azul: #0d3273;
  --azul-medio: #11418f;
  --azul-claro: #2a6fd0;
  --ouro: #f2c218;
  --ouro-escuro: #c8941a;
  --ouro-claro: #ffe08a;
  --tinta: #04112c;
  --papel: #f3f5fa;
  --branco: #ffffff;
  --linha: rgba(4, 17, 44, .14);
  --display: "Archivo Black", Impact, sans-serif;
  --corpo: "Manrope", Arial, sans-serif;
  --firma: "Dancing Script", cursive;
  --topbar: 96px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--tinta);
  background: var(--papel);
  font-family: var(--corpo);
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { color: inherit; font: inherit; cursor: pointer; }
button, a { -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; }
svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
::selection { color: var(--marinho); background: var(--ouro); }
:focus-visible { outline: 3px solid var(--ouro); outline-offset: 3px; }

.skip-link { position: fixed; top: 12px; left: 12px; z-index: 400; padding: 12px 16px; color: var(--marinho); background: var(--ouro); font-size: .7rem; font-weight: 900; transform: translateY(-180%); transition: transform .2s ease; }
.skip-link:focus { transform: translateY(0); }

.arquivo-oculto { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ---------------- Topo ---------------- */
.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: var(--topbar);
  padding: 16px clamp(18px, 5vw, 64px);
  color: var(--branco);
  background: var(--marinho);
  overflow: hidden;
}
.topbar__canto { position: absolute; right: -60px; bottom: -78px; width: 200px; height: 140px; background: var(--ouro); transform: rotate(-14deg); }
.topbar__canto::after { content: ""; position: absolute; inset: auto 0 52px 0; height: 14px; background: var(--azul-claro); }

.logo { position: relative; z-index: 2; display: flex; align-items: center; gap: 14px; width: max-content; }
.logo__escudo { flex: none; width: 42px; }
.logo__escudo svg { width: 100%; height: auto; stroke: none; }
.escudo-ouro { fill: var(--ouro); }
.escudo-fundo { fill: var(--marinho); }
.logo__texto { display: grid; gap: 5px; }
.logo__cargo { color: rgba(255, 255, 255, .66); font-size: .53rem; font-weight: 900; letter-spacing: .2em; }
.logo__linha { display: flex; align-items: center; gap: 9px; }
.logo__nome { font-family: var(--display); font-size: clamp(.95rem, 3.4vw, 1.32rem); letter-spacing: -.035em; line-height: 1; white-space: nowrap; }
.logo__nome b { color: var(--ouro); }
.logo__numero { padding: 6px 9px 5px; color: var(--marinho); background: var(--ouro); font-family: var(--display); font-size: clamp(1rem, 3.6vw, 1.36rem); line-height: 1; }

.selo-oficial { position: relative; z-index: 2; display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border: 1.5px solid rgba(255, 255, 255, .5); border-radius: 999px; font-size: .6rem; font-weight: 900; letter-spacing: .16em; white-space: nowrap; }
.selo-oficial svg { width: 14px; stroke: var(--ouro); stroke-width: 3; }

/* ---------------- Base ---------------- */
main { flex: 1; }
.passo { display: none; }
.passo.is-ativo { display: block; }

.kicker { margin: 0; color: var(--ouro); font-size: .66rem; font-weight: 900; letter-spacing: .24em; }
.kicker--escuro { color: var(--azul); }

.titulo-gigante { margin: 16px 0 0; font-family: var(--display); font-size: clamp(3.2rem, 11vw, 7rem); letter-spacing: -.05em; line-height: .86; }
.titulo-gigante em { color: var(--ouro); font-style: normal; }
.titulo-gigante--menor { font-size: clamp(2.5rem, 7.6vw, 4.8rem); }

.titulo-secao { margin: 12px 0 0; color: var(--marinho); font-family: var(--display); font-size: clamp(2.2rem, 7vw, 4.4rem); letter-spacing: -.045em; line-height: .86; }
.titulo-secao em { color: var(--azul); font-style: normal; }

/* ---------------- Botões ---------------- */
.botao {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 62px;
  padding: 0 26px;
  border: 0;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-align: center;
  box-shadow: 8px 8px 0 var(--azul-claro);
  transition: transform .22s ease, box-shadow .22s ease, background .22s ease;
}
.botao svg { width: 21px; flex: none; }
.botao--ouro { color: var(--marinho); background: var(--ouro); }
.botao--azul { color: var(--branco); background: var(--azul-medio); box-shadow: 8px 8px 0 var(--ouro-escuro); }
.botao--largo { width: 100%; min-height: 70px; font-size: .8rem; }
.botao:hover { transform: translate(-2px, -2px); box-shadow: 12px 12px 0 var(--azul-claro); }
.botao--azul:hover { box-shadow: 12px 12px 0 var(--ouro-escuro); }
.botao:active { transform: translate(3px, 3px); box-shadow: 4px 4px 0 var(--azul-claro); }

.link-discreto { padding: 10px 0; border: 0; background: none; color: inherit; font-size: .74rem; font-weight: 800; letter-spacing: .04em; text-decoration: underline; text-underline-offset: 5px; opacity: .72; }
.link-discreto:hover { opacity: 1; }

/* ==================================================================
   PASSO 1 — capa
================================================================== */
.passo--capa { position: relative; display: none; min-height: calc(100vh - var(--topbar)); color: var(--branco); background: linear-gradient(155deg, #12408c, #0a2559 58%, var(--marinho)); overflow: hidden; }
.passo--capa.is-ativo { display: grid; align-items: center; }

.capa__fundo { position: absolute; inset: 0; }
.capa__grade { position: absolute; inset: 0; opacity: .16; background-image: linear-gradient(rgba(255, 255, 255, .7) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .7) 1px, transparent 1px); background-size: 58px 58px; }
.capa__brilho { position: absolute; top: -18%; right: -14%; width: min(74vw, 780px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, rgba(242, 194, 24, .34), transparent 62%); }
.capa__faixa { position: absolute; right: -12%; bottom: -16%; width: 64%; height: 32%; background: var(--ouro); transform: rotate(-8deg); opacity: .92; }
.capa__faixa::after { content: ""; position: absolute; inset: auto 0 calc(100% + 16px) 0; height: 14px; background: var(--azul-claro); }

.capa__conteudo { position: relative; z-index: 3; width: min(780px, 100%); padding: clamp(44px, 8vw, 96px) clamp(22px, 6vw, 78px) clamp(56px, 8vw, 90px); }
.capa__firma { margin: 14px 0 0; color: var(--ouro-claro); font-family: var(--firma); font-size: clamp(1.8rem, 5.4vw, 2.9rem); font-weight: 700; line-height: 1; }
.capa__lead { max-width: 540px; margin: 26px 0 0; color: rgba(255, 255, 255, .8); font-size: 1rem; line-height: 1.72; }
.capa__acoes { display: grid; gap: 20px; max-width: 480px; margin-top: 42px; }
.capa__acoes--coluna { max-width: 420px; }
.capa__nota { max-width: 460px; margin: 30px 0 0; color: rgba(255, 255, 255, .55); font-size: .76rem; line-height: 1.6; }

.trilha { display: flex; align-items: center; gap: 14px; margin: 52px 0 0; padding: 0; list-style: none; }
.trilha__item { display: flex; align-items: center; gap: 9px; color: rgba(255, 255, 255, .45); font-size: .6rem; font-weight: 900; letter-spacing: .16em; }
.trilha__item + .trilha__item::before { content: ""; width: clamp(20px, 6vw, 64px); height: 1px; margin-right: 5px; background: rgba(255, 255, 255, .28); }
.trilha__item span { display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid rgba(255, 255, 255, .32); border-radius: 50%; font-size: .68rem; }
.trilha__item.is-ativo { color: var(--branco); }
.trilha__item.is-ativo span { color: var(--marinho); background: var(--ouro); border-color: var(--ouro); }

/* ==================================================================
   PASSO 2 — editor
================================================================== */
.passo--editor { padding: clamp(30px, 5vw, 62px) clamp(18px, 5vw, 64px) clamp(60px, 8vw, 96px); }
.editor__cabeca { margin-bottom: clamp(26px, 4vw, 42px); }

.editor__grade { display: grid; gap: clamp(28px, 4vw, 52px); align-items: start; }
.editor__coluna { display: grid; gap: 18px; }

.palco { padding: clamp(10px, 2vw, 16px); background: var(--branco); border-radius: 20px; box-shadow: 0 24px 60px rgba(5, 22, 58, .18); }
.palco__canvas { display: block; width: auto; height: auto; max-width: 100%; max-height: min(62vh, 720px); margin: 0 auto; border-radius: 12px; background: var(--marinho); touch-action: none; cursor: grab; }
.palco__canvas:active { cursor: grabbing; }

.palco__dica { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0; color: var(--marinho); font-size: .68rem; font-weight: 900; letter-spacing: .12em; opacity: .66; }
.palco__dica svg { width: 19px; }

.zoom { display: grid; grid-template-columns: 78px 1fr 78px; gap: 12px; }
.zoom__botao, .zoom__centro { min-height: 62px; border: 1.5px solid var(--linha); background: var(--branco); border-radius: 12px; color: var(--marinho); font-weight: 900; transition: border-color .2s ease, background .2s ease, transform .2s ease; }
.zoom__botao { font-size: 1.5rem; line-height: 1; }
.zoom__centro { font-size: .74rem; letter-spacing: .14em; }
.zoom__botao:hover, .zoom__centro:hover { border-color: var(--azul); background: #eef3fc; }
.zoom__botao:active, .zoom__centro:active { transform: translateY(2px); }

.bloco { display: grid; gap: 14px; }
.bloco__cabeca { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.bloco__titulo { margin: 0; color: var(--marinho); font-family: var(--display); font-size: 1.1rem; letter-spacing: -.025em; }
.bloco__aviso { color: rgba(4, 17, 44, .42); font-size: .6rem; font-weight: 900; letter-spacing: .14em; }
.bloco__aviso--ok { display: inline-flex; align-items: center; gap: 7px; color: #0f8f4f; }
.bloco__aviso--ok svg { width: 14px; stroke-width: 3.2; }

.formatos, .molduras { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.formato { position: relative; display: flex; align-items: center; gap: 12px; padding: 16px 14px; border: 2px solid var(--linha); border-radius: 14px; background: var(--branco); text-align: left; transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.formato:hover { border-color: var(--azul); transform: translateY(-2px); }
.formato.is-ativo { border-color: var(--ouro); box-shadow: 0 0 0 4px rgba(242, 194, 24, .3); }
.formato__icone { flex: none; width: 26px; border: 2px solid var(--azul); border-radius: 4px; }
.formato__icone[data-proporcao="quadrado"] { height: 26px; }
.formato__icone[data-proporcao="feed"] { height: 32px; }
.formato__icone[data-proporcao="story"] { height: 38px; }
.formato__texto { display: grid; gap: 3px; }
.formato__nome { color: var(--marinho); font-size: .76rem; font-weight: 900; letter-spacing: .04em; }
.formato__medida { color: rgba(4, 17, 44, .45); font-size: .66rem; font-weight: 600; white-space: nowrap; }

.moldura { position: relative; display: grid; gap: 10px; padding: 10px 10px 12px; border: 2px solid var(--linha); border-radius: 14px; background: var(--branco); transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.moldura:hover { border-color: var(--azul); transform: translateY(-2px); }
.moldura.is-ativo { border-color: var(--ouro); box-shadow: 0 0 0 4px rgba(242, 194, 24, .3); }
.moldura canvas { display: block; width: 100%; height: auto; border-radius: 8px; background: var(--marinho); }
.moldura__nome { color: var(--marinho); font-size: .68rem; font-weight: 900; letter-spacing: .1em; text-align: center; }

.formato__check, .moldura__check { position: absolute; top: -9px; right: -9px; display: none; width: 26px; height: 26px; border-radius: 50%; background: #13a35a; color: var(--branco); place-items: center; }
.formato__check svg, .moldura__check svg { width: 14px; stroke-width: 3.4; }
.formato.is-ativo .formato__check, .moldura.is-ativo .moldura__check { display: grid; }

.editor__rodape { display: grid; justify-items: center; gap: 6px; margin-top: 4px; }

/* ==================================================================
   PASSO 3 — resultado
================================================================== */
.passo--final { position: relative; padding: clamp(36px, 6vw, 76px) clamp(18px, 5vw, 64px) clamp(64px, 8vw, 100px); color: var(--branco); background: linear-gradient(155deg, #12408c, #0a2559 60%, var(--marinho)); overflow: hidden; }
.final__fundo { position: absolute; inset: 0; }
.final__grade { position: relative; z-index: 3; display: grid; gap: clamp(30px, 5vw, 64px); align-items: center; }
.final__arte { padding: 12px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .26); border-radius: 18px; }
.final__arte img { width: 100%; max-height: min(64vh, 760px); object-fit: contain; margin: 0 auto; border-radius: 10px; }
.final__links { display: flex; flex-wrap: wrap; gap: 22px; margin-top: 26px; color: rgba(255, 255, 255, .8); }

/* ---------------- Rodapé ---------------- */
.rodape { display: grid; gap: 20px; padding: clamp(36px, 5vw, 60px) clamp(18px, 5vw, 64px); color: var(--branco); background: var(--tinta); }
.logo--rodape .logo__nome { font-size: 1.05rem; }
.rodape__texto { margin: 0; font-size: .66rem; font-weight: 900; letter-spacing: .12em; line-height: 1.9; }
.rodape__texto small { display: block; color: rgba(255, 255, 255, .46); font-size: .58rem; letter-spacing: .08em; }
.rodape__links { display: flex; flex-wrap: wrap; gap: 22px; font-size: .63rem; font-weight: 900; letter-spacing: .12em; }
.rodape__links a { padding-bottom: 4px; border-bottom: 1px solid rgba(255, 255, 255, .3); }
.rodape__credito { color: rgba(255, 255, 255, .5); font-size: .68rem; }
.rodape__credito b { color: var(--ouro); }

/* ---------------- Aviso flutuante ---------------- */
.aviso { position: fixed; right: 18px; bottom: 18px; z-index: 500; max-width: 380px; padding: 16px 20px; color: var(--branco); background: var(--marinho); border-left: 5px solid var(--ouro); box-shadow: 0 18px 50px rgba(0, 0, 0, .3); font-size: .78rem; font-weight: 700; line-height: 1.55; opacity: 0; transform: translateY(16px); transition: opacity .25s ease, transform .25s ease; pointer-events: none; }
.aviso.is-visible { opacity: 1; transform: translateY(0); }

/* ==================================================================
   Responsivo
================================================================== */
@media (min-width: 900px) {
  .editor__grade { grid-template-columns: minmax(0, 1fr) minmax(340px, 430px); }
  .editor__coluna--opcoes { gap: 28px; position: sticky; top: 26px; }
  .final__grade { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .final__arte img { max-height: 70vh; }
  .capa__acoes { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 620px; }
  .capa__acoes--coluna { grid-template-columns: 1fr; }
}

@media (max-width: 899px) {
  :root { --topbar: 82px; }
  .topbar { padding: 14px 18px; }
  .logo__escudo { width: 34px; }
  .selo-oficial { padding: 9px 14px; font-size: .55rem; }
  .palco__canvas { max-height: 54vh; }

  /* Mesma ordem do fluxo no celular: formato, foto, ajuste, molduras */
  .editor__grade { display: flex; flex-direction: column; align-items: stretch; gap: 20px; }
  .editor__coluna { display: contents; }
  .bloco--formatos { order: 1; }
  .palco { order: 2; }
  .palco__dica { order: 3; }
  .zoom { order: 4; }
  .bloco--molduras { order: 5; }
  .editor__rodape { order: 6; margin-top: 8px; }
}

/* Abaixo disso o nome inteiro nao cabe ao lado do selo, e o nome ganha */
@media (max-width: 720px) {
  .selo-oficial { display: none; }
}

@media (max-width: 560px) {
  .topbar__canto { display: none; }
  .logo__nome { font-size: .86rem; }
  .logo__numero { font-size: .9rem; padding: 5px 7px 4px; }
  .logo__cargo { font-size: .47rem; letter-spacing: .15em; }
  .capa__brilho { right: -40%; }
  .capa__faixa { right: -26%; bottom: -24%; width: 88%; height: 28%; }
  .botao { min-height: 58px; font-size: .68rem; }
  .formato { flex-direction: column; gap: 9px; padding: 14px 8px; text-align: center; }
  .formato__texto { justify-items: center; }
  .formato__nome { font-size: .68rem; }
  .formato__medida { font-size: .58rem; }
  .formato__check, .moldura__check { top: -8px; right: -8px; width: 23px; height: 23px; }
  .bloco__cabeca { gap: 6px; }
  .zoom { grid-template-columns: 64px 1fr 64px; }
  .trilha { gap: 8px; }
  .trilha__item { font-size: .53rem; letter-spacing: .1em; }
  .trilha__item + .trilha__item::before { width: 16px; }
  .aviso { right: 12px; left: 12px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
