/*
 * Porksicle -- "Cold Open" art direction (v4, modern).
 *
 * A premium, spacious indie-arcade storefront on a deep near-black ground.
 * The retro wink lives in exactly two places -- the pixel "Porksicle" wordmark
 * and the pixel frozen-pig mascot. Everything else is crisp and modern:
 *   - Type: Space Grotesk (display) + Inter (body). Press Start 2P is the
 *     WORDMARK ONLY, never body/headings.
 *   - No scanline veil, no blanket CRT. Neon pink + cyan are ACCENTS, not the
 *     whole surface. Generous whitespace, one confident hero, a clean card grid.
 *   (The CRT treatment still lives on the game pages, not here.)
 */

/* Wordmark only -- the one place Press Start 2P is allowed. */
@font-face {
  font-family: "Press Start 2P";
  src: url("/fonts/press-start-2p.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
/* Display: a confident modern grotesque (variable, latin subset). */
@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/space-grotesk-latin.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
}
/* Body: a clean modern sans (variable, latin subset). */
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
}

:root {
  --void:    #0a0a12;
  --raise:   #14141f;
  --raise-2: #1c1c2b;
  --line:    rgba(255, 255, 255, 0.09);
  --line-2:  rgba(255, 255, 255, 0.17);
  --ink:     #f4f2fb;
  --ink-dim: #b1adc6;
  --ink-mute:#7d7994;

  --pink:  #ff5fa2;
  --pink-2:#ff8ec2;
  --cyan:  #5ef3ff;
  --frost: #ecfdff;

  --word:    "Press Start 2P", ui-monospace, monospace;
  --display: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body:    "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  min-height: 100vh;
  background: var(--void);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-family: var(--display); font-weight: 700; }

:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }

/* ============================================================ hero ===== */
.hero {
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 1.6rem;
  padding: 4.75rem 1.25rem 2.5rem;
}
/* One deliberate atmospheric moment: a cold neon haze behind the hero --
   this replaces the old scanline veil. Pink + cyan blooms, low and soft. */
.hero::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  inset: -30% -15% auto -15%; height: 150%;
  background:
    radial-gradient(48% 60% at 28% 8%, color-mix(in srgb, var(--pink) 26%, transparent), transparent 72%),
    radial-gradient(50% 60% at 78% 4%, color-mix(in srgb, var(--cyan) 22%, transparent), transparent 72%);
}

.brand {
  display: inline-flex; align-items: center; gap: 1rem;
  text-decoration: none; color: var(--ink);
  flex-wrap: wrap; justify-content: center; max-width: 100%;
}
.brand-logo {
  image-rendering: pixelated;
  width: 68px; height: 85px;
  filter: drop-shadow(0 8px 18px rgba(94, 243, 255, 0.20));
}
.brand-name {
  font-family: var(--word);
  font-size: clamp(1.65rem, 5.2vw, 2.85rem);
  letter-spacing: 0.02em;
  color: var(--pink);
  /* modernized: a single soft neon glow -- no hard offset drop shadow */
  text-shadow: 0 0 26px rgba(255, 95, 162, 0.38);
}

/* the celebratory number (JS-populated, hidden until data) + its fallback */
.hero-stat {
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  min-height: 3rem;
}
.hero-tagline {
  margin: 0;
  font-size: clamp(1rem, 2.3vw, 1.22rem);
  line-height: 1.5; color: var(--ink-dim);
  /* Wide enough that each <br>-separated sentence keeps to its own line on
     desktop (the longer one is ~44ch); it still wraps naturally on mobile. */
  max-width: 46ch;
  text-wrap: balance;
}

.hi-score { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; margin: 0; padding: 0; }
.hi-score-label {
  font-family: var(--display); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.22em; padding-left: 0.22em;
  font-size: clamp(0.68rem, 1.6vw, 0.82rem);
  color: var(--cyan);
}
.hi-score-num {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(3.6rem, 13vw, 7rem);
  line-height: 0.92; letter-spacing: -0.02em;
  color: var(--frost);
  font-variant-numeric: tabular-nums;
  max-width: 100%;
  text-shadow: 0 0 44px rgba(94, 243, 255, 0.30);
}
.hi-score-sub {
  margin-top: 0.4rem;
  font-size: clamp(0.85rem, 1.8vw, 0.98rem);
  color: var(--ink-dim);
}
.hi-score-sub .stat { white-space: nowrap; }
.hi-score-sub .sep { color: var(--ink-mute); margin: 0 0.15rem; }
/* narrow screens: keep the hero line to the plays stat; drop the players flex */
@media (max-width: 560px) {
  .hi-score-sub .stat--players, .hi-score-sub .sep { display: none; }
}

/* action buttons */
.home-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.7rem; }
.home-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--display); font-weight: 600; font-size: 0.92rem;
  color: var(--ink);
  background: var(--raise);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 0.68rem 1.15rem; cursor: pointer; line-height: 1; text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.home-btn:hover { transform: translateY(-2px); border-color: var(--cyan); background: var(--raise-2); }
.home-btn.is-primary { border-color: color-mix(in srgb, var(--cyan) 55%, var(--line-2)); }
.ic { width: 1.15em; height: 1.15em; vertical-align: -0.13em; }

/* ===================================================== category nav ===== */
.cat-nav {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem;
  max-width: 1000px; margin: 0 auto 2.75rem; padding: 0 1.25rem;
}
.cat-chip {
  font-family: var(--display); font-weight: 600; font-size: 0.84rem;
  color: var(--ink-dim);
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.52rem 0.95rem; text-decoration: none; line-height: 1;
  transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.15s;
}
.cat-chip:hover { color: var(--ink); border-color: var(--line-2); background: var(--raise-2); transform: translateY(-1px); }
.cat-chip.is-current {
  color: var(--void); background: var(--cyan); border-color: var(--cyan); font-weight: 700;
}

/* ========================================================== grid ======= */
.arcade { max-width: 1180px; margin: 0 auto; padding: 0.5rem 1.5rem 5rem; }
.game-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 1.4rem;
}
.game-card { display: flex; }

.game-card a {
  display: flex; flex-direction: column; height: 100%; width: 100%;
  text-decoration: none; color: var(--ink);
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 14px 30px -22px rgba(0, 0, 0, 0.85);
  transition: transform 0.2s cubic-bezier(0.2, 0.7, 0.2, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}
.game-card a:hover, .game-card a:focus-visible {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--accent, var(--cyan)) 55%, var(--line-2));
  box-shadow:
    0 24px 46px -24px rgba(0, 0, 0, 0.9),
    0 0 0 1px color-mix(in srgb, var(--accent, var(--cyan)) 42%, transparent),
    0 12px 42px -14px color-mix(in srgb, var(--accent, var(--cyan)) 40%, transparent);
}

.game-thumb {
  position: relative;
  aspect-ratio: 4 / 3; display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent, var(--pink)) 42%, #000) 0%, var(--raise) 82%);
  border-bottom: 1px solid var(--line);
}
.game-thumb img {
  width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated;
  transition: transform 0.3s ease;
}
.game-card a:hover .game-thumb img { transform: scale(1.045); }
.game-thumb-fallback {
  font-family: var(--display); font-weight: 600; font-size: 1rem;
  text-align: center; padding: 0 1rem; color: var(--ink);
}

.game-meta { padding: 1rem 1.05rem 1.15rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.game-title {
  font-family: var(--display); font-weight: 600; font-size: 1.06rem;
  letter-spacing: -0.01em; line-height: 1.2; margin: 0; color: var(--ink);
}
.game-desc {
  margin: 0; font-size: 0.88rem; line-height: 1.5; color: var(--ink-dim); flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.game-play {
  align-self: flex-start; margin-top: 0.2rem;
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-family: var(--display); font-weight: 600; font-size: 0.82rem;
  color: var(--accent, var(--cyan));
}
.game-play .arw { transition: transform 0.2s ease; }
.game-card a:hover .game-play .arw { transform: translateX(4px); }

/* ======================================================= empty state === */
.empty-state { text-align: center; padding: 5rem 1rem; color: var(--ink-dim); }
.empty-pig { font-family: var(--display); font-weight: 600; color: var(--cyan); font-size: 1.1rem; margin-bottom: 0.4rem; }

/* ========================================================== footer ===== */
.site-footer {
  text-align: center; padding: 2.5rem 1.25rem 3.5rem;
  color: var(--ink-mute); font-family: var(--body); font-size: 0.9rem;
  border-top: 1px solid var(--line); margin-top: 1.5rem;
}
.site-footer a { color: var(--cyan); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-cta { margin-top: 0.4rem; color: var(--ink-dim); }
.footer-copyright { margin-top: 0.7rem; font-size: 0.78rem; color: var(--ink-mute); }

/* ================================================= category hub pages === */
.crumbs {
  max-width: 1180px; margin: 2rem auto 0; padding: 0 1.5rem;
  font-family: var(--body); font-size: 0.85rem; color: var(--ink-mute);
}
.crumbs a { color: var(--cyan); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs span { margin: 0 0.45rem; }

.hub-header { max-width: 820px; margin: 1.5rem auto 2.5rem; padding: 0 1.5rem; text-align: center; }
.hub-title {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(1.8rem, 5vw, 2.9rem); letter-spacing: -0.02em; line-height: 1.1;
  color: var(--ink); margin: 0;
}
.hub-title::after {
  content: ""; display: block; width: 46px; height: 3px; border-radius: 2px;
  margin: 0.95rem auto 0; background: var(--accent, var(--cyan));
}
.hub-blurb {
  font-family: var(--body); font-size: clamp(0.95rem, 1.8vw, 1.08rem);
  color: var(--ink-dim); margin: 1.1rem auto 0; line-height: 1.6; max-width: 60ch;
}

/* =============================================== operator stats page ==== */
.stats-page { max-width: 960px; margin: 0 auto; padding: 2.5rem 1.5rem 4rem; }
.stats-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.75rem; }
.stats-back { font-family: var(--display); font-weight: 600; font-size: 0.85rem; color: var(--cyan); text-decoration: none; }
.stats-back:hover { color: var(--pink); }
.stats-title {
  font-family: var(--display); font-weight: 700; font-size: clamp(1.4rem, 4vw, 2rem);
  letter-spacing: -0.01em; color: var(--ink); margin: 0; flex: 1;
}
.stats-refresh {
  font-family: var(--display); font-weight: 600; font-size: 0.8rem; color: var(--ink); cursor: pointer;
  background: var(--raise); border: 1px solid var(--line-2); border-radius: 10px; padding: 0.5rem 0.85rem;
  transition: border-color 0.15s;
}
.stats-refresh:hover { border-color: var(--cyan); }
.stats-msg { color: var(--ink-dim); font-size: 0.95rem; }
.stats-err { color: var(--pink); font-size: 0.85rem; min-height: 1.2em; margin: 0.5rem 0 0; }

.stats-gate { max-width: 360px; }
.stats-gate label { display: block; font-family: var(--display); font-weight: 600; font-size: 0.85rem; color: var(--cyan); margin-bottom: 0.6rem; }
.stats-gate-row { display: flex; gap: 0.5rem; }
.stats-gate input {
  flex: 1; min-width: 0; padding: 0.6rem 0.75rem; font-size: 0.95rem; font-family: var(--body); color: var(--ink);
  background: var(--raise); border: 1px solid var(--line-2); border-radius: 10px;
}
.stats-gate input:focus { outline: none; border-color: var(--cyan); }
.stats-gate button {
  font-family: var(--display); font-weight: 700; font-size: 0.85rem; color: var(--void); background: var(--cyan);
  border: none; padding: 0 1.1rem; cursor: pointer; border-radius: 10px;
}
.stats-gate button:hover { background: var(--pink-2); }

.stats-totals { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.75rem; }
.stat-card {
  flex: 1 1 150px; display: flex; flex-direction: column; gap: 0.35rem; padding: 1.1rem 1.2rem;
  background: var(--raise); border: 1px solid var(--line); border-radius: 14px;
}
.stat-val { font-family: var(--display); font-weight: 700; font-size: clamp(1.3rem, 4vw, 1.9rem); color: var(--cyan); font-variant-numeric: tabular-nums; }
.stat-label { font-family: var(--body); font-size: 0.82rem; color: var(--ink-dim); letter-spacing: 0.02em; }

.stats-table { width: 100%; border-collapse: collapse; font-family: var(--body); font-size: 0.92rem; }
.stats-table th, .stats-table td { padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid var(--line); }
.stats-table th {
  font-family: var(--display); font-weight: 600; font-size: 0.74rem; text-transform: uppercase;
  color: var(--ink-dim); letter-spacing: 0.05em; cursor: pointer; user-select: none; white-space: nowrap;
}
.stats-table th:hover { color: var(--cyan); }
.stats-table th.sorted { color: var(--cyan); }
.stats-table th.sorted::after { content: " \25BC"; font-size: 0.7em; }
.stats-table th.sorted[data-dir="asc"]::after { content: " \25B2"; }
.stats-table td.num, .stats-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.stats-table tbody tr:hover { background: var(--raise); }
.stats-table td:first-child { color: var(--ink); }

/* ========================================================= mobile ====== */
@media (max-width: 560px) {
  .hero { padding: 3.25rem 1.25rem 1.75rem; }
  .brand { gap: 0.75rem; }
  .arcade { padding: 0.5rem 1.1rem 4rem; }
  .game-grid { gap: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* =============================================== about page ============= */
.about-page { max-width: 720px; margin: 0 auto; padding: 3rem 1.5rem 4.5rem; }
.about-back {
  display: inline-block; font-family: var(--display); font-weight: 600;
  font-size: 0.85rem; color: var(--cyan); text-decoration: none; margin-bottom: 1.75rem;
}
.about-back:hover { color: var(--pink); }
.about-page h1 {
  font-size: clamp(1.9rem, 5vw, 2.7rem); line-height: 1.1;
  letter-spacing: -0.01em; margin: 0 0 1.6rem; color: var(--ink);
}
.about-page p {
  color: var(--ink-dim); line-height: 1.75; font-size: 1.06rem;
  margin: 0 0 1.2rem; max-width: 62ch;
}
.about-page a { color: var(--cyan); text-decoration: none; }
.about-page a:hover { color: var(--pink); text-decoration: underline; }
