:root {
  --paper: #f3f5f8;
  --ink: #1f2a44;
  --ink-soft: #4a5570;
  --cobalt: #2f4aa8;
  --marigold: #f2b632;
  --mint: #9ed8c2;
  --rose: #e8a0b4;
  --white: #ffffff;
  --line: #d6dbe5;

  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, sans-serif;

  --step-0: 1.125rem;
  --step-1: 1.375rem;
  --step-2: 2rem;
  --step-3: clamp(2.5rem, 5vw + 1rem, 4.25rem);

  --gutter: clamp(1rem, 4vw, 3rem);
  --max: 72rem;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: 1.55;
}

h1, h2 {
  font-family: var(--display);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0;
}

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

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

.skip {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  background: var(--ink);
  color: var(--white);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  z-index: 10;
}
.skip:focus { left: 0.5rem; }

/* Header */
.site-header {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wordmark {
  font-family: var(--display);
  font-weight: 800;
  font-size: var(--step-1);
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.lang {
  font: 700 1rem var(--body);
  color: var(--ink);
  background: transparent;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  cursor: pointer;
}
.lang:hover { background: var(--ink); color: var(--paper); }

/* Hero */
.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 4rem) var(--gutter) clamp(3rem, 8vw, 6rem);
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}

.hero h1 {
  font-size: var(--step-3);
  max-width: 14ch;
}

.lede {
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 34ch;
  margin: 1.5rem 0 2rem;
}

.button {
  display: inline-block;
  font-weight: 700;
  font-size: var(--step-0);
  color: var(--white);
  background: var(--cobalt);
  padding: 0.9rem 1.6rem;
  border-radius: 0.75rem;
  text-decoration: none;
}
.button:hover { background: var(--ink); }

/* Memory game */
.game {
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 1.5rem;
  padding: clamp(1rem, 3vw, 1.75rem);
  box-shadow: 8px 8px 0 var(--ink);
}

.game-title {
  font-weight: 700;
  margin: 0 0 1rem;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.5rem, 2vw, 0.9rem);
}

.tile {
  aspect-ratio: 1;
  border: 2px solid var(--ink);
  border-radius: 1rem;
  padding: 0;
  cursor: pointer;
  background: var(--marigold);
  position: relative;
  perspective: 600px;
  transition: transform 0.12s ease;
}
.tile:active { transform: scale(0.97); }

.tile-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.35s ease;
}

.tile.is-open .tile-inner,
.tile.is-matched .tile-inner { transform: rotateY(180deg); }

.tile-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 0.85rem;
  backface-visibility: hidden;
}

.tile-back {
  background:
    radial-gradient(circle at 50% 50%, var(--ink) 0 0.2rem, transparent 0.25rem) center / 2.25rem 2.25rem,
    var(--marigold);
  opacity: 0.95;
}

.tile-front {
  background: var(--white);
  transform: rotateY(180deg);
}
.tile.is-matched .tile-front { background: #e3f4ec; }
.tile.is-matched { cursor: default; }

.tile svg { width: 55%; height: 55%; }

.game-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  min-height: 2.5rem;
}

.game-status {
  margin: 0;
  font-weight: 700;
}

.link-button {
  font: 700 1rem var(--body);
  color: var(--cobalt);
  background: none;
  border: none;
  padding: 0.5rem 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .tile, .tile-inner { transition: none; }
}

/* Activities */
.activities,
.about {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(3rem, 8vw, 5rem);
}

.activities h2,
.about h2 {
  font-size: var(--step-2);
  margin-bottom: 1.5rem;
}

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 2px solid var(--ink);
}

.activity {
  display: grid;
  grid-template-columns: 4rem 1fr auto;
  gap: 1.25rem;
  align-items: center;
  padding: 1.25rem 0;
  border-bottom: 2px solid var(--line);
}

.activity-swatch {
  width: 4rem;
  height: 4rem;
  border: 2px solid var(--ink);
  border-radius: 1rem;
  display: grid;
  place-items: center;
}
.activity-swatch svg { width: 55%; height: 55%; }

.activity h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: var(--step-1);
  line-height: 1.2;
  margin: 0 0 0.25rem;
}

.activity p {
  margin: 0;
  color: var(--ink-soft);
  max-width: 60ch;
}

.activity-action {
  font-weight: 700;
  white-space: nowrap;
}

.activity-soon {
  font-weight: 700;
  color: var(--ink-soft);
  border: 2px dashed var(--ink-soft);
  border-radius: 999px;
  padding: 0.25rem 0.85rem;
  white-space: nowrap;
  font-size: 1rem;
}

/* About */
.about p {
  max-width: 60ch;
  font-size: var(--step-1);
  line-height: 1.5;
  margin: 0;
}

/* Footer */
.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter) 3rem;
  color: var(--ink-soft);
}
.site-footer p { margin: 0; }

/* Small screens */
@media (max-width: 52rem) {
  .hero { grid-template-columns: 1fr; }
  .hero h1 { max-width: 16ch; }
}

@media (max-width: 36rem) {
  .activity {
    grid-template-columns: 3rem 1fr;
    gap: 1rem;
    align-items: start;
  }
  .activity-swatch { width: 3rem; height: 3rem; border-radius: 0.75rem; }
  .activity-action,
  .activity-soon { grid-column: 2; justify-self: start; }
  .game { box-shadow: 5px 5px 0 var(--ink); }
}
