/* Shared styles for every game on the site. Game-specific styles live next to each game. */
:root {
  --bg-1: #1a0f3a;
  --bg-2: #2d1b69;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-border: rgba(255, 255, 255, 0.16);
  --text: #f7f4ff;
  --muted: #c9c0ea;
  --accent: #ffcf3f;
  --accent-2: #ff7a59;
  --accent-text: #2a1600;
  --danger: #ff6b8a;
  --focus: #7ee8ff;
  --radius: 18px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--bg-2); }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 122, 89, 0.25), transparent 40%),
    radial-gradient(circle at 85% 20%, rgba(126, 232, 255, 0.18), transparent 45%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2));
  background-repeat: no-repeat;
  line-height: 1.5;
}

a { color: var(--focus); }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
}
.site-header .brand {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
}
.site-header .brand span { color: var(--accent); }
.back-link { color: var(--muted); text-decoration: none; font-weight: 600; }
.back-link:hover { color: var(--text); }

main { padding: 0 clamp(1rem, 4vw, 2.5rem) 3rem; max-width: 1200px; margin: 0 auto; }

h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); line-height: 1.1; margin: 0.25rem 0 0.5rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }
.lede { color: var(--muted); margin: 0 0 1.5rem; max-width: 60ch; }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

/* Buttons */
.btn {
  --btn-bg: rgba(255, 255, 255, 0.12);
  --btn-fg: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.55rem 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, opacity 0.12s ease;
  text-decoration: none;
}
.btn:hover:not(:disabled) { filter: brightness(1.12); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  --btn-bg: linear-gradient(135deg, var(--accent), var(--accent-2));
  --btn-fg: var(--accent-text);
  background: var(--btn-bg);
  border: none;
  box-shadow: 0 6px 20px rgba(255, 140, 60, 0.35);
}
.btn-small { min-height: 36px; padding: 0.3rem 0.8rem; font-size: 0.9rem; }
.btn-icon {
  width: 36px; min-height: 36px; padding: 0; border-radius: 50%;
  font-size: 1.1rem; line-height: 1;
}

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

input[type="text"], input[type="number"] {
  font: inherit;
  color: var(--text);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  min-height: 40px;
}
input::placeholder { color: rgba(255, 255, 255, 0.5); }
input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); cursor: pointer; }

/* Toggle switch built on a real checkbox so it stays accessible */
.switch { display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
  position: relative; width: 48px; height: 28px; flex: none;
  border-radius: 999px; background: rgba(255, 255, 255, 0.2);
  transition: background 0.2s ease;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  transition: transform 0.2s ease;
}
.switch input:checked + .track { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Inline SVG icon that sits in a line of text like an emoji (e.g. next to a heading) */
.inline-icon {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.17em;
}
/* Icons drawn wider than tall (e.g. the racehorse) keep their shape */
.inline-icon.icon-wide, .game-card .emoji .icon-img.icon-wide { width: auto; aspect-ratio: 61 / 50; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.site-footer { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 2rem 1rem; }

/* Hub page */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}
.game-card {
  display: flex; flex-direction: column; gap: 0.5rem;
  padding: 1.25rem; min-height: 200px;
  border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--panel-border);
  color: var(--text); text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
a.game-card:hover { transform: translateY(-4px) rotate(-0.5deg); border-color: var(--accent); }
.game-card .emoji { font-size: 2.6rem; line-height: 1; }
.game-card .emoji .icon-img { display: block; width: 1.12em; height: 1.12em; margin: -0.06em 0 -0.06em -0.04em; }
.game-card h2 { margin: 0.25rem 0 0; font-size: 1.3rem; }
.game-card p { margin: 0; color: var(--muted); }
.game-card .play { margin-top: auto; font-weight: 800; color: var(--accent); }
.game-card.coming-soon { opacity: 0.6; border-style: dashed; box-shadow: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* Hub layout: games on the left, Gary meme polaroid off to the side */
@font-face {
  font-family: "Permanent Marker";
  src: url("fonts/permanent-marker-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
.hub {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
}
.hub-meme { display: flex; justify-content: center; }
.polaroid {
  margin: 0;
  width: min(100%, 260px);
  padding: 0.7rem 0.7rem 0.9rem;
  background: #fbf8f1;
  color: #2b2433;
  border-radius: 4px;
  box-shadow: var(--shadow), 0 2px 6px rgba(0, 0, 0, 0.25);
  transform: rotate(2.5deg);
  transition: transform 0.2s ease;
}
.polaroid:hover { transform: rotate(0deg) scale(1.02); }
.polaroid img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
  background: #222;
}
.polaroid figcaption {
  margin: 0.7rem 0.4rem 0.1rem;
  text-align: center;
  font-family: "Permanent Marker", "Marker Felt", "Comic Sans MS", cursive;
  font-size: 1.2rem;
  line-height: 1.25;
  color: #241c2e;
  text-wrap: balance;
}
.polaroid figcaption .nowrap { white-space: nowrap; }

@media (min-width: 900px) {
  .hub { grid-template-columns: minmax(0, 1fr) 260px; align-items: start; }
  .hub-meme { padding-top: 1.25rem; }
  .polaroid { width: 100%; }
}
