/* ==================================================================
   Refeitório #CaCor - cortinas de entrada e saída
   Marca do IFPI (quadrados brancos + círculo vermelho) montando-se
   sobre o verde institucional.
   ================================================================== */
.rf-cortina {
  position: fixed; left: 0; right: 0; top: -10vh; bottom: 0; padding: 10vh 16px 0;
  z-index: 3000; background: #1f5f30; color: #fff; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center; font-family: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  --atraso: .1s;
}
.rf-cortina[hidden] { display: none; }
.rf-cortina.cobre { --atraso: .3s; }

/* Bolhas de cor ao fundo */
.rf-cortina .bola { position: absolute; border-radius: 50%; animation: rf-pop .7s cubic-bezier(.34,1.56,.64,1) both; }
.rf-cortina .b1 { width: 46vmax; height: 46vmax; right: -16vmax; top: -14vmax; background: #c0282d; animation-delay: var(--atraso); }
.rf-cortina .b2 { width: 22vmax; height: 22vmax; right: 16vmax; top: -8vmax; background: #ffb938; animation-delay: calc(var(--atraso) + .12s); }
.rf-cortina .b3 { width: 30vmax; height: 30vmax; left: -12vmax; bottom: -14vmax; background: #2e9e4a; animation-delay: calc(var(--atraso) + .2s); }
.rf-cortina .b4 { width: 9vmax; height: 9vmax; left: 15vmax; bottom: 6vmax; background: #ffb938; animation-delay: calc(var(--atraso) + .3s); }

/* Marca do IFPI */
.rf-cortina .rf-if { position: relative; display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.rf-cortina .rf-if svg { width: 96px; height: 130px; overflow: visible; flex: 0 0 auto; }
.rf-cortina .rf-if .q { fill: #fff; transform-box: fill-box; transform-origin: center;
  animation: rf-pop .45s cubic-bezier(.34,1.8,.64,1) both; animation-delay: calc(var(--i) * 55ms + var(--atraso)); }
.rf-cortina .rf-if .o { fill: #e3262d; stroke: #fff; stroke-width: 2.5; transform-box: fill-box; transform-origin: center;
  animation: rf-cai .65s cubic-bezier(.3,.9,.4,1) both; animation-delay: calc(var(--atraso) + .5s); }
.rf-cortina .rf-if-txt { text-align: left; line-height: 1.02; animation: rf-lado .45s ease-out both; animation-delay: calc(var(--atraso) + .35s); }
.rf-cortina .rf-if-txt b { display: block; font-size: 1.6rem; font-weight: 900; letter-spacing: .02em; }
.rf-cortina .rf-if-txt span { display: block; font-size: 1.35rem; margin-top: 4px; }
.rf-cortina .rf-if-txt small { display: block; font-size: 1rem; margin-top: 2px; color: #cfe8d6; }

/* Saudação com letras pulando */
.rf-cortina .rf-onda { position: relative; margin: 0; font-size: clamp(2rem, 6.5vw, 3.2rem); font-weight: 800; line-height: 1.15; color: #fff; }
.rf-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rf-onda span span { display: inline-block; white-space: pre; animation: rf-pula .55s cubic-bezier(.34,1.9,.64,1) both;
  animation-delay: calc(var(--i) * 22ms + var(--atraso) + .5s); }
.rf-cortina .rf-frase { position: relative; margin: 4px 0 0; font-size: 1.3rem; color: #d9eedf;
  animation: rf-surge .4s ease-out both; animation-delay: calc(var(--atraso) + 1s); }

/* Pratinhos flutuando */
.rf-cortina .rf-comida { position: absolute; width: 64px; height: 64px; padding: 12px; box-sizing: border-box;
  background: #fff; border-radius: 50%; box-shadow: 0 8px 18px rgba(0,0,0,.22);
  animation: rf-pop .5s cubic-bezier(.34,1.8,.64,1) both, rf-flutua 2.6s ease-in-out infinite;
  animation-delay: calc(var(--d) + var(--atraso)), calc(var(--d) + var(--atraso) + .5s); }
.rf-cortina .rf-comida img { width: 100%; height: 100%; display: block; }

/* Bolinhas de "carregando" nas cores do campus */
.rf-pontos { position: relative; display: flex; gap: 8px; margin-top: 10px; }
.rf-pontos i { width: 14px; height: 14px; border-radius: 50%; animation: rf-quica .55s ease-in-out infinite alternate; }
.rf-pontos i:nth-child(1) { background: #e3262d; }
.rf-pontos i:nth-child(2) { background: #ffb938; animation-delay: .15s; }
.rf-pontos i:nth-child(3) { background: #fff; animation-delay: .3s; }

/* Movimento da cortina */
.rf-cortina.entrada { animation: rf-sobe .6s cubic-bezier(.6,-.3,.74,.05) 2s both; }
.rf-cortina.revela  { animation: rf-sobe .6s cubic-bezier(.6,-.3,.74,.05) 1.6s both; }
.rf-cortina.cobre   { animation: rf-desce .6s cubic-bezier(.34,1.3,.64,1) both; }

@keyframes rf-pop    { from { transform: scale(0); opacity: 0; } }
@keyframes rf-cai    { 0% { transform: translateY(-120px); opacity: 0; } 55% { transform: translateY(3px); opacity: 1; }
                       72% { transform: translateY(-14px) scaleY(1.04); } 86% { transform: translateY(0) scaleY(.94); } 100% { transform: none; } }
@keyframes rf-lado   { from { opacity: 0; transform: translateX(-14px); } }
@keyframes rf-pula   { from { opacity: 0; transform: translateY(26px) scale(.4) rotate(-12deg); } }
@keyframes rf-surge  { from { opacity: 0; transform: translateY(10px); } }
@keyframes rf-flutua { 50% { translate: 0 -12px; rotate: 9deg; } }
@keyframes rf-quica  { to { transform: translateY(-12px); } }
@keyframes rf-sobe   { to { transform: translateY(-112%); } }
@keyframes rf-desce  { from { transform: translateY(-112%); } }

@media (max-width: 600px) {
  .rf-cortina .rf-comida { width: 46px; height: 46px; padding: 9px; }
  .rf-cortina .rf-if svg { width: 70px; height: 95px; }
  .rf-cortina .rf-if-txt b { font-size: 1.2rem; }
  .rf-cortina .rf-if-txt span { font-size: 1.05rem; }
  .rf-cortina .rf-if-txt small { font-size: .85rem; }
}
@media (prefers-reduced-motion: reduce) {
  .rf-cortina, .rf-cortina * { animation: none !important; }
  .rf-cortina.entrada, .rf-cortina.revela { display: none; }
}
@media print { .rf-cortina { display: none !important; } }


/* Saída (botão Sair): carregamento rápido e leve */
.rf-saida { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center;
  background: rgba(20,60,32,.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: rf-sd-fundo .2s ease-out both; }
.rf-saida[hidden] { display: none; }
.rf-sd-caixa { display: flex; align-items: center; gap: 12px; background: #fff; color: #1f5f30; border-radius: 999px;
  padding: 12px 22px 12px 14px; font: 700 1rem "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  box-shadow: 0 12px 30px rgba(0,0,0,.2); animation: rf-sd-caixa .25s cubic-bezier(.34,1.5,.64,1) both; }
.rf-sd-giro { width: 22px; height: 22px; border-radius: 50%; border: 3px solid #e3efe6; border-top-color: #2e9e4a; border-right-color: #e3262d;
  animation: rf-sd-gira .6s linear infinite; }
@keyframes rf-sd-fundo { from { opacity: 0; } }
@keyframes rf-sd-caixa { from { opacity: 0; transform: scale(.85); } }
@keyframes rf-sd-gira { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rf-saida, .rf-sd-caixa { animation: none; } .rf-sd-giro { animation-duration: 1.2s; } }
@media print { .rf-saida { display: none !important; } }
