/* bluemakes.games - one stylesheet for every page.
   A light take on Piet Mondrian: plain white pages with solid black borders, square corners,
   and red, yellow and blue used as accents (heading squares, card strips, buttons). */

:root {
  --ink: #111111;          /* text and borders */
  --paper: #ffffff;
  --muted: #555555;
  --red: #e1262c;
  --yellow: #f6c90e;
  --blue: #1d4fa0;
  --border: 3px solid var(--ink);
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --max-width: 1000px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
}

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

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

h1, h2, h3 { font-weight: 900; letter-spacing: -0.02em; line-height: 1.15; }

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px;
}

/* ---------- Header and footer ---------- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: var(--border);
  margin-bottom: 40px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 1.15rem;
  text-decoration: none;
}

.logo img { width: 40px; height: 40px; border: var(--border); }

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

.site-nav a {
  padding: 6px 10px;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 4px solid transparent;
}

/* each nav link underlines in its own colour */
.site-nav a:nth-child(1):hover { border-color: var(--red); }
.site-nav a:nth-child(2):hover { border-color: var(--yellow); }
.site-nav a:nth-child(3):hover { border-color: var(--blue); }
.site-nav a:nth-child(4):hover { border-color: var(--ink); }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 56px;
  padding-top: 16px;
  border-top: var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-logo { width: 32px; height: 32px; border: 2px solid var(--ink); }

/* social icons, pushed to the right end of the footer */
.social { display: flex; gap: 8px; margin-left: auto; }

.social a {
  display: flex;
  padding: 6px;
  border: 2px solid var(--ink);
  transition: transform 0.1s, box-shadow 0.1s;
}

.social a:hover { transform: translate(-2px, -2px); box-shadow: 3px 3px 0 var(--ink); }
.social img { width: 20px; height: 20px; }

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

.section { margin-bottom: 56px; scroll-margin-top: 16px; }

.section h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  font-size: 1.8rem;
}

/* the coloured square before each heading; set per section with style="--swatch: ..." */
.section h2::before {
  content: "";
  width: 20px;
  height: 20px;
  background: var(--swatch, var(--red));
  border: var(--border);
}

/* ---------- Steam games ---------- */

.steam-game {
  padding: 20px;
  border: var(--border);
  border-left-width: 12px;
  border-left-color: var(--red);
  margin-bottom: 16px;
}

.steam-game.upcoming { border-left-color: var(--yellow); }

.steam-game h3 { margin: 0 0 8px; font-size: 1.3rem; }
.steam-game p  { margin: 0 0 12px; }
.steam-game p:last-child { margin-bottom: 0; }

/* Steam's own store widget is 646 px wide; let it shrink on phones. */
.steam-widget {
  display: block;
  width: 100%;
  max-width: 646px;
  height: 190px;
  border: 0;
  margin-bottom: 12px;
}

/* the header-image version, only on narrow screens (see the media query below) */
.steam-image { display: none; margin-bottom: 12px; }
.steam-image img { width: 100%; max-width: 460px; height: auto; border: var(--border); }

.button.steam-button { background: var(--blue); color: var(--paper); }

/* below this width the 646px widget no longer fits in its box */
@media (max-width: 760px) {
  .steam-widget { display: none; }
  .steam-image { display: block; }
}

.coming-soon {
  display: inline-block;
  padding: 4px 10px;
  background: var(--yellow);
  border: 2px solid var(--ink);
  font-size: 0.85rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---------- Web games drop-down (the third box under Games) ---------- */

.web-games {
  border: var(--border);
  border-left-width: 12px;
  border-left-color: var(--blue);
}

.web-games summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 20px 56px 20px 20px;
  position: relative;
  cursor: pointer;
  list-style: none;            /* hide the browser's own triangle... */
}
.web-games summary::-webkit-details-marker { display: none; }   /* ...in Safari too */

.web-games summary h3 { margin: 0; font-size: 1.3rem; }
.web-games summary span { color: var(--muted); }

/* our own open/close arrow, in a little square on the right */
.web-games summary::after {
  content: "\25BE";            /* ▾ */
  position: absolute;
  right: 16px;
  top: 50%;
  translate: 0 -50%;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: var(--border);
  background: var(--yellow);
  font-size: 1.2rem;
  line-height: 1;
  transition: rotate 0.15s;
}
.web-games[open] summary::after { rotate: 180deg; }
.web-games summary:hover::after { background: var(--blue); color: var(--paper); }

.web-games .game-grid { padding: 0 20px 20px; }

/* smaller cards inside the drop-down: cover, title and Play strip only */
/* max-width keeps the cards small on wide screens: room for three 180 px cards plus padding */
.game-grid.small { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; max-width: 604px; }
.game-grid.small .info { padding: 8px 10px; }
.game-grid.small h3 { font-size: 0.95rem; margin: 0; }
.game-grid.small p { display: none; }
.game-grid.small .play { padding: 6px 10px; font-size: 0.75rem; }

/* ---------- Web game cards ---------- */

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.game-card {
  display: flex;
  flex-direction: column;
  border: var(--border);
  text-decoration: none;
  transition: transform 0.12s, box-shadow 0.12s;
}

.game-card:hover { transform: translate(-3px, -3px); box-shadow: 6px 6px 0 var(--ink); }

.game-card img {
  width: 100%;
  height: auto;           /* overrides the height="250" in the HTML, so aspect-ratio decides */
  aspect-ratio: 315 / 250;
  object-fit: cover;
  border-bottom: var(--border);
}

.game-card .info { padding: 12px 14px; flex: 1; }
.game-card h3 { margin: 0 0 4px; font-size: 1.1rem; }
.game-card p  { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* coloured "Play" strip at the bottom; the colour cycles red, yellow, blue.
   nth-of-type, not nth-child: the grid also holds a <noscript>, which nth-child would count. */
.game-card .play {
  padding: 8px 14px;
  border-top: var(--border);
  font-weight: 900;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.game-card:nth-of-type(3n+1) .play { background: var(--red); }
.game-card:nth-of-type(3n+2) .play { background: var(--yellow); }
.game-card:nth-of-type(3n+3) .play { background: var(--blue); color: var(--paper); }

/* ---------- Merch ---------- */

.merch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 280px));
  gap: 16px;
}

.merch-card { border: var(--border); display: flex; flex-direction: column; }

.merch-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  padding: 16px;
  background: #ececec;          /* light grey behind the see-through product photo */
  border-bottom: var(--border);
}

.merch-card .info { padding: 12px 14px 14px; }
.merch-card h3 { margin: 0 0 2px; font-size: 1.1rem; }
.merch-card .blurb { margin: 0 0 6px; color: var(--muted); }
.merch-card .price { margin: 0 0 12px; font-weight: 900; }
.button.buy { background: var(--red); color: var(--paper); }

/* ---------- Buttons and the newsletter form ---------- */

.signup { display: flex; flex-wrap: wrap; gap: 8px; max-width: 520px; }

.signup input {
  flex: 1 1 220px;
  padding: 10px 12px;
  border: var(--border);
  font: inherit;
}

.button,
.signup button,
.player-actions button,
.player-actions a {
  display: inline-block;
  padding: 8px 16px;
  border: var(--border);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}

.signup button { background: var(--blue); color: var(--paper); }

.button:hover,
.signup button:hover,
.player-actions button:hover,
.player-actions a:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--ink); }

.form-note { color: var(--muted); font-size: 0.9rem; }

/* Kit's signup form (drawn by Kit's script). Kit adds 56px of padding on top once the form is
   700px or wider, which left a big gap under the intro text on wide screens. Keep the form at a
   sensible width and remove that padding. !important is needed to beat Kit's own styles. */
#newsletter .formkit-form { max-width: 560px; }
#newsletter .formkit-form [data-style="clean"] { padding: 0 !important; }

/* "You're subscribed!" popup, bottom of the screen (made by js/home.js) */
.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--paper);
  border: var(--border);
  border-left: 12px solid var(--yellow);
  box-shadow: 6px 6px 0 var(--ink);
  z-index: 10;
  animation: toast-in 0.25s ease-out;
}

.toast img { width: 40px; height: 40px; border: 2px solid var(--ink); }
.toast div { flex: 1; }
.toast p { margin: 2px 0 0; font-size: 0.9rem; color: var(--muted); }
.toast button { border: 0; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; }

@keyframes toast-in { from { transform: translateY(20px); opacity: 0; } }

/* hidden on screen, still read out by screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Text pages (privacy policy) ---------- */

.prose { max-width: 680px; }
.prose h1 { font-size: 2.2rem; margin: 0 0 8px; }
.prose h2 { font-size: 1.3rem; margin: 32px 0 8px; }

/* ---------- Play page ---------- */

.player-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.back-link { margin: -16px 0 12px; font-weight: 700; }

.player-head h1 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.2rem); }
.player-actions { display: flex; gap: 8px; }
.player-actions button { background: var(--yellow); }

/* shown instead of the game on phones, for games that need a keyboard */
.computer-only-note {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border: var(--border);
  border-left-width: 12px;
  border-left-color: var(--yellow);
}

.computer-only-note img { width: 120px; border: var(--border); }
.computer-only-note div { flex: 1 1 200px; }
.computer-only-note h2 { margin: 0 0 6px; font-size: 1.3rem; }
.computer-only-note p { margin: 0; }

/* home page cards for those games, on phones: grey strip instead of a colour */
.game-card.computer-only .play { background: #dddddd !important; color: var(--muted) !important; }

.player iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;   /* replaced with the game's own shape by play.js */
  border: var(--border);
  background: var(--ink);
}
