:root {
  --bg: #fff8ec;
  --surface: #ffffff;
  --text: #1b1430;
  --muted: #554c6b;
  --accent: #c2410c;
  --accent-contrast: #ffffff;
  --border: #eadfcc;
  --focus: #6d28d9;
  --radius: 14px;
  --wrap: 68rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1430;
    --surface: #251c40;
    --text: #f6f1ff;
    --muted: #c4bbd9;
    --accent: #fb923c;
    --accent-contrast: #1b1430;
    --border: #3a2f5c;
    --focus: #c4b5fd;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

main {
  flex: 1;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 1rem;
}

@media (min-width: 40rem) {
  .wrap {
    padding-inline: 2rem;
  }
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -10rem;
  padding: 0.5rem 1rem;
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  z-index: 10;
}

.skip-link:focus {
  top: 1rem;
}

/* Header */
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.1rem;
  text-decoration: none;
}

.site-header ul {
  display: flex;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-header nav a {
  font-weight: 600;
  text-decoration: none;
}

.site-header nav a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Hero */
.hero {
  padding-block: clamp(3rem, 10vw, 7rem);
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 16ch;
  font-size: clamp(2.5rem, 8vw, 4.75rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.accent {
  color: var(--accent);
}

.lede {
  max-width: 38rem;
  margin: 1.5rem 0 0;
  color: var(--muted);
  font-size: clamp(1.1rem, 2.5vw, 1.3rem);
}

.actions {
  margin: 2rem 0 0;
}

.button {
  display: inline-block;
  min-height: 44px;
  padding: 0.8rem 1.5rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.15s ease;
}

.button:hover {
  transform: translateY(-2px);
}

/* Feature card */
.feature {
  padding-bottom: clamp(3rem, 8vw, 5rem);
}

/* Keep stacked feature cards close together. */
.feature:has(+ .feature) {
  padding-bottom: 1rem;
}

.card {
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.card p {
  max-width: 40rem;
  margin: 0 0 1rem;
  color: var(--muted);
}

.card > :last-child {
  margin-bottom: 0;
}

.text-link {
  font-weight: 700;
  color: var(--accent);
  text-underline-offset: 4px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0;
  padding-block: 1.5rem;
}

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

/* Timewasters games list */
.hero--compact {
  padding-block: clamp(2.5rem, 7vw, 4.5rem) clamp(1.5rem, 4vw, 2.5rem);
}

.games {
  padding-bottom: clamp(3rem, 8vw, 5rem);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.game-card {
  position: relative;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.game-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.25rem;
}

.game-card p {
  margin: 0;
  color: var(--muted);
}

.game-card a {
  text-decoration: none;
}

/* Make the whole card clickable via the title link. */
.game-card a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

/* Cue that a game link opens in a new tab; screen readers get the hidden text instead. */
.new-tab-icon {
  margin-inline-start: 0.3em;
  color: var(--muted);
  font-size: 0.85em;
}

.game-card:has(a):hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

/* Move the focus ring to the card where :has() is supported; otherwise the link keeps its own. */
@supports selector(:has(a)) {
  .game-card:has(a:focus-visible) {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
  }

  .game-card a:focus-visible {
    outline: none;
  }
}

.game-card--placeholder {
  border-style: dashed;
  background: transparent;
}

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