@font-face { font-family: "EB Garamond"; src: url(fontes/EBGaramond-wght.ttf) format("truetype"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url(fontes/EBGaramond-Italic-wght.ttf) format("truetype"); font-style: italic; font-weight: 400 800; font-display: swap; }
@font-face { font-family: "Lato"; src: url(fontes/Lato-Light.ttf) format("truetype"); font-weight: 300; font-display: swap; }

:root {
  --fundo: #0b2420;
  --turquesa: #16413a;
  --ouro: #c8b27e;
  --ouro-claro: #e4d3a6;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: var(--fundo); color: var(--ouro); overflow: hidden; overscroll-behavior: none; }
body { font-family: "Lato", system-ui, sans-serif; font-weight: 300; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

#palco { position: fixed; inset: 0; background: radial-gradient(120% 90% at 50% 40%, #12352f 0%, var(--fundo) 70%); }

/* ---------- filme ---------- */
#filme { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; opacity: 0; transition: opacity .6s ease; }
#palco.tocando #filme, #palco.pausado #filme { opacity: 1; }

#pausa { position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%;
  background: rgba(11, 36, 32, .55); border: 1px solid rgba(200, 178, 126, .5); display: grid; place-items: center;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: opacity .3s; }
#pausa svg { width: 34px; height: 34px; fill: var(--ouro-claro); margin-left: 4px; }

#barra { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 20px calc(18px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, .55)); transition: opacity .3s; }
#voltar { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--ouro-claro); padding: 8px 0; }
#progresso { height: 2px; background: rgba(200, 178, 126, .25); margin-top: 8px; }
#progresso span { display: block; height: 100%; width: 0; background: var(--ouro); }

/* ---------- cartão (capa do livro) ---------- */
#cartao { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4.5vh; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); cursor: pointer; perspective: 1600px;
  transition: opacity .7s ease .55s, visibility 0s linear 1.25s; }
.livro { position: relative; height: min(76vh, 150vw); aspect-ratio: 9 / 16; transform-origin: 0 50%; transform-style: preserve-3d;
  border-radius: 3px 8px 8px 3px; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .8), 0 0 0 1px rgba(200, 178, 126, .12);
  background: #123630; animation: entra 1.4s cubic-bezier(.2, .7, .2, 1) both; transition: transform 1.2s cubic-bezier(.55, .05, .3, 1), box-shadow 1.2s; }
.capa { backface-visibility: hidden; -webkit-backface-visibility: hidden; display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
/* lombada: leve sombra na borda esquerda, como um livro fechado */
.livro::before { content: ""; position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; transform: translateZ(.1px); border-radius: inherit; pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, .45) 0, rgba(0, 0, 0, 0) 5%, rgba(255, 255, 255, .05) 6%, rgba(0, 0, 0, 0) 9%); }
.brilho { backface-visibility: hidden; -webkit-backface-visibility: hidden; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; overflow: hidden; }
.brilho::after { content: ""; position: absolute; top: -20%; bottom: -20%; width: 40%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(228, 211, 166, .10), transparent); transform: skewX(-12deg);
  animation: reflexo 6s ease-in-out 1.6s infinite; }
#convite { font-size: 13px; letter-spacing: .32em; text-transform: uppercase; color: var(--ouro); padding-left: .32em;
  animation: entra-texto 1.2s ease .9s both, pulsa 3.2s ease-in-out 2.1s infinite; }

@keyframes entra { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes entra-texto { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulsa { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes reflexo { 0% { left: -60%; } 45%, 100% { left: 130%; } }

/* abrir: a capa gira pela lombada e o filme aparece por trás */
#palco.tocando #cartao, #palco.pausado #cartao { opacity: 0; visibility: hidden; pointer-events: none; }
#palco.tocando .livro, #palco.pausado .livro { transform: rotateY(-105deg); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0); animation: none; }
#palco.tocando #convite, #palco.pausado #convite { opacity: 0; animation: none; transition: opacity .3s; }
#palco.voltando #cartao { transition: opacity .6s ease; }

/* ---------- dica de instalação ---------- */
#dica { position: absolute; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px;
  padding: 12px 12px 12px 16px; border-radius: 14px; background: rgba(11, 36, 32, .82); border: 1px solid rgba(200, 178, 126, .25);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 14px; line-height: 1.4; color: var(--ouro-claro);
  transition: opacity .4s, transform .4s; z-index: 5; }
#dica p { flex: 1; }
#dica svg { width: 16px; height: 16px; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.dica-botoes { display: flex; align-items: center; gap: 6px; }
#dica-acao { padding: 8px 12px; border-radius: 9px; background: var(--ouro); color: var(--fundo); font-weight: 400; white-space: nowrap; }
#dica-fechar { font-size: 22px; width: 34px; height: 34px; line-height: 1; color: var(--ouro); }
#palco.tocando #dica, #palco.pausado #dica { opacity: 0; pointer-events: none; }

.oculto { opacity: 0 !important; pointer-events: none !important; }
#dica.oculto { transform: translateY(12px); }
@media (prefers-reduced-motion: reduce) { .livro, #convite, .brilho::after { animation: none !important; } .livro { transition: none; } }
