/* =========================================================================
   ATELIÊ DELLA MASSA — base visual, palco 16:9 e interface do apresentador
   ========================================================================= */
:root {
  --vinho: #4a0e1c;
  --bordo: #7b1d34;
  --bordo-2: #9a2c45;
  --rosa: #c98f98;
  --rosa-q: #b76e79;
  --creme: #f6eedf;
  --creme-2: #fbf6ec;
  --bege: #eadbc2;
  --linho: #dccaa9;
  --oliva: #6f7445;
  --oliva-2: #8d925b;
  --oliva-esc: #2c2f1d;
  --ouro: #b8955a;
  --ouro-2: #dcbf86;
  --trigo: #e4c690;
  --madeira: #5a3a26;
  --carvao: #170b0c;
  --tinta: #2b1a17;
  --tinta-2: #5b4740;

  --f-display: "Playfair Display", "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --f-sans: "Manrope", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --f-script: "Italianno", "Segoe Script", "Brush Script MT", cursive;

  --ease: cubic-bezier(.2,.7,.2,1);
  --ease-io: cubic-bezier(.65,0,.35,1);
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0b0506; }
body { font-family: var(--f-sans); color: var(--tinta); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; cursor: default; font-variant-numeric: lining-nums; }
svg text { font-variant-numeric: lining-nums; }
body.idle { cursor: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ---------- Palco 1920×1080 escalonado ---------- */
#viewport { position: fixed; inset: 0; overflow: hidden; }
#stage {
  position: absolute; left: 50%; top: 50%;
  width: 1920px; height: 1080px;
  transform: translate(-50%, -50%) scale(var(--s, 1));
  transform-origin: 50% 50%;
  overflow: hidden; background: var(--carvao);
}
#deck { position: absolute; inset: 0; }
#blackout { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .6s ease; z-index: 90; }
body.blackout #blackout { opacity: 1; }

/* ---------- Slides ---------- */
.slide {
  position: absolute; inset: 0; overflow: hidden;
  visibility: hidden; opacity: 0;
  transition: opacity .9s var(--ease-io), transform 1.1s var(--ease-io), filter .9s var(--ease-io), visibility 0s linear .95s;
  transform: scale(1.012);
}
.slide.is-active { visibility: visible; opacity: 1; transform: none; filter: none; transition: opacity .9s var(--ease-io) .12s, transform 1.2s var(--ease) .12s, filter .9s var(--ease-io), visibility 0s; z-index: 2; }
.slide.is-leaving { visibility: visible; opacity: 0; transform: scale(.985); filter: blur(6px); z-index: 1; }
.slide.is-leaving.back { transform: scale(1.02); }
.slide.t-iris.is-active { animation: iris 1.4s var(--ease-io) both; }
@keyframes iris { from { clip-path: circle(0% at 50% 55%); } to { clip-path: circle(80% at 50% 55%); } }
.slide.t-curtain.is-active { animation: curtain 1.3s var(--ease-io) both; }
@keyframes curtain { from { clip-path: inset(0 50% 0 50%); } to { clip-path: inset(0 0 0 0); } }

.slide > .inner { position: absolute; inset: 0; padding: 110px 140px 120px; }

/* ---------- Transições criativas ---------- */
/* persianas em tiras, como fitas de fettuccine */
.slide.t-strips.is-active { animation: tStrips 1.3s cubic-bezier(.65,0,.35,1) both; } /* keyframes geradas em engine.js */
/* corte diagonal, como a faca na massa */
.slide.t-wipe.is-active { animation: tWipe 1.2s cubic-bezier(.7,0,.25,1) both; }
@keyframes tWipe { from { clip-path: polygon(0 0, 0 0, -30% 100%, -30% 100%); } to { clip-path: polygon(0 0, 130% 0, 100% 100%, -30% 100%); } }
/* aproximação de câmera com foco */
.slide.t-zoom.is-active { animation: tZoom 1.3s cubic-bezier(.2,.7,.2,1) both; }
@keyframes tZoom { from { transform: scale(1.22); filter: blur(16px) brightness(1.4); opacity: 0; } to { transform: none; filter: none; opacity: 1; } }
/* sobe como um cardápio sendo apresentado */
.slide.t-rise.is-active { animation: tRise 1.2s cubic-bezier(.7,0,.2,1) both; }
@keyframes tRise { from { clip-path: inset(100% 0 0 0 round 60px); transform: translateY(80px); } to { clip-path: inset(0 0 0 0 round 0); transform: none; } }
/* abre a partir do centro em losango */
.slide.t-diamond.is-active { animation: tDiamond 1.3s cubic-bezier(.65,0,.35,1) both; }
@keyframes tDiamond { from { clip-path: polygon(50% 50%, 50% 50%, 50% 50%, 50% 50%); } to { clip-path: polygon(50% -60%, 160% 50%, 50% 160%, -60% 50%); } }
.slide.no-trans { transition: none !important; }

/* Fitas de massa (transição de capítulo) */
#transfx { position: absolute; inset: 0; z-index: 30; pointer-events: none; display: flex; }
#transfx i { flex: 1; transform: scaleY(0); transform-origin: top; border-radius: 0 0 40px 40px; box-shadow: inset -8px 0 14px rgba(0,0,0,.18), inset 6px 0 10px rgba(255,255,255,.12); }
#transfx i:nth-child(4n+1) { background: linear-gradient(90deg, #6a1528, #8e2640); }
#transfx i:nth-child(4n+2) { background: linear-gradient(90deg, #b48a4c, #dcbf86); }
#transfx i:nth-child(4n+3) { background: linear-gradient(90deg, #4a0e1c, #6a1528); }
#transfx i:nth-child(4n+4) { background: linear-gradient(90deg, #e9d9b8, #f6eedf); }
#transfx.cover i { animation: ribIn .5s cubic-bezier(.7,0,.3,1) both; animation-delay: calc(var(--k) * 28ms); }
#transfx.reveal i { transform-origin: bottom; border-radius: 40px 40px 0 0; animation: ribOut .65s cubic-bezier(.7,0,.3,1) both; animation-delay: calc(var(--k) * 28ms); }
@keyframes ribIn { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes ribOut { from { transform: scaleY(1); } to { transform: scaleY(0); } }

/* Revelação palavra por palavra */
.wr .w { display: inline-block; opacity: 0; }
.is-active .wr .w { animation: wIn .8s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--wd, 300ms) + var(--wi) * 55ms); }
@keyframes wIn { from { opacity: 0; transform: translateY(.45em); filter: blur(8px); } to { opacity: 1; transform: none; filter: none; } }
.slide.static .wr .w { animation: none; opacity: 1; }

/* Temas */
.th-light { background: var(--creme); color: var(--tinta); }
.th-light::before, .th-paper::before, .th-dark::before, .th-wine::before, .th-olive::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image: var(--grain); opacity: .06; mix-blend-mode: multiply;
}
.th-dark::before, .th-wine::before, .th-olive::before { opacity: .09; mix-blend-mode: overlay; }
.th-paper { background: radial-gradient(120% 90% at 20% 0%, #fffaf0 0%, var(--creme) 45%, #ecdcc1 100%); color: var(--tinta); }
.th-dark { background: radial-gradient(90% 80% at 28% 18%, #3b1219 0%, #200b0e 48%, #120708 100%); color: var(--creme); }
.th-wine { background: radial-gradient(100% 90% at 75% 10%, #9a2c45 0%, #6a1528 45%, #3d0a16 100%); color: var(--creme); }
.th-olive { background: radial-gradient(100% 90% at 20% 15%, #4a4e30 0%, #33361f 50%, #1f2113 100%); color: var(--creme); }
.slide > * { position: relative; z-index: 1; }
.slide > .inner { position: absolute; }

/* Tipografia */
.eyebrow { font-family: var(--f-sans); font-weight: 700; letter-spacing: .32em; text-transform: uppercase; font-size: 19px; color: var(--ouro); display: inline-flex; align-items: center; gap: 18px; }
.eyebrow::before { content: ""; width: 54px; height: 1.5px; background: currentColor; opacity: .8; }
.th-light .eyebrow, .th-paper .eyebrow { color: var(--bordo); }
.h1 { font-family: var(--f-display); font-weight: 600; font-size: 104px; line-height: .98; letter-spacing: -.01em; }
.h2 { font-family: var(--f-display); font-weight: 600; font-size: 78px; line-height: 1.02; letter-spacing: -.005em; }
.h3 { font-family: var(--f-display); font-weight: 600; font-size: 46px; line-height: 1.08; }
.h1 em, .h2 em, .h3 em { font-style: italic; color: var(--ouro-2); font-weight: 500; }
.th-light .h1 em, .th-light .h2 em, .th-light .h3 em, .th-paper .h1 em, .th-paper .h2 em, .th-paper .h3 em { color: var(--bordo); }
.script { font-family: var(--f-script); font-weight: 400; }
.lead { font-size: 30px; line-height: 1.45; font-weight: 500; max-width: 1100px; }
.body { font-size: 25px; line-height: 1.5; }
.muted { opacity: .72; }
.gold { color: var(--ouro-2); }
.th-light .gold, .th-paper .gold { color: var(--ouro); }
.wine { color: var(--bordo); }
.olive { color: var(--oliva); }
.th-dark .olive, .th-wine .olive, .th-olive .olive { color: var(--oliva-2); }
.rule { width: 120px; height: 2px; background: linear-gradient(90deg, var(--ouro), transparent); }

/* Fonte e notas */
.source {
  position: absolute; left: 140px; bottom: 58px; z-index: 3;
  font-size: 16px; letter-spacing: .02em; opacity: .62; max-width: 1300px; line-height: 1.4;
}
.source b { font-weight: 700; }
/* Fontes de rodapé ocultas na apresentação (as referências seguem no código e no apêndice) */
.slide .source { display: none; }
.tag-illus {
  position: absolute; z-index: 4; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700;
  padding: 6px 12px; border-radius: 40px; background: rgba(20,8,10,.62); color: var(--creme); backdrop-filter: blur(4px);
}
.tag-plan { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; letter-spacing: .16em; text-transform: uppercase; font-weight: 800; padding: 7px 14px; border-radius: 40px; border: 1.5px solid currentColor; opacity: .85; }

/* Ponto de revisão (divergências no documento) */
.review {
  position: absolute; right: 48px; top: 40px; z-index: 6; max-width: 470px;
  display: flex; gap: 14px; align-items: flex-start;
  background: #fff3cd; color: #4a3500; border: 2px dashed #c59a1b; border-radius: 14px;
  padding: 14px 18px; font-size: 16px; line-height: 1.35; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.review .rt { display: block; font-size: 13px; letter-spacing: .18em; text-transform: uppercase; margin-bottom: 4px; color: #8a5a00; font-weight: 800; }
.review b { font-weight: 800; }
.review svg { flex: 0 0 26px; width: 26px; height: 26px; stroke: #a36b00; }
body.no-review .review { display: none; }

/* ---------- Revelações progressivas ---------- */
.rv, .rv-l, .rv-r, .rv-s, .rv-f, .rv-d { opacity: 0; }
.is-active .rv   { animation: rvUp 1s var(--ease) both; }
.is-active .rv-l { animation: rvLeft 1s var(--ease) both; }
.is-active .rv-r { animation: rvRight 1s var(--ease) both; }
.is-active .rv-s { animation: rvScale 1.1s var(--ease) both; }
.is-active .rv-f { animation: rvFade 1.4s ease both; }
.is-active .rv-d { animation: rvDown 1s var(--ease) both; }
.is-active :is(.rv,.rv-l,.rv-r,.rv-s,.rv-f,.rv-d) { animation-delay: calc(var(--i, 0) * 140ms + 350ms); }
@keyframes rvUp { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes rvDown { from { opacity: 0; transform: translateY(-34px); } to { opacity: 1; transform: none; } }
@keyframes rvLeft { from { opacity: 0; transform: translateX(-60px); } to { opacity: 1; transform: none; } }
@keyframes rvRight { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: none; } }
@keyframes rvScale { from { opacity: 0; transform: scale(.86); } to { opacity: 1; transform: none; } }
@keyframes rvFade { from { opacity: 0; } to { opacity: 1; } }
.is-active .draw { stroke-dasharray: var(--len, 1200); stroke-dashoffset: var(--len, 1200); animation: draw 2s var(--ease) forwards; animation-delay: calc(var(--i, 0) * 140ms + 400ms); }
@keyframes draw { to { stroke-dashoffset: 0; } }
.slide.static :is(.rv,.rv-l,.rv-r,.rv-s,.rv-f,.rv-d) { animation: none !important; opacity: 1 !important; }
.slide.static, .slide.static.is-active { transition: none; }

/* Ken Burns para imagens de fundo */
.kb { animation: none; }
.is-active .kb { animation: kb 18s ease-out both; }
@keyframes kb { from { transform: scale(1.12) translate(1.5%, 1%); } to { transform: scale(1) translate(0, 0); } }

/* Partículas de farinha (canvas) */
.flour { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }

/* ---------- Interface ---------- */
#chrome { position: fixed; inset: 0; pointer-events: none; z-index: 50; font-family: var(--f-sans); }
#progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.06); }
#progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--bordo-2), var(--ouro-2)); transition: width .8s var(--ease); box-shadow: 0 0 12px rgba(220,191,134,.5); }
#hud {
  position: absolute; right: 22px; bottom: 16px; display: flex; align-items: center; gap: 4px;
  padding: 6px 8px; border-radius: 40px; background: rgba(18,8,10,.55); backdrop-filter: blur(10px);
  border: 1px solid rgba(220,191,134,.18); color: var(--creme);
  pointer-events: auto; opacity: .0; transition: opacity .5s ease, transform .5s ease; transform: translateY(8px);
}
body.show-ui #hud, #hud:hover { opacity: 1; transform: none; }
#hud-info { display: flex; flex-direction: column; align-items: center; min-width: 120px; padding: 0 8px; line-height: 1.1; }
#hud-chapter { font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; opacity: .7; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
#hud-num { font-size: 14px; font-weight: 700; letter-spacing: .06em; }
.hud-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; transition: background .2s; }
.hud-btn:hover { background: rgba(220,191,134,.18); }
.hud-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hud-sep { width: 1px; height: 22px; background: rgba(246,238,223,.2); margin: 0 4px; }
#btn-audio .ic-off { display: none; }
body.muted #btn-audio .ic-on { display: none; }
body.muted #btn-audio .ic-off { display: block; }
#slide-badge { display: none; }

/* número discreto sempre visível */
#chrome::after {
  content: attr(data-num); position: absolute; right: 26px; bottom: 14px; font-size: 13px; font-weight: 700; letter-spacing: .14em;
  color: rgba(246,238,223,.5); mix-blend-mode: difference; transition: opacity .4s;
}
body.show-ui #chrome::after, body.in-cinema #chrome::after { opacity: 0; }
body.clean #chrome::after, body.clean #progress { opacity: 0; }

#cinema-ui { position: absolute; right: 26px; top: 22px; display: flex; gap: 10px; pointer-events: auto; opacity: 0; transition: opacity .4s; }
body.in-cinema.show-ui #cinema-ui { opacity: 1; }
#cinema-ui button { padding: 9px 18px; border-radius: 30px; background: rgba(18,8,10,.55); color: var(--creme); border: 1px solid rgba(220,191,134,.3); font-size: 14px; font-weight: 600; letter-spacing: .06em; backdrop-filter: blur(8px); }
#cinema-ui button:hover { background: rgba(123,29,52,.7); }
body:not(.in-cinema) #cinema-ui { pointer-events: none; }
#skip-hint { position: absolute; left: 50%; bottom: 36px; transform: translate(-50%, 10px); padding: 10px 22px; border-radius: 30px; background: rgba(18,8,10,.7); color: var(--creme); font-size: 14px; letter-spacing: .05em; opacity: 0; transition: all .4s; }
body.skip-armed #skip-hint { opacity: 1; transform: translate(-50%, 0); }
#goto-box { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); padding: 22px 36px; border-radius: 18px; background: rgba(18,8,10,.85); color: var(--creme); display: none; flex-direction: column; align-items: center; gap: 6px; }
#goto-box span { font-size: 13px; letter-spacing: .2em; text-transform: uppercase; opacity: .7; }
#goto-box b { font-size: 54px; font-family: var(--f-display); }
body.goto #goto-box { display: flex; }
body.clean #hud, body.clean #cinema-ui { display: none; }

/* ---------- Menu ---------- */
#menu { position: fixed; inset: 0; z-index: 60; background: rgba(12,5,6,.82); backdrop-filter: blur(14px); opacity: 0; pointer-events: none; transition: opacity .45s ease; color: var(--creme); }
body.menu-open #menu { opacity: 1; pointer-events: auto; }
.menu-inner { position: absolute; inset: 4vh 4vw; display: flex; flex-direction: column; }
.menu-inner header { display: flex; align-items: center; gap: 22px; margin-bottom: 2.4vh; }
.menu-inner header img { width: 74px; height: 74px; object-fit: contain; }
.menu-inner h2 { font-family: var(--f-display); font-size: 40px; font-weight: 600; }
.menu-inner header p { opacity: .65; font-size: 14px; }
#menu-list { flex: 1; overflow: auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px 26px; align-content: start; padding-right: 10px; }
#menu-list::-webkit-scrollbar { width: 8px; } #menu-list::-webkit-scrollbar-thumb { background: rgba(220,191,134,.3); border-radius: 8px; }
.m-ch { border-top: 1px solid rgba(220,191,134,.3); padding-top: 10px; }
.m-ch h3 { font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--ouro-2); margin-bottom: 8px; font-weight: 800; }
.m-ch button { display: flex; gap: 10px; width: 100%; text-align: left; padding: 5px 8px; border-radius: 8px; font-size: 14px; line-height: 1.3; opacity: .85; }
.m-ch button span { opacity: .5; min-width: 24px; font-variant-numeric: tabular-nums; }
.m-ch button:hover { background: rgba(220,191,134,.14); opacity: 1; }
.m-ch button.cur { background: rgba(154,44,69,.55); opacity: 1; }
.m-ch button.cine { font-style: italic; opacity: .6; }
.menu-inner footer { padding-top: 2vh; font-size: 13px; opacity: .7; }
kbd { font-family: var(--f-sans); font-size: 12px; padding: 2px 7px; border-radius: 5px; border: 1px solid rgba(246,238,223,.35); background: rgba(255,255,255,.06); }

/* ---------- Loader ---------- */
#loader { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: #0b0506; color: rgba(246,238,223,.6); font-size: 14px; letter-spacing: .2em; text-transform: uppercase; transition: opacity .8s ease; }
#loader.done { opacity: 0; pointer-events: none; }
.ld-ring { width: 46px; height: 46px; border-radius: 50%; border: 2px solid rgba(220,191,134,.15); border-top-color: var(--ouro-2); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .is-active :is(.rv,.rv-l,.rv-r,.rv-s,.rv-f,.rv-d) { animation-duration: .01s !important; animation-delay: 0s !important; }
}
