/*
  The building. A grid of cells; the ones inside the silhouette are lights.
  Tone classes f1..f7 walk the candle ramp from guttering ember to hot core.
  Cells are rendered by app/javascript/controllers/grid_controller.js.
*/

.grid {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 1px;
  width: 100%;
}

.cell {
  background: transparent;
  border-radius: 0;
  aspect-ratio: 1 / 1;
}

/* part of the building, still dark */
.cell.b { background: var(--ash); }

.cell.on { background: var(--f4); }
.cell.on.f1 { background: var(--f1); }
.cell.on.f2 { background: var(--f2); }
.cell.on.f3 { background: var(--f3); }
.cell.on.f4 { background: var(--f4); }
.cell.on.f5 { background: var(--f5); }
.cell.on.f6 { background: var(--f6); }
.cell.on.f7 { background: var(--f7); }

/* the wall doesn't twinkle at random — one slow breath sweeps diagonally through it,
   each cell's delay set from its position (see grid_controller.js) */
.cell.wave { animation: waveBreathe 6s ease-in-out infinite; }

@keyframes waveBreathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.cell.hit { cursor: crosshair; }

/* the one light that's yours, singled out from the wall — scaled up rather than
   just rung, since a ring the width of a single ~3px cell disappears against
   neighbouring cells of a similar warm tone */
.cell.mine {
  position: relative;
  z-index: 4;
  transform: scale(2.2);
  box-shadow: 0 0 0 2px var(--filament), 0 0 14px 4px rgba(var(--warm), 0.85);
  animation: minePulse 2.2s ease-in-out infinite;
}

@keyframes minePulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--filament), 0 0 14px 4px rgba(var(--warm), 0.85); }
  50% { box-shadow: 0 0 0 2px var(--filament), 0 0 20px 7px rgba(var(--warm), 1); }
}

/* a light coming on, in front of whoever just lit it */
.cell.new {
  animation: ignite 1500ms ease-out;
  z-index: 3;
  position: relative;
}

@keyframes ignite {
  0% {
    box-shadow: 0 0 0 0 rgba(var(--warm), 0.95);
    filter: brightness(2.6) saturate(0.7);
  }
  20% {
    box-shadow: 0 0 16px 6px rgba(var(--warm), 0.62);
    filter: brightness(1.9) saturate(0.85);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(var(--warm), 0);
    filter: brightness(1) saturate(1);
  }
}

/* the glow the building throws as it fills */
.halo {
  position: absolute;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  width: 96%;
  height: 150%;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse at center,
    rgba(var(--warm), 0.10) 0%,
    rgba(var(--warm), 0.045) 32%,
    rgba(var(--warm), 0) 68%);
  transition: opacity 1.4s ease;
}

.minigridwrap { position: relative; margin-bottom: 16px; }
.minihalo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 120%;
  height: 170%;
  pointer-events: none;
  background: radial-gradient(ellipse at center,
    rgba(var(--warm), 0.11) 0%, rgba(var(--warm), 0) 65%);
}

/* running counts above the building */
.counter {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 34px;
}
.counter b {
  color: var(--filament);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.1em;
}
.counter .sep { color: #3D444C; }

/* the line that says someone, somewhere, just lit one */
.ticker {
  min-height: 20px;
  text-align: center;
  margin-top: 22px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #5C636C;
}
.ticker span { opacity: 0; transition: opacity 0.5s; }
.ticker span.show { opacity: 1; }

/* dedication tooltip on hover */
.tip {
  position: fixed;
  z-index: 80;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.16s, transform 0.16s;
  background: var(--panel);
  border: 1px solid var(--edge);
  padding: 9px 12px;
  max-width: 230px;
}
.tip.show { opacity: 1; transform: translateY(0); }
.tip .n {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: #5C636C;
  display: block;
}
.tip .d {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--filament);
  font-style: italic;
  line-height: 1.35;
}

@media (min-width: 901px) {
  .counter { margin-bottom: 18px; }
  .ticker { margin-top: 12px; }
}
