/* ==========================================================
   Typing Park — site styles
   Colours are taken from the Typing Park logo.
   ========================================================== */
:root {
  --pink: #ff2a7a;
  --pink-dark: #c9145a;
  --green: #8cc20f;
  --green-dark: #5f8a00;
  --sky: #2fbdf2;
  --sky-dark: #0f8fc2;
  --yellow: #fcc712;
  --yellow-dark: #c99400;
  --navy: #1c244b;
  --ink: #324a6d;
  --muted: #6a7891;
  --bg: #ffffff;
  --soft: #f3fbff;
  --line: #e3ecf5;
  --radius: 20px;
  --shadow: 0 10px 30px rgba(28, 36, 75, 0.12);
  --font-body: "Poppins", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-fun: "Ranchers", "Poppins", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--sky-dark); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; border-radius: 8px; }

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding-inline: 20px; }

/* ---------- Top navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-block: 10px;
}
.nav-logo img { height: 44px; width: auto; }
.nav-links { display: flex; gap: 6px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--navy);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.nav-links a:hover { background: var(--soft); }
.nav-links a[aria-current="page"] { background: var(--navy); color: #fff; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-fun);
  font-size: 1.6rem;
  letter-spacing: 0.02em;
  line-height: 1.1;
  color: #fff;
  text-decoration: none;
  padding: 16px 30px 18px;
  border-radius: 18px;
  border: 0;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(2px); }
.btn-pink   { background: var(--pink);   box-shadow: 0 6px 0 var(--pink-dark); }
.btn-green  { background: var(--green);  box-shadow: 0 6px 0 var(--green-dark); }
.btn-sky    { background: var(--sky);    box-shadow: 0 6px 0 var(--sky-dark); }
.btn-yellow { background: var(--yellow); box-shadow: 0 6px 0 var(--yellow-dark); color: var(--navy); }
.btn-pink:active   { box-shadow: 0 2px 0 var(--pink-dark); }
.btn-green:active  { box-shadow: 0 2px 0 var(--green-dark); }
.btn-sky:active    { box-shadow: 0 2px 0 var(--sky-dark); }
.btn-yellow:active { box-shadow: 0 2px 0 var(--yellow-dark); }
.btn-big { font-size: 2.2rem; padding: 20px 44px 22px; }
.btn-row { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }

/* ---------- Hero ---------- */
.hero { text-align: center; padding-block: 48px 40px; }
.hero-logo { width: min(860px, 100%); margin: 0 auto; }
.hero-tagline {
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  color: var(--navy);
  font-weight: 500;
  margin: 18px auto 28px;
  max-width: 640px;
}

/* ---------- Sections ---------- */
.section { padding-block: 56px; }
.section-soft { background: var(--soft); }
.section-title {
  font-family: var(--font-fun);
  font-weight: 400;
  color: var(--navy);
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.1;
  text-align: center;
  margin: 0 0 8px;
}
.section-sub { text-align: center; color: var(--muted); margin: 0 auto 36px; max-width: 640px; }

/* ---------- Game grid ---------- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}
/* An odd game out on the last row sits in the middle */
.game-grid:not(.small) > .game-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  justify-self: center;
  width: calc(50% - 14px);
}
@media (max-width: 760px) {
  .game-grid { grid-template-columns: 1fr; }
  .game-grid:not(.small) > .game-card:last-child:nth-child(odd) { width: 100%; }
}
.game-grid.small { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 20px; }
.game-card {
  display: block;
  text-decoration: none;
  color: var(--navy);
  border-radius: var(--radius);
  transition: transform 0.15s ease;
}
.game-card img {
  width: 100%;
  aspect-ratio: 10 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--soft);
}
.game-card:hover { transform: translateY(-4px) rotate(-0.4deg); }
.game-card-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 6px 0;
  font-weight: 600;
}
.game-card-label .play { color: var(--pink); font-weight: 700; white-space: nowrap; }

/* ---------- Mission ---------- */
.mission { max-width: 860px; margin: 0 auto; }
.mission h2 {
  font-family: var(--font-body);
  font-weight: 300;
  color: var(--ink);
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  text-align: center;
  margin: 0 0 24px;
}
.mission p { font-size: 1.15rem; font-weight: 300; margin: 0 0 1.1em; }
.mission strong { font-weight: 600; color: var(--navy); }

/* ---------- Printables ---------- */
.feature {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 36px;
  align-items: center;
}
.feature img { border-radius: var(--radius); box-shadow: var(--shadow); }
.feature h3 { font-family: var(--font-fun); font-weight: 400; font-size: 2.2rem; color: var(--navy); margin: 0 0 10px; line-height: 1.1; }
.feature p { margin: 0 0 22px; }
@media (max-width: 820px) { .feature { grid-template-columns: 1fr; } }

.print-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 24px;
}
.print-card {
  display: block;
  text-decoration: none;
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.print-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.print-card img { width: 100%; aspect-ratio: 1.414 / 1; object-fit: cover; border-bottom: 1px solid var(--line); }
.print-card-label { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; font-weight: 600; }
.badge {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
  background: var(--pink);
  padding: 3px 9px;
  border-radius: 999px;
}
.group-title {
  font-family: var(--font-fun);
  font-weight: 400;
  font-size: 1.9rem;
  color: var(--navy);
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.group-title .dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.group-sub { color: var(--muted); margin: 0 0 22px; }
.group + .group { margin-top: 56px; }

/* ---------- Page header (inner pages) ---------- */
.page-head { text-align: center; padding-block: 40px 8px; }
.page-head h1 {
  font-family: var(--font-fun);
  font-weight: 400;
  color: var(--navy);
  font-size: clamp(2.4rem, 7vw, 4rem);
  line-height: 1.05;
  margin: 0 0 10px;
}
.page-head p { color: var(--muted); margin: 0 auto; max-width: 640px; }
.back-link {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--navy);
  font-weight: 600;
  text-decoration: none;
}
.back-link:hover { text-decoration: underline; }

/* ---------- Game portal page ---------- */
.portal { max-width: 980px; margin: 0 auto; text-align: center; }
.portal-banner { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); margin: 18px auto 36px; }
.portal-panel {
  background: var(--soft);
  border: 2px dashed #bfe6f7;
  border-radius: 28px;
  padding: 36px 24px 32px;
}
.portal-note { color: var(--muted); font-size: 0.95rem; margin: 22px 0 0; }
.chips { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 0 0 26px; padding: 0; list-style: none; }
.chips li { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 0.9rem; font-weight: 600; color: var(--navy); }
/* ---------- Playable game (Unity build in an iframe) ---------- */
/* Each game page sets --player-w (largest width) and --player-ratio (width / height).
   The frame also shrinks so the whole game fits on screen without scrolling. */
.player {
  --player-w: 640px; --player-ratio: 1;
  max-width: min(var(--player-w), calc((100vh - 150px) * var(--player-ratio)));
  margin: 18px auto 0;
}
.player-frame {
  position: relative;
  aspect-ratio: var(--player-ratio);
  background: var(--navy);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.player-start {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: 0; padding: 0; cursor: pointer;
  background: var(--navy) center / cover no-repeat;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  font: inherit; color: #fff;
}
.player-start::before { content: ""; position: absolute; inset: 0; background: rgba(28, 36, 75, 0.55); }
.player-start > * { position: relative; }
.player-start img { width: 86%; border-radius: 14px; }
.player-start .btn { pointer-events: none; }
.player-start:hover .btn { transform: translateY(-2px); }
.player-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.player-bar p { margin: 0; color: var(--muted); font-size: 0.92rem; text-align: left; }
.btn-small {
  font: 600 0.95rem var(--font-body); color: var(--navy); background: #fff;
  border: 2px solid var(--line); border-radius: 999px; padding: 8px 18px; cursor: pointer;
}
.btn-small:hover { border-color: var(--sky); }
.btn-small:disabled { opacity: 0.5; cursor: default; }
.mobile-note { display: none; margin: 14px 0 0; padding: 12px 16px; background: #fff8dc; border-radius: 14px; color: var(--navy); font-size: 0.95rem; }
@media (hover: none) and (pointer: coarse) { .mobile-note { display: block; } }

.howto { text-align: left; max-width: 720px; margin: 40px auto 0; }
.howto h2 { font-family: var(--font-fun); font-weight: 400; color: var(--navy); font-size: 1.8rem; margin: 0 0 10px; }
.howto ol { margin: 0; padding-left: 1.3em; }
.howto li { margin-bottom: 6px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding-block: 36px; margin-top: 40px; }
.footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.footer img { height: 40px; width: auto; }
.footer p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.footer-links a { color: var(--navy); font-weight: 600; text-decoration: none; font-size: 0.95rem; }
.footer-links a:hover { text-decoration: underline; }

@media (max-width: 560px) {
  .btn { font-size: 1.35rem; padding: 14px 22px 16px; }
  .btn-big { font-size: 1.7rem; padding: 18px 28px 20px; }
  .nav-logo img { height: 36px; }
  .section { padding-block: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .game-card, .print-card { transition: none; }
}
