/* Styles for assets/animations.js. Safe to delete along with that script. */

/* Zoom-in sequence */
.anim-zoom-play > * {
  animation: anim-pop 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}

/* Slow looping version: gentler pop, then everything fades before the next round */
.anim-zoom-slow.anim-zoom-play > * {
  animation-duration: 1s;
}

.anim-fade-out,
.anim-fade-out path {
  transition: opacity 0.5s;
}

.anim-zoom-play.anim-fade-out > * {
  animation: anim-fade 0.5s both;
  animation-delay: 0s !important;
}

svg.anim-fade-out path[fill="none"] {
  opacity: 0;
}

@keyframes anim-fade {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes anim-pop {
  from { opacity: 0; transform: scale(0.4); }
  to { opacity: 1; transform: scale(1); }
}

/* Typing code */
.anim-typing {
  cursor: pointer;
}

.anim-typing::after {
  content: "\258D";
  color: var(--accent);
  animation: anim-blink 0.9s steps(1) infinite;
}

@keyframes anim-blink {
  50% { opacity: 0; }
}

/* Salt dissolving */
.anim-replaced {
  display: none !important;
}

.anim-dissolve {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

.anim-dissolve svg {
  display: block;
  width: 100%;
  height: auto;
}

.anim-water-bg {
  fill: #eef6fc;
  stroke: #b9d6ee;
  stroke-width: 2;
}

.anim-o { fill: #4d7fb8; stroke: #2c5580; stroke-width: 0.8; }
.anim-h { fill: #eaf2fb; stroke: #2c5580; stroke-width: 0.8; }
.anim-na { fill: var(--gold); stroke: var(--gold-dark); stroke-width: 1.6; }
.anim-cl { fill: var(--primary); stroke: var(--primary-dark); stroke-width: 1.6; }

.anim-ion-label {
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: 9px;
  fill: #ffffff;
}

.anim-dissolve-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}

.anim-replay {
  visibility: hidden;
  border: 1.5px solid var(--border);
  background: var(--panel);
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 5px 14px;
  font: inherit;
  cursor: pointer;
}

.anim-replay.is-visible {
  visibility: visible;
}

.anim-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted, var(--text));
}

.anim-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.anim-legend .dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.anim-legend .dot.na { background: var(--gold); }
.anim-legend .dot.cl { background: var(--primary); }
.anim-legend .dot.h2o { background: #4d7fb8; }

/* Rotating 3D salt crystal */
.anim-crystal {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.anim-crystal svg {
  display: block;
  width: 100%;
  max-width: 340px;
  height: auto;
  cursor: grab;
  touch-action: none;
}

.anim-crystal svg:active {
  cursor: grabbing;
}

.anim-bond {
  stroke: #bfb8ac;
  stroke-width: 2;
}

.anim-crystal-hint {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted, var(--text));
  transition: opacity 0.6s;
}

.anim-crystal-hint.is-faded {
  opacity: 0;
}

/* Apple cell being cut (Mission 2) */
.anim-air-bg { fill: #f7f3ea; stroke: var(--border); stroke-width: 2; }
.anim-small-label { font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 13px; fill: var(--muted, var(--text)); }
.anim-cell-fill { fill: var(--primary-soft); transition: fill 0.8s; }
.anim-membrane { fill: none; stroke: var(--primary); stroke-width: 4; stroke-linecap: round; }
.anim-vacuole { fill: none; stroke: var(--primary-dark); stroke-width: 2.5; stroke-dasharray: 2 0; transition: opacity 0.8s; }
.anim-knife { stroke: #6b6b6b; stroke-width: 4; stroke-linecap: round; transition: opacity 0.4s; }
.anim-ppo { fill: var(--primary-dark); }
.anim-sub { fill: var(--gold); stroke: var(--gold-dark); stroke-width: 1; }
.anim-o2 { fill: var(--accent); stroke: var(--accent-dark); stroke-width: 0.8; }
.anim-pigment { fill: #7a4a24; stroke: #4e2e15; stroke-width: 1; }

/* One enzyme, many reactions (Mission 2) */
.anim-enzyme { fill: var(--primary-soft); stroke: var(--primary); stroke-width: 2; }
.anim-sub-hex { fill: var(--gold); stroke: var(--gold-dark); stroke-width: 1.5; }
.anim-pigment-hex { fill: #7a4a24; stroke: #4e2e15; stroke-width: 1.5; }
.anim-label { font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 12px; }
.anim-label-enzyme { fill: var(--primary-dark); }
.anim-label-sub { fill: var(--gold-dark); }
.anim-label-pig { fill: #7a4a24; }

.anim-legend .dot.ppo { background: var(--primary-dark); border-radius: 3px; }
.anim-legend .dot.sub { background: var(--gold); }
.anim-legend .dot.o2 { background: var(--accent); }
.anim-legend .dot.pig { background: #7a4a24; }

/* Oxidation: electron transfer (Mission 2) */
.anim-shell { fill: none; stroke: var(--text); stroke-width: 2; }
.anim-nucleus { fill: var(--gold); stroke: var(--gold-dark); stroke-width: 1.5; }
.anim-nucleus-label { font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 13px; fill: #ffffff; }
.anim-electron { fill: var(--text); }
.anim-electron-moving { fill: var(--accent); stroke: var(--accent-dark); stroke-width: 1.5; }
.anim-trail { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 5; transition: opacity 0.3s; }
.anim-atom-name { font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 14px; fill: var(--text); }
.anim-charge { font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 12.5px; fill: var(--muted, var(--text)); }
.anim-charge.is-plus { fill: var(--accent-dark); }
.anim-charge.is-minus { fill: var(--primary-dark); }

/* Step-by-step chain (Mission 2 oxidation story) */
.anim-step-part {
  transition: opacity 0.6s, transform 0.6s;
}

.anim-step-hidden {
  opacity: 0;
  transform: translateY(-8px);
}

.anim-step-item {
  padding: 4px 12px;
  border-radius: 10px;
  transition: opacity 0.6s, transform 0.6s, background 0.4s, box-shadow 0.4s;
}

.anim-step-current {
  background: var(--gold-soft);
  box-shadow: 0 0 0 2px var(--gold);
}

/* Oxidation told in three stacked panels (Mission 2) */
.anim-ox-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

.anim-ox-panel {
  background: var(--panel);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px 10px;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s, transform 0.7s;
}

.anim-ox-panel.is-visible {
  opacity: 1;
  transform: none;
}

.anim-ox-panel svg {
  display: block;
  width: 100%;
  height: auto;
}

.anim-ox-title {
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: 16px;
  color: var(--primary-dark);
}

.anim-ox-note {
  margin: 4px 0 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

/* pH scale + cup of H+ (Mission 2) */
.anim-ph-tick { font-family: "Baloo 2", sans-serif; font-weight: 700; font-size: 11px; fill: var(--muted, var(--text)); }
.anim-ph-end { font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 11.5px; fill: var(--text); }
.anim-ph-marker { fill: var(--text); }
.anim-ph-marker-label { font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 13px; fill: var(--text); }
.anim-ph-liquid { transition: fill 1s; }
.anim-ph-cup { fill: none; stroke: var(--muted, var(--text)); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.anim-ph-emoji { font-size: 36px; }
.anim-ph-info { font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 13px; fill: var(--primary-dark); }
.anim-ph-amount { font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 13px; fill: #c0392b; }
.anim-hplus { fill: #e0533d; stroke: #a4321f; stroke-width: 1; }
.anim-hplus-label { font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 8px; fill: #ffffff; }

/* Mission 3: light and plants */
.anim-photon { stroke: #ffffff; stroke-width: 2; }
.anim-ray { stroke: var(--gold); stroke-width: 2; stroke-dasharray: 4 5; opacity: 0.8; }
.anim-day-label { font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 12px; fill: var(--muted, var(--text)); }
.anim-cell { stroke-width: 1.5; }
.anim-cell-shade { fill: var(--primary-soft); stroke: var(--primary); }
.anim-cell-light { fill: #f4f7ef; stroke: var(--primary); }
.anim-auxin { fill: #8e44ad; stroke: #5e2a75; stroke-width: 1; }
.anim-legend .dot.aux { background: #8e44ad; }
.anim-legend .dot.shade { background: var(--primary-soft); border: 1.5px solid var(--primary); border-radius: 3px; }
.anim-legend .dot.light { background: #f4f7ef; border: 1.5px solid var(--primary); border-radius: 3px; }

.anim-steps-bar {
  margin-top: 8px;
}

.anim-replay.is-ready {
  border-color: var(--accent);
  color: var(--accent-dark);
  animation: anim-nudge 1.4s ease-in-out infinite;
}

@keyframes anim-nudge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(226, 112, 58, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(226, 112, 58, 0); }
}

/* One wave sweeping blue -> red (Mission 3) */
.anim-spectrum { display: block; width: 100%; height: auto; margin-bottom: 6px; }
.anim-spectrum-label { font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 17px; }
.anim-spectrum-bar { fill: none; stroke: var(--muted, var(--text)); stroke-width: 1.6; }
.anim-spectrum-bar-label { font-family: "Baloo 2", sans-serif; font-weight: 700; font-size: 11px; fill: var(--muted, var(--text)); }
.spectrum-chip { transition: transform 0.4s, box-shadow 0.4s, opacity 0.4s; }
[data-anim="spectrum"] .spectrum-chip:not(.anim-chip-active) { opacity: 0.55; }
.spectrum-chip.anim-chip-active { transform: translateY(-4px) scale(1.04); box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18); }
