
:root {
  --cream: #F7EBDD;
  --warm-white: #FFF9F2;
  --navy: #172A3A;
  --navy-text: #18232C;
  --navy-soft: #243B4D;
  --clay: #C46A4A;
  --burnt-clay: #A94F35;
  --dark-clay: #8C3F27;
  --sand: #EBD8C5;
  --gold: #C49A5A;
  --border: #D8C9BC;
  --muted: #655D56;
  --shadow: 0 12px 30px rgba(23, 42, 58, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--warm-white);
  color: var(--navy-text);
  font-family: Inter, Arial, sans-serif;
  line-height: 1.6;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

/* Header */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem clamp(1rem, 5vw, 4rem);
  border-bottom: 1px solid var(--border);
  background: var(--warm-white);
}

.brand {
  color: var(--navy);
  font-size: 1.8rem;
  font-weight: 850;
  letter-spacing: -0.08em;
  text-decoration: none;
}

.brand span {
  color: var(--burnt-clay);
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--burnt-clay);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.site-header .eyebrow {
  margin: 0;
  color: var(--muted);
}

/* Main layout */

.page-shell {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 5vw, 3rem);
}

.hero {
  padding: clamp(3.5rem, 8vw, 6.5rem) 0 3rem;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 800px;
  margin-bottom: 1rem;
  color: var(--navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.8rem, 7vw, 5.4rem);
  line-height: 0.99;
  letter-spacing: -0.045em;
}

h1 span {
  color: var(--burnt-clay);
}

.hero-copy {
  max-width: 680px;
  color: #4F5354;
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.5rem;
}

.hero-tags span {
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--cream);
  color: var(--navy-soft);
  font-size: 0.86rem;
}

/* Game directory */

.catalog {
  padding: 2rem 0 4rem;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

h2 {
  margin-bottom: 0.3rem;
  color: var(--navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  line-height: 1.1;
}

.count {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

/* Search and dropdown filters */

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(160px, 1fr) minmax(150px, 1fr);
  gap: 0.9rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #FFFFFF;
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--navy-soft);
  font-size: 0.82rem;
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--warm-white);
  color: var(--navy-text);
}

input::placeholder {
  color: #80766C;
  opacity: 1;
}

input:focus,
select:focus {
  border-color: var(--burnt-clay);
}

/* Category buttons */

.category-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 1.4rem;
}

.category-chip {
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: transparent;
  color: var(--navy-soft);
  font-size: 0.85rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.category-chip:hover {
  border-color: var(--burnt-clay);
  color: var(--burnt-clay);
}

.category-chip[aria-pressed="true"] {
  border-color: var(--navy);
  background: var(--navy);
  color: #FFFFFF;
}

/* Game cards */

.games-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.game-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 275px;
  padding: 1.2rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #FFFFFF;
  box-shadow: 0 4px 15px rgba(23, 42, 58, 0.025);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.game-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.game-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 15px;
  background: var(--cream);
  font-size: 1.7rem;
}

.level {
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  background: #F3E9DD;
  color: var(--dark-clay);
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
}

.game-card h3 {
  margin: 1rem 0 0.4rem;
  color: var(--navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  line-height: 1.2;
}

.game-card p {
  margin-bottom: 1rem;
  color: #5B5C5B;
  font-size: 0.92rem;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: auto;
  margin-bottom: 1rem;
}

.card-tags span {
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: #F7F2EC;
  color: #514A43;
  font-size: 0.72rem;
}

.card-button,
.primary-button {
  min-height: 44px;
  padding: 0.65rem 0.9rem;
  border: 0;
  border-radius: 10px;
  background: var(--burnt-clay);
  color: #FFFFFF;
  font-weight: 750;
  text-align: center;
  transition: background 0.2s ease;
}

.card-button {
  width: 100%;
  margin-top: 0;
}

.card-button:hover,
.primary-button:hover {
  background: var(--dark-clay);
}

.empty-state {
  padding: 2rem;
  border: 1px dashed var(--border);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}

/* Reading and math feature section */

.word-problems {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 1.5rem;
  margin: 0 0 4rem;
  padding: clamp(1.3rem, 4vw, 2.5rem);
  border-radius: 22px;
  background: var(--navy);
  color: #F8F1E8;
}

.word-problems h2 {
  color: #FFFFFF;
}

.word-problems p:last-child {
  max-width: 720px;
  margin-bottom: 0;
  color: #E4E0DA;
}

.word-mark {
  display: grid;
  place-items: center;
  min-width: 84px;
  height: 84px;
  border: 1px solid var(--gold);
  border-radius: 18px;
  color: #F0D7B5;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  line-height: 1.3;
  text-align: center;
}
/* =========================
   SITE HEADER
========================= */

.site-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 5%;
  box-sizing: border-box;
  background: #FFF9F2;
  border-bottom: 1px solid #EBD8C5;
}

/* =========================
   BRAND
========================= */

.site-header .brand {
  color: #172A3A;
  font-family: Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.5px;
  transition: color 0.2s ease;
}

.site-header .brand:hover {
  color: #C46A4A;
}

/* =========================
   NAVIGATION
========================= */

.site-header nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.site-header nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 999px;
  color: #172A3A;
  background: transparent;
  font-family: Arial, sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.site-header nav a:hover {
  color: #FFF9F2;
  background: #C46A4A;
}

/* =========================
   MOBILE
========================= */

@media (max-width: 760px) {
  .site-header {
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 16px 12px;
  }

  .site-header nav {
    justify-content: center;
    gap: 6px;
    width: 100%;
  }

  .site-header nav a {
    padding: 9px 12px;
    font-size: 0.82rem;
  }
}

@media (max-width: 420px) {
  .site-header nav {
    gap: 4px;
  }

  .site-header nav a {
    padding: 8px 10px;
    font-size: 0.76rem;
  }
}

/* Game details dialog */

.game-dialog {
  position: relative;
  width: min(92vw, 580px);
  max-width: 580px;
  max-height: 88vh;
  overflow: auto;
  padding: clamp(1.3rem, 4vw, 2rem);
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--warm-white);
  color: var(--navy-text);
  box-shadow: 0 25px 90px rgba(0, 0, 0, 0.25);
}

.game-dialog::backdrop {
  background: rgba(17, 29, 39, 0.62);
}

.dialog-close {
  position: absolute;
  top: 0.8rem;
  right: 0.9rem;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #FFFFFF;
  color: var(--navy);
  font-size: 1.5rem;
  line-height: 1;
}

.dialog-close:hover {
  background: var(--cream);
}

.game-dialog h2 {
  padding-right: 2rem;
}

.game-dialog h3 {
  margin: 1.2rem 0 0.35rem;
  color: var(--navy);
  font-size: 1rem;
}

.game-dialog ul {
  padding-left: 1.25rem;
}

.dialog-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.dialog-meta span {
  padding: 0.25rem 0.5rem;
  border-radius: 7px;
  background: var(--cream);
}

.dialog-note {
  padding: 0.75rem;
  border-left: 3px solid var(--gold);
  background: #F7F0E7;
  font-size: 0.9rem;
}

.primary-button {
  width: 100%;
  margin-top: 0.5rem;
}

/* Footer */

.site-footer {
  padding: 1.5rem 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  text-align: center;
  font-size: 0.85rem;
}

.site-footer p {
  margin: 0;
}

/* Tablet */

@media (max-width: 850px) {
  .games-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Mobile */

@media (max-width: 600px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.2rem;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.25rem;
  }

  .games-grid {
    grid-template-columns: 1fr;
  }

  .game-card {
    min-height: 0;
  }

  .word-problems {
    grid-template-columns: 1fr;
  }

  .word-mark {
    min-width: 68px;
    width: 68px;
    height: 68px;
  }
}

/* Accessibility */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* Mobile game dialog positioning */
@media (max-width: 600px) {
  .game-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    width: calc(100% - 24px);
    max-width: 580px;

    max-height: 85dvh;
    max-height: 85vh;

    margin: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .game-dialog .primary-button {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin-top: 1rem;
  }
}
