/* Games and Fun page: "The arcade". Cream and marquee red on warm charcoal, like an old console in a dark room.
   Pixel font for headings and labels, cartridge cards, and a red-and-brass trim band as the sheet's detail. */
:root {
  --bg: #14110e;
  --bg-glow: #221b15;
  --surface: rgba(30, 26, 22, 0.94);
  --surface-strong: #1e1a16;
  --line: rgba(239, 230, 212, 0.14);
  --text: #efe6d4;
  --muted: #a99c88;
  --accent: #e9584c;
  --games: #e9584c;
  --games-2: #c9a04a;
  --coin: #c9a04a;
  --on-coin: #14110e;
  --cart: #2b2520;
  --cart-hover: #352e27;
  --cart-ridge: rgba(0, 0, 0, 0.35);
  --label-edge: #0e0c0a;
  --star: rgba(239, 230, 212, 0.7);
  --star-2: rgba(201, 160, 74, 0.8);
  --land-far: #1b1713;
  --land-near: #221d18;
  --trail: #efe6d4;
  --pixel: "Press Start 2P", ui-monospace, monospace;
  scrollbar-color: var(--cart-hover) var(--bg);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3ecdf;
    --bg-glow: #e9dcc6;
    --surface: rgba(255, 250, 242, 0.96);
    --surface-strong: #fffaf2;
    --line: rgba(60, 40, 20, 0.16);
    --text: #221c16;
    --muted: #665a4b;
    --accent: #b3261e;
    --games: #b3261e;
    --games-2: #7a5c12;
    --on-coin: #221c16;
    --cart: #d8ccb6;
    --cart-hover: #cdbfa6;
    --cart-ridge: rgba(60, 40, 20, 0.2);
    --label-edge: #4a4036;
    --star: rgba(90, 70, 50, 0.35);
    --star-2: rgba(179, 38, 30, 0.4);
    --land-far: #e6dac5;
    --land-near: #dccdb4;
    --trail: #4a4036;
  }
}

::selection {
  background: var(--games);
  color: var(--bg);
}

/* Cursor trail sits above everything but never gets in the way. */
#trail {
  position: fixed;
  inset: 0;
  z-index: 40;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.page-games h1,
.page-games h2,
.page-games h3,
.badge,
.project-codesize,
.project-date,
.pixel-button {
  font-family: var(--pixel);
  font-weight: 400;
}

/* Hero */
.arcade-hero {
  max-width: 1120px;
  margin: 0 auto;
  padding: calc(var(--header-h) + 56px) 16px 8px;
}

.arcade-hero h1 {
  width: fit-content;
  margin: 0;
  color: var(--text);
  font-size: clamp(1.6rem, 6vw, 3rem);
  line-height: 1.3;
  text-wrap: balance;
}

.arcade-hero h1 span {
  color: var(--games);
}

/* The trim band: a red stripe over a brass line with stepped pixel ends, like the trim on an old console.
   It loads in once, in pixel steps, as the page opens. */
.arcade-hero h1::after {
  content: "";
  display: block;
  height: 10px;
  margin-top: 18px;
  background: linear-gradient(var(--games) 0 6px, transparent 6px 8px, var(--coin) 8px 10px);
  clip-path: polygon(0 2px, 2px 2px, 2px 0, calc(100% - 2px) 0, calc(100% - 2px) 2px, 100% 2px,
    100% calc(100% - 2px), calc(100% - 2px) calc(100% - 2px), calc(100% - 2px) 100%,
    2px 100%, 2px calc(100% - 2px), 0 calc(100% - 2px));
  transform-origin: left center;
  animation: trim-load 0.9s steps(12) 0.15s both;
}

@keyframes trim-load {
  from { transform: scaleX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .arcade-hero h1::after {
    animation: none;
  }
}

.arcade-hero .lead {
  max-width: 56ch;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

/* Games grid */
.arcade-games {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 16px 72px;
}

.arcade-games .section-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  margin-bottom: 28px;
  color: var(--text);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.game-count {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.game-count strong {
  color: var(--coin);
  font-weight: 600;
}

@media (prefers-color-scheme: light) {
  .game-count strong {
    color: var(--games-2);
  }
}

/* Each cartridge is as tall as its own label, so opening one doesn't stretch its neighbours. */
.arcade-games .project-grid {
  align-items: start;
}

/* Cartridge cards: a charcoal plastic shell with stepped pixel corners and grip ridges on top,
   holding a label (the image and body). The label's edge turns red when the cartridge is picked up. */
.page-games .project-card {
  --card-accent: var(--games);
  position: relative;
  padding: 18px 10px 10px;
  border: none;
  border-radius: 0;
  background: var(--cart);
  clip-path: polygon(
    0 8px, 8px 8px, 8px 0,
    calc(100% - 8px) 0, calc(100% - 8px) 8px, 100% 8px,
    100% calc(100% - 8px), calc(100% - 8px) calc(100% - 8px), calc(100% - 8px) 100%,
    8px 100%, 8px calc(100% - 8px), 0 calc(100% - 8px)
  );
  transition: transform 0.2s steps(2), background-color 0.2s steps(2);
}

.page-games .project-card::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 30%;
  right: 30%;
  height: 8px;
  background: repeating-linear-gradient(90deg, var(--cart-ridge) 0 4px, transparent 4px 8px);
}

.page-games .project-card:hover,
.page-games .project-card.is-open {
  transform: translateY(-4px);
  background: var(--cart-hover);
}

.page-games .project-media,
.page-games .project-body {
  border: 4px solid var(--label-edge);
  transition: border-color 0.2s steps(2);
}

.page-games .project-media {
  border-bottom: none;
}

.page-games .project-body {
  border-top: none;
  background: var(--surface);
}

/* A card with no image is a label on its own, so it needs its top edge. */
.page-games .project-body:first-child {
  border-top: 4px solid var(--label-edge);
}

.page-games .project-card:hover :is(.project-media, .project-body),
.page-games .project-card.is-open :is(.project-media, .project-body) {
  border-color: var(--games);
}

.page-games .project-image[src$=".svg"] {
  image-rendering: pixelated;
}

.page-games .project-card h3 {
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1.6;
}

.page-games .badge {
  border-radius: 0;
  font-size: 0.55rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.page-games .tags li {
  border-radius: 0;
}

/* Pixel buttons: brass with a soft pixel bevel that presses in. */
.pixel-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: none;
  background: var(--coin);
  color: var(--on-coin);
  font-size: 0.65rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.28), inset 2px 2px 0 rgba(255, 255, 255, 0.3);
}

.pixel-button:hover {
  filter: brightness(1.08);
}

.pixel-button:active {
  translate: 0 2px;
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.28);
}

.page-games .project-toggle {
  border-radius: 0;
  border-width: 2px;
  font-family: var(--pixel);
  font-size: 0.6rem;
  line-height: 1;
  padding: 10px 12px;
}

.page-games .project-toggle:hover {
  border-color: var(--games);
}

.page-games .project-actions {
  min-height: 33px;
}

.page-games .project-codesize,
.page-games .project-date {
  font-size: 0.6rem;
}

.page-games .project-link {
  font-family: var(--pixel);
  font-size: 0.6rem;
  line-height: 1.6;
}

/* Footer secret: only a hint, the code has to be typed. */
.konami-hint {
  color: var(--muted);
  letter-spacing: 0.1em;
  opacity: 0.6;
}

/* While Star Catcher runs, the page steps back so the game in the background is visible. */
.quit-game {
  position: fixed;
  bottom: 20px;
  left: 50%;
  z-index: 30;
  display: none;
  translate: -50% 0;
}

.arcade-game-on .quit-game {
  display: inline-flex;
}

.arcade-game-on main,
.arcade-game-on .site-footer {
  opacity: 0.08;
  pointer-events: none;
  transition: opacity 0.3s steps(3);
}

@media (min-width: 720px) {
  .arcade-hero,
  .arcade-games {
    padding-left: 28px;
    padding-right: 28px;
  }
}
