@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/fraunces-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: 'Instrument Sans';
  src: url('/fonts/instrument-sans-latin-wght-normal.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

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

html {
  background-color: var(--background);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 68rem;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 2.5rem);
  color: var(--foreground);
  font-family: 'Instrument Sans', system-ui, 'Noto Sans Arabic', Tahoma, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Soft light at the top of the page, across the whole width. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(40rem 24rem at 10% -6rem, var(--glow-start), transparent 70%),
    radial-gradient(38rem 24rem at 95% 2rem, var(--glow-end), transparent 70%);
  background-repeat: no-repeat;
}

h1,
h2,
h3,
.brand-name {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

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

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.25rem;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 99rem;
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
}

.theme-toggle:hover {
  background: var(--muted);
}

.theme-toggle[hidden] {
  display: none;
}

.theme-toggle svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The icon is the theme now showing. */
.theme-toggle[data-active='light'] .moon,
.theme-toggle[data-active='dark'] .sun {
  display: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  border-radius: 0.5rem;
  color: var(--foreground);
  text-decoration: none;
}

.mark {
  width: 1.75rem;
  height: 1.75rem;
}

.mark-ring {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.mark-dot {
  fill: var(--primary);
}

.brand-name {
  font-size: 1.35rem;
  font-weight: 500;
}

.brand-section {
  padding: 0.05rem 0.6rem;
  border-radius: 99rem;
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: 0.85rem;
  font-weight: 600;
}

main {
  flex: 1;
}

.intro {
  padding-block: clamp(1.5rem, 6vw, 4rem) clamp(2rem, 5vw, 3rem);
}

.intro h1 {
  font-size: clamp(2.5rem, 8vw, 4.25rem);
}

.intro p {
  max-width: 34rem;
  margin-top: 0.9rem;
  color: var(--muted-foreground);
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
}

/* One game fills the shelf; later ones share it in columns. */
.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
  gap: 1.5rem;
  list-style: none;
}

.game {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  background: var(--card);
  box-shadow: 0 1px 2px var(--shadow);
  transition:
    translate 180ms ease,
    box-shadow 180ms ease;
}

.game:hover {
  translate: 0 -3px;
  box-shadow: 0 16px 34px var(--shadow);
}

.game:focus-within {
  box-shadow: 0 16px 34px var(--shadow);
}

.art {
  display: grid;
  flex: 1 1 18rem;
  place-items: center;
  padding: clamp(1.5rem, 5vw, 3rem);
  background: var(--muted);
}

.board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
  width: min(100%, 18rem);
}

.tile {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 22%;
  box-shadow: inset 0 -3px 0 var(--shadow);
  font-family: system-ui, sans-serif;
  font-size: clamp(1rem, 4.5vw, 1.6rem);
  font-weight: 800;
}

.correct {
  background: var(--correct);
  color: var(--correct-foreground);
}

.present {
  background: var(--present);
  color: var(--present-foreground);
}

.absent {
  background: var(--absent);
  color: var(--absent-foreground);
}

.about {
  display: flex;
  flex: 1 1 18rem;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1rem;
  padding: clamp(1.5rem, 5vw, 3rem);
}

.about h3 {
  font-size: 2.25rem;
}

.native {
  margin-inline-start: 0.35rem;
  color: var(--muted-foreground);
  font-family: system-ui, 'Noto Sans Arabic', Tahoma, sans-serif;
  font-size: 0.72em;
}

.about p {
  color: var(--muted-foreground);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
}

.tags li {
  padding: 0.15rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 99rem;
  font-size: 0.875rem;
}

.play {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding-inline: 1.6rem;
  border-radius: 99rem;
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: 700;
  text-decoration: none;
}

.play:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* The whole card opens the game; there is still only one link to tab to. */
.game .play::after {
  content: '';
  position: absolute;
  inset: 0;
}

.more {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border: 2px dashed var(--border);
  border-radius: 1.5rem;
  color: var(--muted-foreground);
  text-align: center;
}

footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 3rem;
  padding-block: 1rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

footer nav {
  display: flex;
  gap: 1rem;
}

footer a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: inherit;
  text-underline-offset: 0.25em;
}

.legal {
  width: 100%;
  max-width: 42rem;
  margin-inline: auto;
  padding-block: 1rem;
}

.legal h1 {
  font-size: clamp(2rem, 6vw, 2.5rem);
}

.legal h2 {
  margin-top: 2rem;
  font-size: 1.25rem;
}

.legal p,
.legal ul {
  margin-top: 0.75rem;
}

.legal ul {
  padding-inline-start: 1.25rem;
}

.legal .updated {
  margin-top: 0.4rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.lost {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
}

.lost h1 {
  font-size: clamp(2rem, 7vw, 3rem);
}

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

  .game:hover {
    translate: none;
  }
}
