/* =============================================================================
   ILS Comic CSS — Comic-panel storytelling system for ILS activities
   Extracted from 1a3.astro | v1.0
   ============================================================================= */

/* --- Comic Strip Container --- */
.comic-strip {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 16px;
  border: 3px solid #1e293b;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
  animation: comicStripIn 0.45s cubic-bezier(0.21, 1.02, 0.73, 1);
}
.dark .comic-strip {
  border-color: #475569;
  background: #0f172a;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}
@keyframes comicStripIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* --- Individual Panel --- */
.comic-panel {
  position: relative;
  padding: 18px 20px;
  border-bottom: 3px solid #1e293b;
  overflow: hidden;
}
.comic-panel:last-child {
  border-bottom: none;
}
.dark .comic-panel {
  border-bottom-color: #475569;
}

/* Panel entrance animations */
.comic-panel.cp-anim-1 {
  animation: cpSlideIn 0.4s 0.05s both cubic-bezier(0.21, 1.02, 0.73, 1);
}
.comic-panel.cp-anim-2 {
  animation: cpSlideIn 0.4s 0.2s both cubic-bezier(0.21, 1.02, 0.73, 1);
}
.comic-panel.cp-anim-3 {
  animation: cpSlideIn 0.4s 0.35s both cubic-bezier(0.21, 1.02, 0.73, 1);
}
@keyframes cpSlideIn {
  from {
    opacity: 0;
    transform: translateX(-14px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* --- Panel Themes (colored top accent per phase) --- */
.comic-panel.cp-census {
  background: linear-gradient(180deg, #eef2ff 0%, #fff 40%);
}
.comic-panel.cp-market {
  background: linear-gradient(180deg, #fffbeb 0%, #fff 40%);
}
.comic-panel.cp-distance {
  background: linear-gradient(180deg, #ecfdf5 0%, #fff 40%);
}
.comic-panel.cp-budget {
  background: linear-gradient(180deg, #fdf2f8 0%, #fff 40%);
}
.dark .comic-panel.cp-census {
  background: linear-gradient(180deg, #1e1b4b 0%, #0f172a 40%);
}
.dark .comic-panel.cp-market {
  background: linear-gradient(180deg, #451a03 0%, #0f172a 40%);
}
.dark .comic-panel.cp-distance {
  background: linear-gradient(180deg, #052e16 0%, #0f172a 40%);
}
.dark .comic-panel.cp-budget {
  background: linear-gradient(180deg, #4a044e 0%, #0f172a 40%);
}

/* --- Scene Row: Character + Dialogue side by side --- */
.comic-scene {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

/* --- Character Container --- */
.comic-char {
  flex-shrink: 0;
  width: 72px;
  height: 90px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: charBounceIn 0.5s 0.15s both cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes charBounceIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
  }
  60% {
    transform: translateY(-4px) scale(1.04);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.comic-char svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.12));
}

/* --- Speech Bubble --- */
.comic-bubble {
  position: relative;
  flex: 1;
  background: #fff;
  border: 2.5px solid #1e293b;
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.7;
  color: #1e293b;
  animation: bubblePop 0.35s 0.25s both cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 0;
}
.dark .comic-bubble {
  background: #1e293b;
  border-color: #475569;
  color: #e2e8f0;
}
@keyframes bubblePop {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
/* Speech bubble tail (points left toward character) */
.comic-bubble::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 18px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 12px solid #1e293b;
}
.comic-bubble::after {
  content: "";
  position: absolute;
  left: -8px;
  top: 20px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 10px solid #fff;
}
.dark .comic-bubble::before {
  border-right-color: #475569;
}
.dark .comic-bubble::after {
  border-right-color: #1e293b;
}
.comic-bubble em {
  color: #6366f1;
  font-style: normal;
  font-weight: 800;
  background: #eef2ff;
  padding: 1px 6px;
  border-radius: 4px;
}
.dark .comic-bubble em {
  background: #312e81;
  color: #a5b4fc;
}

/* --- Context Badge inside panel --- */
.comic-context-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}
.comic-context-badge.ccb-census {
  background: #eef2ff;
  color: #4338ca;
}
.comic-context-badge.ccb-market {
  background: #fef3c7;
  color: #92400e;
}
.comic-context-badge.ccb-distance {
  background: #dcfce7;
  color: #166534;
}
.comic-context-badge.ccb-budget {
  background: #fce7f3;
  color: #9d174d;
}
.dark .comic-context-badge.ccb-census {
  background: #312e81;
  color: #a5b4fc;
}
.dark .comic-context-badge.ccb-market {
  background: #451a03;
  color: #fcd34d;
}
.dark .comic-context-badge.ccb-distance {
  background: #052e16;
  color: #6ee7b7;
}
.dark .comic-context-badge.ccb-budget {
  background: #4a044e;
  color: #f0abfc;
}

/* --- Data Panel (table / compare bars inside comic) --- */
.comic-data-panel {
  padding: 14px 20px;
  border-bottom: 3px solid #1e293b;
  background: #f8fafc;
}
.dark .comic-data-panel {
  background: #1e293b;
  border-bottom-color: #475569;
}

/* --- Question Panel --- */
.comic-question-panel {
  padding: 18px 20px;
}
.comic-question-text {
  font-size: 16px;
  font-weight: 800;
  color: #4338ca;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: #f5f3ff;
  border-radius: 10px;
  border-left: 4px solid #6366f1;
  animation: questionGlow 2s ease-in-out infinite alternate;
}
.dark .comic-question-text {
  background: #312e81;
  color: #c7d2fe;
  border-left-color: #6366f1;
}
@keyframes questionGlow {
  from {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
  }
  to {
    box-shadow: 0 0 12px 2px rgba(99, 102, 241, 0.12);
  }
}

/* --- Number Counter Animation (for answer reveal) --- */
.comic-num-reveal {
  display: inline-block;
  font-weight: 900;
  font-size: 22px;
  color: #6366f1;
  animation: numRevealPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes numRevealPop {
  from {
    opacity: 0;
    transform: scale(0.5) rotate(-5deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* =============================================================================
   RESPONSIVE — 420px breakpoint (comic-specific stacking)
   ============================================================================= */
@media (max-width: 420px) {
  .comic-scene {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .comic-char {
    width: 56px;
    height: 70px;
  }
  .comic-bubble::before,
  .comic-bubble::after {
    display: none;
  }
  .comic-bubble {
    border-radius: 14px;
  }
  .comic-panel {
    padding: 14px 12px;
  }
}

/* =============================================================================
   RESPONSIVE — 480px breakpoint (comic elements that share with core)
   ============================================================================= */
@media (max-width: 480px) {
  .comic-bubble {
    font-size: 14px;
  }
  .comic-question-text {
    font-size: 14px;
    padding: 8px 10px;
  }
}
