/* Aviso de alergicos da linha Sem Alergenos (pop-up). Usado por public/js/allergen-warning.js.
   A frase principal e os botoes ficam no rodape fixo do cartao: aparecem desde o primeiro quadro,
   mesmo quando a historinha de cima precisa rolar numa tela pequena. */
html.allergy-modal-open, html.allergy-modal-open body { overflow: hidden; }
.allergy-modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 2vh 3vw; }
.allergy-modal[hidden] { display: none; }
.allergy-modal__backdrop { position: absolute; inset: 0; background: rgba(43, 29, 23, 0.82); }
.allergy-modal__box {
  position: relative; width: min(1000px, 94vw); min-height: min(86vh, 720px); max-height: 96vh; max-height: 96dvh;
  display: flex; flex-direction: column; overflow: hidden;
  border: 4px solid var(--ink); border-radius: var(--radius-lg);
  background: var(--paper); box-shadow: 10px 10px 0 var(--danger);
  background-image: repeating-linear-gradient(-45deg, transparent 0 22px, rgba(184, 35, 45, 0.05) 22px 44px);
  animation: allergy-pop 0.35s var(--ease-pop);
}
.allergy-modal__scroll {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: clamp(10px, 2vh, 20px);
  padding: clamp(16px, 3.5vw, 40px) clamp(14px, 4vw, 48px) 12px;
}
/* Centraliza com margens automaticas: se faltar espaco, rola a partir do topo (sem cortar o titulo). */
.allergy-modal__scroll > :first-child { margin-top: auto; }
.allergy-modal__scroll > :last-child { margin-bottom: auto; }
.allergy-modal__head { display: flex; align-items: center; justify-content: center; gap: clamp(10px, 2vw, 18px); text-align: left; }
.allergy-modal__sign {
  flex: none; width: clamp(54px, 9vw, 96px); height: clamp(54px, 9vw, 96px); display: grid; place-items: center;
  border: 4px solid var(--ink); border-radius: 50%; background: var(--danger); color: #fff;
  font-family: var(--font-display); font-size: clamp(2.4rem, 6vw, 4.2rem); line-height: 1; box-shadow: var(--shadow-hard);
}
.allergy-modal__kicker { margin: 0; font-family: var(--font-script); font-size: clamp(1.45rem, 3.6vw, 2.1rem); line-height: 1.1; color: var(--danger); }
.allergy-modal__title { font-family: var(--font-display); font-weight: 400; text-transform: uppercase; font-size: clamp(2rem, 6vw, 4rem); line-height: 0.95; letter-spacing: 0.02em; }

/* Historinha: ilustracao + as quatro frases (todas visiveis; a da vez ganha destaque). */
.allergy-modal__story { display: grid; gap: 12px 28px; align-items: center; }
.allergy-modal__art {
  display: block; width: 100%; height: auto; max-height: 30vh;
  border: 3px solid var(--ink); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow-hard-sm);
}
.allergy-modal__lines { display: grid; gap: 6px; text-align: left; }
.allergy-line {
  margin: 0; padding: 6px 10px 6px 12px; border-left: 5px solid var(--line); border-radius: 0 10px 10px 0;
  color: var(--ink); font-size: clamp(0.98rem, 2vw, 1.15rem); line-height: 1.38;
}
.allergy-line strong { font-weight: 800; color: var(--cherry-ink); }
@media (min-width: 760px) {
  .allergy-modal__story { grid-template-columns: 1.1fr 1fr; }
  .allergy-modal__art { max-height: none; }
}

/* Rodape fixo: a frase forte e os botoes. */
.allergy-modal__foot {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 12px clamp(14px, 4vw, 48px) clamp(14px, 2.6vw, 26px);
  border-top: 3px solid var(--ink); background: var(--paper);
}
.allergy-modal__strong {
  display: flex; align-items: center; gap: 12px; max-width: 46rem; padding: 10px 16px;
  border: 3px solid var(--danger); border-radius: var(--radius-sm); background: var(--danger-soft); text-align: left;
}
.allergy-modal__strong p { margin: 0; }
.allergy-modal__strong strong { display: block; color: var(--danger); font-weight: 800; font-size: clamp(1.05rem, 2.6vw, 1.4rem); line-height: 1.2; }
.allergy-modal__strong span { display: block; margin-top: 3px; color: var(--ink); font-size: clamp(0.9rem, 2vw, 1.02rem); line-height: 1.3; }
.allergy-modal__heart { flex: none; width: clamp(34px, 6vw, 44px); height: auto; overflow: visible; }
.allergy-modal__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 14px; }

@media (max-width: 560px) {
  .allergy-modal { padding: 8px; }
  .allergy-modal__box { width: 100%; min-height: 0; max-height: 100%; border-radius: 22px; box-shadow: 6px 6px 0 var(--danger); }
  .allergy-modal__head { justify-content: flex-start; }
  .allergy-modal__actions { width: 100%; }
  .allergy-modal__actions .btn { flex: 1 1 100%; min-height: 46px; padding: 0.7em 1em; }
}

/* ---------- A animacao (so na primeira abertura, uma vez, sem repetir) ---------- */
@keyframes allergy-pop { from { transform: scale(0.92); opacity: 0; } to { transform: none; opacity: 1; } }
.allergy-modal__art .allergy-ing,
.allergy-modal__art .allergy-no,
.allergy-modal__art .allergy-flour,
.allergy-modal__art .allergy-drop,
.allergy-modal__heart { transform-box: fill-box; transform-origin: 50% 50%; }
.allergy-modal__art .allergy-kitchen { transform-box: fill-box; transform-origin: 50% 100%; }

/* As frases: comecam em tinta suave (legiveis) e cada uma acende na sua vez. */
.allergy-modal.is-story .allergy-line { animation: allergy-hl 2.4s ease both; }
.allergy-modal.is-story .allergy-line--1 { animation-delay: 0.3s; animation-duration: 2.5s; }
.allergy-modal.is-story .allergy-line--2 { animation-delay: 2.8s; animation-duration: 2.2s; }
.allergy-modal.is-story .allergy-line--3 { animation-delay: 5s; animation-duration: 2.4s; }
.allergy-modal.is-story .allergy-line--4 { animation-delay: 7.4s; animation-duration: 2.1s; }
/* 1. os ingredientes aparecem e cada um ganha um "nao" */
.allergy-modal.is-story .allergy-ing { animation: allergy-in 0.45s var(--ease-pop) 0.3s both; }
.allergy-modal.is-story .allergy-ing--2 { animation-delay: 0.48s; }
.allergy-modal.is-story .allergy-ing--3 { animation-delay: 0.66s; }
.allergy-modal.is-story .allergy-ing--4 { animation-delay: 0.84s; }
.allergy-modal.is-story .allergy-ing--5 { animation-delay: 1.02s; }
.allergy-modal.is-story .allergy-no { animation: allergy-stamp 0.35s var(--ease-pop) both; }
.allergy-modal.is-story .allergy-no--1 { animation-delay: 1.4s; }
.allergy-modal.is-story .allergy-no--2 { animation-delay: 1.6s; }
.allergy-modal.is-story .allergy-no--3 { animation-delay: 1.8s; }
.allergy-modal.is-story .allergy-no--4 { animation-delay: 2s; }
.allergy-modal.is-story .allergy-no--5 { animation-delay: 2.2s; }
/* 2. a mesma cozinha: o balcao com as panelas lado a lado */
.allergy-modal.is-story .allergy-kitchen { animation: allergy-rise 0.6s var(--ease-pop) 2.8s both; }
.allergy-modal.is-story .allergy-steam { animation: allergy-steam 1.4s ease-in-out 3.4s 3 both; }
/* 3. a farinha voa de uma panela para a outra, um respingo cai */
.allergy-modal.is-story .allergy-flour { animation: allergy-drift 2s ease-in-out 5.2s both; }
.allergy-modal.is-story .allergy-drop { animation: allergy-arc 1.1s ease-in 6s both; }
/* 4. a lupa acha os vestigios */
.allergy-modal.is-story .allergy-lens { animation: allergy-lens 0.8s var(--ease-pop) 7.5s both; }
/* 5. a frase forte ganha um coracao */
.allergy-modal.is-story .allergy-modal__strong { animation: allergy-callout 0.9s ease 9.5s both; }
.allergy-modal.is-story .allergy-modal__heart { animation: allergy-heart 1.3s ease 9.5s both; }

@keyframes allergy-hl {
  0% { color: var(--ink-soft); background-color: rgba(252, 227, 166, 0); border-left-color: var(--line); }
  12%, 86% { color: var(--ink); background-color: rgba(252, 227, 166, 0.95); border-left-color: var(--cherry); }
  100% { color: var(--ink); background-color: rgba(252, 227, 166, 0); border-left-color: var(--line); }
}
@keyframes allergy-in { from { opacity: 0; transform: translateY(14px) scale(0.4); } to { opacity: 1; transform: none; } }
@keyframes allergy-stamp { from { opacity: 0; transform: scale(1.8) rotate(-30deg); } to { opacity: 1; transform: none; } }
@keyframes allergy-rise { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes allergy-steam { 0% { opacity: 0; transform: translateY(6px); } 45% { opacity: 1; } 100% { opacity: 0.2; transform: translateY(-6px); } }
@keyframes allergy-drift {
  0% { opacity: 0; transform: translate(140px, 4px) scale(0.4); }
  20% { opacity: 1; }
  55% { transform: translate(70px, -14px) scale(0.9); }
  100% { opacity: 1; transform: translate(0, 0) scale(1); }
}
@keyframes allergy-arc {
  0% { opacity: 0; transform: translate(165px, 4px); }
  15% { opacity: 1; }
  50% { transform: translate(84px, -36px); }
  100% { opacity: 1; transform: translate(0, 0); }
}
@keyframes allergy-lens { from { opacity: 0; transform: translate(60px, -30px) rotate(25deg); } to { opacity: 1; transform: none; } }
@keyframes allergy-callout {
  0%, 100% { transform: none; box-shadow: none; }
  40% { transform: scale(1.03); box-shadow: 0 0 0 6px rgba(211, 49, 58, 0.18); }
}
@keyframes allergy-heart {
  0% { opacity: 0; transform: scale(0); }
  25% { opacity: 1; transform: scale(1.25); }
  40% { transform: scale(1); }
  58% { transform: scale(1.18); }
  75%, 100% { opacity: 1; transform: scale(1); }
}

/* Movimento reduzido: tudo parado, a ilustracao inteira de uma vez. */
@media (prefers-reduced-motion: reduce) {
  .allergy-modal__box,
  .allergy-modal * { animation: none !important; }
}
