/* =========================================================
   Games by Tristan - shared styles
   Used by the landing page, game page chrome, and 404 page.
   If you change this file, bump the ?v= number where it is
   linked in the HTML so browsers grab the new version.
   ========================================================= */

@font-face {
  font-family: "Bungee";
  src: url("/assets/fonts/bungee-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #10213f;        /* deep navy: text, borders, shadows */
  --ink-soft: #3a4866;   /* secondary text */
  --paper: #fff6e0;      /* warm cream page background */
  --card: #fffdf7;       /* card surface */
  --sun: #ffc83d;        /* arcade yellow */
  --red: #e5432f;        /* Santa red / tomato */
  --red-dark: #b8301f;
  --mint: #3fd6a0;       /* "ready to play" green */
  --sky: #59b7ff;        /* "new" blue */
  --blueprint: #1b4a96;

  --font-display: "Bungee", "Arial Black", Impact, system-ui, sans-serif;
  --font-body: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --border: 3px solid var(--ink);
  --radius: 18px;
  --shadow: 6px 6px 0 var(--ink);
  --shadow-big: 10px 10px 0 var(--ink);
  --wrap: 72rem;
  --gutter: clamp(1rem, 4vw, 2rem);

  color-scheme: light;
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(rgba(16, 33, 63, 0.09) 1.2px, transparent 1.6px);
  background-size: 22px 22px;
  overflow-wrap: break-word;
}

main {
  flex: 1;
}

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

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.1;
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Focus ---------- */

:focus-visible {
  outline: 4px solid var(--red);
  outline-offset: 3px;
  border-radius: 6px;
}

.on-dark :focus-visible {
  outline-color: var(--sun);
}

[tabindex="-1"]:focus {
  outline: none;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -10rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--sun);
  color: var(--ink);
  font-weight: 800;
  border: var(--border);
  border-radius: 10px;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

/* ---------- Brand mark + wordmark ---------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: inherit;
}

.brand__mark {
  width: 2.25rem;
  height: 2.25rem;
  flex: none;
}

.brand__name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  line-height: 1;
}

/* ---------- Landing hero / header ---------- */

.hero {
  position: relative;
  overflow: hidden;
  background: var(--ink);
  color: var(--paper);
  border-bottom: 6px solid var(--sun);
  padding-block: clamp(1.25rem, 3vw, 1.75rem) clamp(2.25rem, 5vw, 3.25rem);
}

/* faint scanlines for arcade-screen vibes */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.035) 0 2px,
    transparent 2px 5px
  );
  pointer-events: none;
}

.hero__inner {
  position: relative;
  display: grid;
  gap: clamp(1.5rem, 4vw, 2.25rem);
}

.hero__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.players {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.players li {
  padding: 0.3rem 0.7rem;
  border: 2px solid currentColor;
  border-radius: 999px;
}

.players li:first-child {
  color: var(--sun);
}

.players li:last-child {
  color: var(--sky);
}

.hero__body {
  display: grid;
  gap: 2rem;
  align-items: center;
}

.hero__title {
  font-size: clamp(2.4rem, 9vw, 4.75rem);
  color: var(--sun);
  text-shadow: 4px 4px 0 var(--red);
  letter-spacing: 0.01em;
}

.hero__title span {
  display: block;
}

.hero__title .small {
  font-size: 0.42em;
  color: var(--paper);
  text-shadow: 3px 3px 0 var(--red);
  margin-block: 0.15em 0.05em;
}

.hero__intro {
  margin-top: 1.25rem;
  max-width: 34rem;
  font-size: clamp(1.1rem, 2.4vw, 1.3rem);
  color: #e9ecf5;
}

.hero__art {
  display: none;
  justify-self: end;
  width: min(100%, 300px);
  transform: rotate(-8deg);
}

@media (min-width: 52rem) {
  .hero__body {
    grid-template-columns: 1fr auto;
  }

  .hero__art {
    display: block;
    animation: bob 3.2s ease-in-out infinite;
  }
}

@keyframes bob {
  0%,
  100% {
    transform: rotate(-8deg) translateY(0);
  }
  50% {
    transform: rotate(-6deg) translateY(-10px);
  }
}

.blink {
  animation: blink 1.4s steps(1, end) infinite;
}

@keyframes blink {
  50% {
    opacity: 0.15;
  }
}

/* ---------- Sections ---------- */

.section {
  padding-block: clamp(2.25rem, 5vw, 3rem);
}

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: clamp(1.5rem, 4vw, 2.25rem);
}

.section__title {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
}

.section__title::after {
  content: "";
  display: block;
  width: 3.5rem;
  height: 6px;
  margin-top: 0.6rem;
  background: var(--red);
  border-radius: 3px;
}

.section__note {
  color: var(--ink-soft);
  font-weight: 600;
}

/* ---------- Game grid + cards ---------- */

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  gap: clamp(1.25rem, 3vw, 2rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

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

.card:hover {
  transform: translate(-3px, -3px) rotate(-0.6deg);
  box-shadow: var(--shadow-big);
}

.card:focus-within {
  outline: 4px solid var(--red);
  outline-offset: 4px;
}

.card:has(.card__link:focus:not(:focus-visible)) {
  outline: none;
}

.card__thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  border-bottom: var(--border);
  background: var(--blueprint);
}

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

.card__body {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1;
  padding: 1.1rem 1.25rem 1.25rem;
}

.card__title {
  font-size: 1.45rem;
}

/* The title link stretches over the whole card, so the entire card is clickable
   but screen readers just hear the game's name. */
.card__link {
  text-decoration: none;
}

.card__link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.card__link:focus-visible {
  outline: none;
}

.card__desc {
  color: var(--ink-soft);
}

.card__cta {
  margin-top: auto;
  padding-top: 0.4rem;
  font-weight: 800;
  color: var(--red-dark);
}

.card__cta span {
  display: inline-block;
  transition: transform 0.18s ease;
}

.card:hover .card__cta span {
  transform: translateX(4px);
}

/* "Next game" tile that sits at the end of the grid */
.card--next {
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 18rem;
  padding: 2rem 1.5rem;
  text-align: center;
  background: transparent;
  border-style: dashed;
  border-color: rgba(16, 33, 63, 0.45);
  box-shadow: none;
}

.card--next:hover {
  transform: none;
  box-shadow: none;
}

.qblock {
  display: grid;
  place-items: center;
  width: 4.5rem;
  height: 4.5rem;
  background: var(--sun);
  border: var(--border);
  border-radius: 10px;
  box-shadow: 4px 4px 0 var(--ink);
  font-family: var(--font-display);
  font-size: 2.4rem;
  line-height: 1;
}

.card--next h3 {
  font-size: 1.15rem;
}

.card--next p {
  color: var(--ink-soft);
  max-width: 18rem;
}

/* ---------- Badges ---------- */

.badge {
  display: inline-block;
  padding: 0.3rem 0.65rem;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
}

.card__thumb .badge {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  transform: rotate(-4deg);
  box-shadow: 3px 3px 0 var(--ink);
}

.badge--wip {
  background: var(--sun);
}

.badge--play {
  background: var(--mint);
}

.badge--new {
  background: var(--sky);
}

/* ---------- Slim header (game pages, 404) ---------- */

.topbar {
  background: var(--ink);
  color: var(--paper);
  border-bottom: 5px solid var(--sun);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
  padding-block: 0.6rem;
}

.topbar .brand__mark {
  width: 1.9rem;
  height: 1.9rem;
}

.topbar .brand__name {
  font-size: 0.95rem;
}

/* On small phones, hide the name visually but keep it for screen readers. */
@media (max-width: 30rem) {
  .topbar .brand__name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  background: var(--sun);
  color: var(--ink);
  border: var(--border);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--ink);
  font-weight: 800;
  text-decoration: none;
  line-height: 1.2;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.on-dark .btn {
  border-color: var(--sun);
  box-shadow: 4px 4px 0 var(--red);
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
}

.on-dark .btn:hover {
  box-shadow: 6px 6px 0 var(--red);
}

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.btn--big {
  padding: 0.85rem 1.4rem;
  font-size: 1.1rem;
}

/* ---------- Game page ---------- */

.game-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  padding-block: clamp(1.5rem, 4vw, 2.5rem) clamp(1rem, 3vw, 1.5rem);
}

.game-head h1 {
  font-size: clamp(1.9rem, 7vw, 3.6rem);
  text-wrap: balance;
  text-shadow: 3px 3px 0 var(--sun);
}

.game-head__tagline {
  flex-basis: 100%;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink-soft);
}

/* The stage is the big box the game lives in. A game's own stylesheet can
   restyle it (background, size) without touching the rest of the site. */
.stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(26rem, 68vh, 44rem);
  padding: clamp(1rem, 4vw, 2.5rem);
  background: var(--stage-bg, #182a4d);
  border: 4px solid var(--ink);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow-big);
  overflow: hidden;
}

/* #game-root fills the stage; the game's canvas goes in here. */
.stage__root {
  position: absolute;
  inset: 0;
}

.stage__root:empty {
  pointer-events: none;
}

.wip-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 36rem);
  padding: clamp(1.25rem, 4vw, 2rem);
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.wip-panel .badge {
  transform: rotate(-3deg);
  box-shadow: 3px 3px 0 var(--ink);
}

.wip-panel h2 {
  margin-block: 1rem 0.75rem;
  font-size: clamp(1.3rem, 4.5vw, 1.8rem);
}

.wip-panel p + p,
.wip-panel ul + p {
  margin-top: 0.85rem;
}

.wip-panel ul {
  display: grid;
  gap: 0.5rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.wip-panel li {
  position: relative;
  padding-left: 1.9rem;
  font-weight: 600;
}

.wip-panel li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.28em;
  width: 1.05rem;
  height: 1.05rem;
  background: var(--red);
  border: 2px solid var(--ink);
  border-radius: 4px;
  transform: rotate(45deg) scale(0.8);
}

.wip-panel__sign {
  font-weight: 800;
  color: var(--red-dark);
}

/* ---------- 404 ---------- */

.lost {
  display: grid;
  justify-items: center;
  gap: 1.25rem;
  padding-block: clamp(3rem, 10vw, 6rem);
  text-align: center;
}

.lost__code {
  font-family: var(--font-display);
  font-size: clamp(5rem, 26vw, 11rem);
  line-height: 0.9;
  color: var(--sun);
  -webkit-text-stroke: 3px var(--ink);
  text-shadow: 7px 7px 0 var(--ink);
}

.lost h1 {
  font-size: clamp(1.6rem, 6vw, 2.6rem);
  color: var(--red-dark);
  text-wrap: balance;
}

.lost__text {
  max-width: 30rem;
  font-size: 1.15rem;
  color: var(--ink-soft);
}

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

.site-footer {
  margin-top: clamp(2.5rem, 6vw, 4rem);
  padding-block: 1.75rem;
  border-top: 3px solid var(--ink);
  background: var(--card);
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.site-footer strong {
  color: var(--ink);
}

/* ---------- Motion safety ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .card:hover,
  .card:hover .card__cta span,
  .btn:hover,
  .btn:active {
    transform: none;
  }
}
