/* games.joemorrow.com -- the pill gate. Dark and moody on purpose: a cold, quiet room before
   either warm basement. CSS + canvas only (gate.js draws the rain), no external requests. */

.gate {
  position: fixed; inset: 0; z-index: 50; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% -10%, #132018 0%, #05080a 60%, #020303 100%);
  color: #cfe8d8; padding: 24px;
}
/* The [hidden] attribute selector must outrank the class rule above (same specificity would
   otherwise let the author's `display: flex` win over the UA's `display: none`, leaving the
   gate visible -- and its canvas eating clicks -- even while JS has set .hidden = true). */
#gate[hidden] { display: none; }
.gate-rain { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: .55; }
.gate::before { /* scanline texture -- static, costs nothing, stays on even under reduced motion */
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .35) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
.gate-inner { position: relative; z-index: 1; max-width: 640px; text-align: center; }
.gate-kicker { font: 700 12px/1 var(--body); letter-spacing: .22em; text-transform: uppercase; color: #5fae7c; }
.gate-head { margin-top: 12px; font: 400 clamp(32px, 7vw, 56px)/1.05 var(--display); color: #eafff0; text-shadow: 0 0 18px rgba(95, 174, 124, .45); }
.gate-sub { margin-top: 12px; font: 15px/1.5 var(--body); color: #9db8ab; }

.gate-pills { margin-top: 36px; display: flex; flex-direction: column; gap: 18px; }
@media (min-width: 640px) { .gate-pills { flex-direction: row; justify-content: center; } }

.pill {
  flex: 1; max-width: 260px; margin: 0 auto; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 24px 20px; border-radius: 18px; cursor: pointer; font: inherit; color: inherit;
  background: rgba(10, 14, 12, .55); border: 2px solid var(--pill-color, #888);
  box-shadow: 0 0 0 0 transparent;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
  -webkit-tap-highlight-color: transparent;
}
@media (min-width: 640px) { .pill { margin: 0; } }
.pill-red { --pill-color: #c4432c; }
.pill-blue { --pill-color: #2f7fd6; }
.pill:hover, .pill:focus-visible {
  transform: translateY(-4px); background: rgba(10, 14, 12, .8);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--pill-color) 35%, transparent), 0 0 32px color-mix(in srgb, var(--pill-color) 70%, transparent);
}
.pill:active { transform: translateY(-1px); }
.pill:focus-visible { outline: 3px solid #eafff0; outline-offset: 3px; }

.pill-photo { width: 92px; height: 92px; border-radius: 50%; overflow: hidden; border: 2px solid var(--pill-color); background: #111; flex: none; }
.pill-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.pill-photo[data-lowres="true"] img { image-rendering: pixelated; filter: contrast(1.08) saturate(1.15) sepia(.08); }
.pill-label { font: 400 23px/1 var(--display); letter-spacing: .02em; }

/* ---------- swallow transition: a black iris that grows from the tapped pill to cover the
   screen, then shrinks back from the same point once the new arcade is underneath ---------- */
.swallow {
  position: fixed; inset: 0; z-index: 60; background: #000; pointer-events: none;
  --r: 0%; --ox: 50%; --oy: 50%;
  clip-path: circle(var(--r) at var(--ox) var(--oy));
  transition: clip-path .5s cubic-bezier(.65, 0, .35, 1);
}

#arcade.arcade-in { animation: arcade-reveal .4s ease both; }
@keyframes arcade-reveal { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 420px) {
  .gate-head { font-size: 30px; }
  .pill-photo { width: 76px; height: 76px; }
}

@media (prefers-reduced-motion: reduce) {
  .gate-rain { display: none; }
  .swallow { transition: none; }
  #arcade.arcade-in { animation: none; }
  .pill, .pill:hover, .pill:focus-visible { transition: none; transform: none; }
}
