/* ==========================================================================
   IDENTIDADE — "Os dois lados" (.sides) e "A evolução" (.evo)
   Mobile primeiro. Sem JavaScript ou com movimento reduzido, as duas seções
   viram composições estáticas completas (classe .is-live só existe com GSAP).
   ========================================================================== */

/* ---------- Os dois lados: versão estática (base) ---------- */
.sides { position: relative; background: var(--paper); color: var(--ink); }
.sides__stage { padding: 84px 6% 72px; }
.sides__head .eyebrow { color: var(--burgundy); }
.sides__head h2, .evo__head h2 {
  margin: 12px 0 0;
  font: 500 clamp(36px, 10vw, 56px)/1.02 var(--font-title);
  letter-spacing: -.055em;
}
.sides__head h2 em { font-weight: 400; color: var(--green); }
.sides__frame { position: relative; display: flex; justify-content: center; gap: 14px; margin: 34px 0 30px; }
.sides__art { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 0; }
.sides__img { position: relative; height: min(52svh, 420px); max-width: 100%; }
.sides__art--front .sides__img { aspect-ratio: 802 / 1400; }
.sides__art--back .sides__img { aspect-ratio: 850 / 1400; }
.sides__img img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 18px 24px rgba(67, 48, 23, .16)); }
.sides__art figcaption { font-size: 9px; font-weight: 700; letter-spacing: .3em; text-transform: uppercase; color: #8a7458; }
.sides__frame .sides__img { height: auto; width: min(42vw, 240px); }
.pin { display: none; }
.sides__detail { display: block; }
.sides__notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.sides__note span { font-size: 9px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--burgundy); }
.sides__note strong { display: block; margin: 4px 0 2px; font: 500 22px/1.1 var(--font-title); letter-spacing: -.02em; }
.sides__note p { margin: 0; font-size: 12.5px; line-height: 1.6; color: #6c6052; max-width: 340px; }

/* ---------- Os dois lados: versão animada ---------- */
.sides.is-live {
  /* Entra 200svh antes do fim do filme e fica por cima dele (z-index): nos
     primeiros 100svh de rolagem fixa, a serra de pergaminho sobe sobre o último
     quadro do filme e o título/rótulo já entram. Sem tela vazia, sem corte. */
  height: 540svh; margin-top: -200svh; z-index: 2; background: transparent;
}
.sides.is-live .sides__stage {
  position: sticky; top: 0; height: 100svh; min-height: 560px; overflow: hidden;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  padding: calc(70px + env(safe-area-inset-top, 0px)) 6% calc(20px + env(safe-area-inset-bottom, 0px));
}
.sides.is-live .sides__frame { margin: 18px 0 14px; min-height: 0; display: block; }
.sides.is-live .sides__art { position: absolute; inset: 0; justify-content: center; will-change: transform, opacity; }
.sides.is-live .sides__img { height: calc(100% - 26px); width: auto; }
.sides.is-live .pin {
  display: block; position: absolute; left: var(--px); top: var(--py);
  width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%;
  border: 1px solid var(--gold); background: radial-gradient(circle, var(--gold) 0 3px, rgba(255, 248, 230, .55) 4px);
  box-shadow: 0 0 0 6px rgba(180, 135, 74, .14);
  opacity: 0; transform: scale(.4);
}
.sides.is-live .sides__detail { display: block; min-height: 112px; }
.sides.is-live .sides__notes { display: grid; gap: 0; }
.sides.is-live .sides__note { grid-area: 1 / 1; opacity: 0; }

/* ---------- A evolução: base (estática) ---------- */
.evo { position: relative; background: #e6ddce; color: var(--ink); }
.evo__stage { padding: 80px 6% 76px; }
.evo__head .eyebrow { color: #8f513e; }
.evo__head h2 em { font-weight: 400; color: var(--green); }
.evo__controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 24px 0 18px; }
.evo__tabs, .evo__toggle { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, .45); border: 1px solid rgba(110, 88, 71, .2); }
.evo button {
  appearance: none; border: 0; background: transparent; color: #6e5847; cursor: pointer;
  min-height: 40px; min-width: 72px; padding: 0 16px; border-radius: 999px;
  font: 700 11px var(--font-body); letter-spacing: .14em; text-transform: uppercase;
  transition: background-color .3s, color .3s;
}
.evo button[aria-selected="true"], .evo button[aria-pressed="true"] { background: var(--green); color: #f6ead3; }
.evo button:focus-visible { outline: 2px solid var(--burgundy); outline-offset: 3px; }
.evo__frame { position: relative; display: flex; justify-content: center; gap: 18px; }
.evo__piece { margin: 0; display: none; flex-direction: column; align-items: center; gap: 12px; min-width: 0; }
.evo__piece img { height: min(54svh, 440px); width: auto; max-width: 100%; object-fit: contain; filter: drop-shadow(0 16px 22px rgba(57, 39, 23, .16)); }
.evo__piece figcaption { text-align: center; display: grid; gap: 4px; }
.evo__piece figcaption b { font-size: 10px; letter-spacing: .24em; text-transform: uppercase; color: #6e5847; }
.evo__piece figcaption span { font-size: 12.5px; line-height: 1.5; color: #625a4f; max-width: 300px; }
.evo__arrow { display: none; }
/* estado escolhido pelos controles (versão estática) */
.evo[data-side="front"][data-phase="antes"]  .evo__piece[data-side="front"][data-phase="antes"],
.evo[data-side="front"][data-phase="depois"] .evo__piece[data-side="front"][data-phase="depois"],
.evo[data-side="back"][data-phase="antes"]   .evo__piece[data-side="back"][data-phase="antes"],
.evo[data-side="back"][data-phase="depois"]  .evo__piece[data-side="back"][data-phase="depois"] { display: flex; }

/* ---------- A evolução: versão animada ---------- */
.evo.is-live { height: 460svh; }
.evo.is-live .evo__stage {
  position: sticky; top: 0; height: 100svh; min-height: 560px; overflow: hidden;
  display: grid; grid-template-rows: auto auto minmax(0, 1fr);
  padding: calc(64px + env(safe-area-inset-top, 0px)) 6% calc(18px + env(safe-area-inset-bottom, 0px));
}
.evo.is-live .evo__controls { margin: 18px 0 10px; }
.evo.is-live .evo__frame { display: block; min-height: 0; }
.evo.is-live .evo__piece { display: flex; position: absolute; inset: 0; justify-content: center; opacity: 0; will-change: transform, opacity; }
.evo.is-live .evo__piece img { height: auto; max-height: calc(100% - 64px); }

/* ---------- Telas baixas ---------- */
@media (max-width: 700px) and (max-height: 700px) {
  .sides.is-live .sides__stage, .evo.is-live .evo__stage { padding-top: 58px; }
  .sides__head h2, .evo__head h2 { font-size: 32px; }
  .sides.is-live .sides__detail { min-height: 92px; }
  .sides__note strong { font-size: 18px; }
  .sides__note p { font-size: 11.5px; }
  .evo button { min-height: 38px; min-width: 64px; padding: 0 12px; font-size: 10px; }
  .evo__piece figcaption span { display: none; }
}

/* ---------- Tablet e desktop ---------- */
@media (min-width: 701px) {
  .sides__stage, .evo__stage { padding-left: 7%; padding-right: 7%; }
  .sides__head h2, .evo__head h2 { font-size: clamp(48px, 5.4vw, 88px); }
  .sides__frame .sides__img { width: auto; height: min(60svh, 560px); }
  .sides__frame { gap: 40px; }
  .sides__notes { grid-template-columns: repeat(3, 1fr); gap: 28px; }

  .sides.is-live .sides__stage {
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    grid-template-rows: auto minmax(0, 1fr);
    column-gap: 5%;
    padding-top: 96px; padding-bottom: 48px;
  }
  .sides.is-live .sides__head { grid-column: 1; grid-row: 1; }
  .sides.is-live .sides__detail { grid-column: 1; grid-row: 2; align-self: center; max-width: 420px; }
  .sides.is-live .sides__frame { grid-column: 2; grid-row: 1 / span 2; margin: 0; }
  .sides.is-live .sides__notes { grid-template-columns: 1fr; }
  .sides__note strong { font-size: 40px; }
  .sides__note span { font-size: 10px; }
  .sides__note p { font-size: 14px; line-height: 1.75; }

  .evo__frame { gap: 60px; }
  .evo__piece img { height: min(58svh, 520px); }
  .evo[data-side="front"] .evo__piece[data-side="front"],
  .evo[data-side="back"]  .evo__piece[data-side="back"] { display: flex; }
  .evo.is-live .evo__stage { grid-template-columns: 1fr auto; grid-template-rows: auto minmax(0, 1fr); column-gap: 40px; padding-top: 92px; padding-bottom: 36px; }
  .evo.is-live .evo__head { grid-column: 1; grid-row: 1; }
  .evo.is-live .evo__controls { grid-column: 2; grid-row: 1; align-self: end; flex-direction: column; align-items: flex-end; margin: 0 0 8px; }
  .evo.is-live .evo__frame { grid-column: 1 / span 2; grid-row: 2; margin-top: 24px; }
  .evo.is-live .evo__piece--old { right: 50%; }
  .evo.is-live .evo__piece--new { left: 50%; }
  .evo.is-live .evo__arrow {
    display: grid; place-items: center; position: absolute; left: 50%; top: 42%;
    width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%;
    background: rgba(255, 255, 255, .55); color: #6a5138; font-size: 18px; opacity: 0;
  }
}


/* ---------- Etapa 3: amanhecer, foco de luz e legendas ---------- */
.sides__dawn { display: none; }
.sides.is-live .sides__dawn {
  display: block; position: absolute; inset: 0; z-index: 0;
  background: var(--paper); will-change: transform;
}
.sides__dawn svg { position: absolute; left: 0; bottom: calc(100% - 1px); width: 100%; height: 12svh; fill: var(--paper); }
.sides.is-live .sides__head, .sides.is-live .sides__frame, .sides.is-live .sides__detail { position: relative; z-index: 1; }
/* Foco de luz: um véu de pergaminho esmaece o resto da arte em volta do detalhe */
.spot { display: none; }
.sides.is-live .spot {
  display: block; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at var(--sx, 50%) var(--sy, 50%), rgba(245, 239, 228, 0) 0 20%, rgba(245, 239, 228, .36) 46%);
}
.sides.is-live .pin { z-index: 2; }
.sides.is-live .sides__detail {
  border-left: 2px solid var(--gold); padding: 2px 0 2px 16px;
}
@media (max-width: 700px) {
  .sides.is-live .sides__detail {
    border: 1px solid rgba(163, 124, 79, .23); border-radius: 14px; padding: 14px 16px;
    background: rgba(255, 252, 246, .85); box-shadow: 0 9px 26px rgba(51, 34, 14, .055);
  }
  .sides.is-live .sides__note strong { font-size: 21px; border-left: 2px solid var(--gold); padding-left: 12px; }
  .sides.is-live .sides__note p { font-size: 12px; line-height: 1.52; }
}

/* ---------- Etapa 3: evolução por cortina com fio dourado ---------- */
.evo__media { position: relative; display: block; line-height: 0; }
.evo__media img { display: block; }
.evo.is-live .evo__piece--new .evo__media img { clip-path: inset(calc((1 - var(--r, 1)) * 100%) 0 0 0); }
.evo.is-live .evo__piece--new .evo__media::after {
  content: ""; position: absolute; left: -8px; right: -8px; height: 1px;
  top: calc((1 - var(--r, 1)) * 100%);
  background: linear-gradient(90deg, transparent, var(--gold) 15%, #f3d39b 50%, var(--gold) 85%, transparent);
  box-shadow: 0 0 10px rgba(226, 189, 132, .8);
  opacity: calc(var(--r, 1) * (1 - var(--r, 1)) * 8);
}
.evo.is-live .evo__media { flex: 1 1 auto; min-height: 0; }
.evo.is-live .evo__piece .evo__media img { height: 100%; max-height: none; width: auto; max-width: 100%; object-fit: contain; }
