/* =============================================================================
   candles.css — 33 Candles module for the Prayer Wall
   Uses existing theme tokens only (--jp-*, --s-*, --r-*, --ff-*).
   No new colours. Soft parchment-and-gold. Matthew 6 tone: quiet, non-showy.
   ============================================================================= */

.candles-section {
  padding: var(--s-7) 0 var(--s-5);
}
.candles-section__inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 var(--s-4);
  text-align: center;
}
.candles-section__kicker {
  display: block;
  font-family: var(--ff-sans);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--jp-ink-muted);
  margin-bottom: var(--s-3);
}
.candles-section__title {
  font-family: var(--ff-serif);
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  font-weight: 500;
  color: var(--jp-ink);
  margin: 0 0 var(--s-3);
  line-height: 1.15;
}
.candles-section__lede {
  font-family: var(--ff-serif);
  font-style: italic;
  color: var(--jp-ink-soft);
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 0 0 var(--s-5);
}

/* ─── the 33-slot grid ──────────────────────────────────────────────────── */
.candles-grid {
  display: grid;
  grid-template-columns: repeat(11, minmax(28px, 1fr));
  gap: var(--s-3);
  padding: var(--s-4);
  max-width: 640px;
  margin: 0 auto var(--s-4);
  background: transparent;
}
@media (max-width: 640px) {
  .candles-grid { grid-template-columns: repeat(6, 1fr); gap: var(--s-2); }
}
@media (max-width: 380px) {
  .candles-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ─── candle button ─────────────────────────────────────────────────────── */
.candle {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 2;
  min-height: 54px;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}
.candle:focus-visible {
  outline: 2px solid var(--jp-gold-400);
  outline-offset: 4px;
  border-radius: var(--r-sm);
}
.candle__wax {
  width: 40%;
  height: 68%;
  background: var(--jp-cream-400);
  border-radius: 2px 2px 4px 4px;
  box-shadow: inset -2px 0 3px rgba(31, 27, 22, 0.06),
              inset 2px 0 2px rgba(255, 255, 255, 0.35);
  transition: background 260ms ease;
}
.candle__wick {
  width: 2px;
  height: 6%;
  background: var(--jp-ink-soft);
  margin-bottom: 1px;
  border-radius: 1px;
  opacity: 0.55;
  transition: opacity 260ms ease;
}
.candle__flame {
  position: absolute;
  bottom: 68%;
  width: 12px;
  height: 20px;
  border-radius: 50% 50% 40% 40%;
  background: radial-gradient(ellipse at center, var(--jp-gold-100) 0%, var(--jp-gold-300) 60%, transparent 100%);
  opacity: 0;
  pointer-events: none;
  transform-origin: bottom center;
  filter: blur(0.4px);
}
.candle__halo {
  position: absolute;
  bottom: 55%;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 168, 67, 0.22) 0%, rgba(212, 168, 67, 0.05) 55%, transparent 80%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms ease;
}

/* ─── lit state — soft glow, no neon ────────────────────────────────────── */
.candle.is-lit .candle__wax {
  background: var(--jp-cream-300);
}
.candle.is-lit .candle__wick {
  opacity: 0.9;
}
.candle.is-lit .candle__flame {
  opacity: 1;
  animation: candle-flicker 3.6s ease-in-out infinite;
}
.candle.is-lit .candle__halo {
  opacity: 1;
}

/* Very gentle flicker — small vertical scale + hue drift. No sudden movement. */
@keyframes candle-flicker {
  0%, 100% { transform: scaleY(1)     scaleX(1)     translateY(0); filter: blur(0.4px); }
  25%      { transform: scaleY(1.06)  scaleX(0.96)  translateY(-1px); filter: blur(0.5px); }
  50%      { transform: scaleY(0.96)  scaleX(1.02)  translateY(0.5px); filter: blur(0.35px); }
  75%      { transform: scaleY(1.03)  scaleX(0.98)  translateY(-0.5px); filter: blur(0.45px); }
}
@media (prefers-reduced-motion: reduce) {
  .candle.is-lit .candle__flame { animation: none; }
}

/* ─── caption + note strip ──────────────────────────────────────────────── */
.candles-note {
  font-family: var(--ff-sans);
  color: var(--jp-ink-muted);
  font-size: 0.85rem;
  line-height: 1.5;
  max-width: 44ch;
  margin: 0 auto;
}
.candles-note em {
  font-style: italic;
  color: var(--jp-ink-soft);
}
