/* ============================================================================
   game-of-life/app.css — styles for the Conway's Game of Life playground only.
   Scoped under .gol; inherits BPSO Lab 2026 tokens from blog.css. Loaded by the
   post page. Works in both dark (default) and [data-theme="light"].
   ========================================================================== */

.gol {
  /* Local render tokens read by app.js via getComputedStyle. */
  --gol-bg: #0b1220;
  --gol-cell: var(--cat-dev, #2563eb);
  --gol-cell-edge: var(--brand-light, #60a5fa);
  --gol-grid: rgba(255, 255, 255, .045);

  display: grid;
  gap: 1rem;
}
[data-theme="light"] .gol {
  --gol-bg: #0f172a;          /* keep the board dark for contrast even in light theme */
  --gol-grid: rgba(255, 255, 255, .05);
}

/* ----------------------------------------------------------------- Stage */
.gol__stage {
  position: relative;
  width: 100%;
  border-radius: var(--radius-sm, 10px);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--gol-bg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .02);
}

.gol__canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;        /* let pointer-draw own the gesture */
  cursor: crosshair;
}
.gol__canvas:focus-visible {
  outline: 3px solid var(--brand-light);
  outline-offset: -3px;
}

/* Live stats badge over the board. */
.gol__stats {
  position: absolute;
  top: .55rem;
  left: .55rem;
  display: flex;
  gap: .55rem;
  font-family: var(--font-head, system-ui);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .01em;
  pointer-events: none;
}
.gol__stats span {
  background: rgba(11, 18, 32, .72);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, .12);
  padding: .22rem .55rem;
  border-radius: 999px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* --------------------------------------------------------------- Controls */
.gol__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
}

.gol__btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 42px;
  padding: 0 .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 10px);
  background: var(--surface-2);
  color: var(--text-main);
  font-family: var(--font-head, system-ui);
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: transform .15s, border-color .15s, background .15s, color .15s;
}
.gol__btn i { font-size: 1.15rem; line-height: 1; }
.gol__btn:hover {
  border-color: color-mix(in srgb, var(--brand-blue) 60%, var(--border));
  transform: translateY(-1px);
}
.gol__btn:active { transform: translateY(0); }

.gol__btn--primary {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  color: #fff;
  min-width: 116px;
  box-shadow: 0 8px 22px -10px var(--brand-glow);
}
.gol__btn--primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}

/* Icon-only buttons stay square. */
.gol__btn:not(.gol__btn--primary) {
  width: 42px;
  padding: 0;
}

/* Speed slider. */
.gol__speed {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin-left: auto;
  font-size: .82rem;
  color: var(--text-muted);
}
.gol__speed-label { font-weight: 600; white-space: nowrap; }

.gol__range {
  appearance: none;
  -webkit-appearance: none;
  width: clamp(90px, 22vw, 150px);
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-light));
  cursor: pointer;
  outline-offset: 4px;
}
.gol__range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--brand-blue);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
  cursor: pointer;
}
.gol__range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--brand-blue);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
  cursor: pointer;
}
.gol__range::-moz-range-track { background: transparent; }

/* ---------------------------------------------------------------- Presets */
.gol__presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}
.gol__presets-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: .15rem;
}
.gol__chip {
  appearance: none;
  border: 1px dashed color-mix(in srgb, var(--brand-blue) 45%, var(--border));
  background: color-mix(in srgb, var(--brand-blue) 8%, transparent);
  color: var(--text-main);
  font-family: var(--font-body, system-ui);
  font-weight: 500;
  font-size: .82rem;
  padding: .42rem .8rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
}
.gol__chip:hover {
  background: color-mix(in srgb, var(--brand-blue) 18%, transparent);
  border-style: solid;
  transform: translateY(-1px);
}

/* --------------------------------------------------------------- Responsive */
@media (max-width: 480px) {
  .gol__speed { margin-left: 0; width: 100%; justify-content: space-between; }
  .gol__btn--primary { min-width: 96px; }
  .gol__stats { font-size: .66rem; }
}

@media (prefers-reduced-motion: reduce) {
  .gol__btn, .gol__chip { transition: none; }
}
