/* ===========================================================================
   BASE — reset, typography, hero, footer, motion primitives
   =========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  font-weight: 400;
  transition: background var(--transition-base), color var(--transition-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

input,
textarea {
  user-select: auto;
  -webkit-user-select: auto;
}

::selection {
  background-color: var(--selection-bg);
  color: var(--text-primary);
}

a {
  text-decoration: none;
  color: var(--accent);
  font-weight: 500;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
}

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

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

.hidden {
  display: none !important;
}

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

/* ===========================
   HERO
   =========================== */
.hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 104px 24px 40px;
  position: relative;
}

.hero h1 {
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 8px;
  word-spacing: 0.05em;
}

.hero h1 .accent {
  color: var(--accent);
  letter-spacing: -0.01em;
}

.hero-subtitle {
  font-size: clamp(0.98rem, 2vw, 1.15rem);
  color: var(--text-secondary);
  font-weight: 400;
  min-height: 1.8em;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* The line where the leaderboard drawer used to be advertised. It now says
   plainly that nothing leaves this browser. */
.hero-note {
  margin-top: 18px;
  font-size: 0.86rem;
  color: var(--text-tertiary);
  line-height: 1.7;
  max-width: 46ch;
  margin-left: auto;
  margin-right: auto;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  margin-left: 6px;
  font: inherit;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  box-shadow: none;
}

.link-button:hover {
  color: var(--text-primary);
  background: none;
  transform: none;
  box-shadow: none;
}

.pop-text {
  display: inline-block;
  animation: popFade 3s ease-in-out infinite;
}

@keyframes popFade {
  0%   { opacity: 0; transform: translateY(8px) scale(0.96); }
  12%  { opacity: 1; transform: translateY(0) scale(1); }
  80%  { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-6px) scale(0.98); }
}

/* ===========================
   SCROLL REVEAL
   =========================== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}

.reveal-stagger.visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger every child, not just the first five — the grid holds eight cards. */
.reveal-stagger.visible > *:nth-child(1) { transition-delay: 0.04s; }
.reveal-stagger.visible > *:nth-child(2) { transition-delay: 0.08s; }
.reveal-stagger.visible > *:nth-child(3) { transition-delay: 0.12s; }
.reveal-stagger.visible > *:nth-child(4) { transition-delay: 0.16s; }
.reveal-stagger.visible > *:nth-child(5) { transition-delay: 0.20s; }
.reveal-stagger.visible > *:nth-child(6) { transition-delay: 0.24s; }
.reveal-stagger.visible > *:nth-child(7) { transition-delay: 0.28s; }
.reveal-stagger.visible > *:nth-child(8) { transition-delay: 0.32s; }
.reveal-stagger.visible > *:nth-child(n+9) { transition-delay: 0.36s; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===========================
   FOOTER
   =========================== */
.footer {
  padding: 40px 24px;
  border-top: 1px solid var(--divider);
  color: var(--text-tertiary);
  font-size: 0.85rem;
  text-align: center;
}

.footer-content {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.footer a {
  color: var(--text-tertiary);
  font-weight: 500;
  transition: color var(--transition-fast);
}

.footer a:hover {
  color: var(--accent);
}
