:root {
  --navy: #182044;
  --navy-light: #2a3566;
  --cream: #faf4e6;
  --cream-dark: #f1e8d4;
  --blue: #3b6bf0;
  --blue-dark: #2850c8;
  --ink: #1b1f2e;
  --muted: #5b6072;
  --white: #ffffff;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(24, 32, 68, 0.1);
  --shadow-hover: 0 16px 40px rgba(24, 32, 68, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Nunito Sans", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: "Baloo 2", "Nunito Sans", sans-serif;
  color: var(--navy);
  line-height: 1.15;
  margin: 0 0 0.5em;
}

p {
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 1em;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

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

/* ---------- Header ---------- */

.site-header {
  background: var(--navy);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 14px rgba(0,0,0,0.12);
}

.site-header .container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--white);
  letter-spacing: 0.2px;
}

.brand .dot {
  color: #ffd166;
}

.main-nav {
  display: flex;
  gap: 4px;
}

.main-nav a {
  color: #cdd3ee;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.98rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  background: var(--navy-light);
  color: var(--white);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

.nav-toggle:hover,
.nav-toggle:focus-visible {
  background: var(--navy-light);
}

.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  margin: 0 auto;
  background: var(--white);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle.is-active .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-active .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle.is-active .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  background: linear-gradient(160deg, var(--navy) 0%, #273269 60%, var(--blue-dark) 130%);
  color: var(--white);
  padding: 76px 0 90px;
  overflow: hidden;
}

#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}

#hero-canvas.is-ready {
  opacity: 1;
}

.hero .container {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 24px;
  text-align: center;
  justify-items: center;
}

.hero h1 {
  color: var(--white);
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  max-width: 820px;
  margin-bottom: 0.3em;
}

.hero p.lede {
  color: #d8dcf4;
  font-size: 1.15rem;
  max-width: 620px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.98rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  border: 2px solid transparent;
  cursor: pointer;
}

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

.btn-primary {
  background: #ffd166;
  color: #3a2800;
  box-shadow: 0 8px 20px rgba(255, 209, 102, 0.35);
}

.btn-primary:hover {
  box-shadow: 0 12px 26px rgba(255, 209, 102, 0.45);
}

.btn-outline {
  background: transparent;
  border-color: rgba(255,255,255,0.5);
  color: var(--white);
}

.btn-outline:hover {
  background: rgba(255,255,255,0.1);
}

.btn-dark {
  background: var(--navy);
  color: var(--white);
}

.btn-dark:hover {
  background: var(--navy-light);
}

.btn-amazon {
  background: #232f3e;
  color: #fff;
}

.btn-amazon:hover {
  background: #37475a;
}

.btn-etsy {
  background: #f1641e;
  color: #182044;
}

.btn-etsy:hover {
  background: #f08347;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.btn-sm {
  padding: 10px 18px;
  font-size: 0.88rem;
}

/* ---------- Section scaffolding ---------- */

.section {
  padding: 72px 0;
}

.section-alt {
  background: var(--cream-dark);
}

.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 44px;
}

.eyebrow {
  display: inline-block;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--blue-dark);
  background: rgba(59, 107, 240, 0.1);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
}

/* ---------- Category / card grids ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 28px;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.card-media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--cream-dark);
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  padding: 22px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.card-body h3 {
  margin-bottom: 0;
  font-size: 1.3rem;
}

.card-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--blue-dark);
}

.card-actions {
  margin-top: auto;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 6px;
}

/* homepage category tiles */

.category-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
}

.tile {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 300px;
  display: flex;
  align-items: flex-end;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tile:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(24,32,68,0) 30%, rgba(13,17,38,0.92) 100%);
}

.tile-content {
  position: relative;
  z-index: 2;
  padding: 28px 26px;
  color: var(--white);
}

.tile-content h3 {
  color: var(--white);
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.tile-content p {
  color: #e4e7f6;
  margin-bottom: 14px;
  font-size: 0.95rem;
}

.tile-content .btn {
  padding: 10px 20px;
  font-size: 0.88rem;
}

/* ---------- Page header (sub-pages) ---------- */

.page-header {
  background: var(--navy);
  color: var(--white);
  padding: 56px 0 64px;
  text-align: center;
}

.page-header h1 {
  color: var(--white);
  font-size: clamp(1.9rem, 4vw, 2.8rem);
}

.page-header p {
  color: #d8dcf4;
  max-width: 600px;
  margin: 0 auto;
  font-size: 1.05rem;
}

.breadcrumb {
  font-size: 0.85rem;
  font-weight: 700;
  color: #9ba4d6;
  margin-bottom: 14px;
}

.breadcrumb a {
  color: #cdd3ee;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* ---------- Info strip ---------- */

.info-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 50px;
}

.info-strip .item {
  background: var(--white);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.info-strip .item h4 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.info-strip .item p {
  margin: 0;
  font-size: 0.92rem;
}

/* ---------- How-to-play strip (puzzle page) ---------- */

.how-to {
  margin-top: 56px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  text-align: center;
}

.how-to img {
  width: 100%;
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--navy);
  color: #aeb4de;
  padding: 50px 0 30px;
  margin-top: 40px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.footer-brand .brand {
  color: var(--white);
  margin-bottom: 10px;
}

.footer-brand p {
  color: #9aa0cc;
  max-width: 320px;
  font-size: 0.92rem;
}

.footer-col h3 {
  color: var(--white);
  font-size: 0.95rem;
  margin-bottom: 14px;
}

.footer-col a {
  display: block;
  color: #aeb4de;
  padding: 5px 0;
  font-size: 0.92rem;
  transition: color 0.15s ease;
}

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

.footer-bottom {
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.85rem;
  color: #8389b8;
}

/* ---------- Feature banner (e.g. Mega Bundle) ---------- */

.feature-banner {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 36px;
  align-items: center;
  background: linear-gradient(160deg, var(--navy) 0%, #273269 60%, var(--blue-dark) 130%);
  color: var(--white);
  border-radius: var(--radius);
  padding: 40px;
  margin-bottom: 52px;
  box-shadow: var(--shadow);
}

.feature-banner .eyebrow {
  background: rgba(255, 255, 255, 0.14);
  color: #ffd166;
}

.feature-banner h2 {
  color: var(--white);
  font-size: 1.9rem;
}

.feature-banner p {
  color: #d8dcf4;
}

.feature-banner ul {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  display: grid;
  gap: 8px;
}

.feature-banner li {
  color: #e4e7f6;
  font-size: 0.95rem;
}

.feature-banner li b {
  color: #ffd166;
}

.feature-banner-media img {
  width: 100%;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

@media (max-width: 760px) {
  .feature-banner {
    grid-template-columns: 1fr;
    padding: 28px;
  }
}

/* ---------- Accessibility ---------- */

.skip-link {
  position: absolute;
  left: 0;
  top: -60px;
  background: var(--navy);
  color: var(--white);
  padding: 14px 22px;
  font-weight: 800;
  z-index: 200;
  border-radius: 0 0 10px 0;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0;
}

.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;
}

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
  .nav-toggle {
    display: flex;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 2px;
    background: var(--navy);
    padding: 10px 16px 18px;
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.28);
  }

  .main-nav.is-open {
    display: flex;
  }

  .main-nav a {
    padding: 13px 16px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .section {
    padding: 52px 0;
  }
}

/* "play free online" button under a book series page title */
.page-header .page-header-cta {
  margin-top: 24px;
}

/* ---------- Online Games: filter + search ---------- */

.games-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
  max-width: 760px;
  margin: 0 auto 14px;
}

.games-filter input[type="search"] {
  flex: 1 1 260px;
  min-height: 48px;
  padding: 0 18px 0 46px;
  border: 2px solid var(--cream-dark);
  border-radius: 999px;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%235b6072' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 16px center;
  color: var(--ink);
  font: inherit;
  font-size: 1rem; /* 16px+ keeps iOS from zooming into the field */
}

.games-filter input[type="search"]:focus-visible,
.pill:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.filter-pills {
  display: flex;
  gap: 6px;
}

.pill {
  min-height: 48px;
  padding: 0 20px;
  border: 2px solid var(--cream-dark);
  border-radius: 999px;
  background: var(--white);
  color: var(--navy);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.pill:hover {
  border-color: var(--navy-light);
}

.pill[aria-pressed="true"] {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

.games-count {
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
  margin: 0 0 28px;
}

/* keep card widths steady when a filter leaves only one or two */
.games-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.games-grid .card[hidden],
.games-filter[hidden],
.games-empty[hidden] {
  display: none;
}

.games-empty {
  text-align: center;
  padding: 24px 0 8px;
}
