/*
  caxco93 games

  The look: a dark workbench ("desk") with cream paper cards lying on it. Paper things get ink
  outlines and hard shadows; buttons are chunky keycaps; small labels are set in a pixel font.
*/

/* --- fonts (self-hosted, so the page makes no third-party requests) -------- */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("assets/fonts/bricolage-grotesque.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

@font-face {
  font-family: "Silkscreen";
  src: url("assets/fonts/silkscreen-regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Silkscreen";
  src: url("assets/fonts/silkscreen-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

/* --- tokens ----------------------------------------------------------------- */

:root {
  --desk: #16131f;
  --desk-raised: #1f1b2c;
  --desk-line: #383150;
  --chalk: #f3ecdc; /* text on the desk */
  --chalk-soft: #aea6c1;

  --paper: #f3ecdc;
  --paper-shade: #e4d8bf;
  --ink: #17131f; /* text, outlines and shadows on paper */
  --ink-soft: #524b62;

  --yellow: #ffcc33;
  --yellow-deep: #c2940f;
  --tomato: #ff5b45;
  --mint: #5ee6a8;

  --font-body: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-pixel: "Silkscreen", ui-monospace, "SF Mono", Menlo, monospace;

  --outline: 2.5px solid var(--ink);
  --gutter: clamp(20px, 4vw, 40px);
  --focus: var(--yellow);
}

/* --- base ------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  background-color: var(--desk);
  /* A cutting-mat grid of dots, and a glow where the lamp would be. */
  background-image:
    radial-gradient(60rem 28rem at 50% -8rem, rgba(124, 92, 255, 0.2), transparent 70%),
    radial-gradient(circle at 1px 1px, rgba(243, 236, 220, 0.075) 1px, transparent 0);
  background-size: auto, 28px 28px;
  background-repeat: no-repeat, repeat;
  color: var(--chalk);
  font: 400 1.0625rem/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Film grain over everything, so flat colours feel printed rather than digital. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

img,
video {
  height: auto;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
}

::selection {
  background: var(--yellow);
  color: var(--ink);
}

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

.wrap {
  width: min(1120px, 100% - 2 * var(--gutter));
  margin-inline: auto;
}

.icon {
  width: 1em;
  height: 1em;
  flex: none;
  fill: currentColor;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

/* --- keycap buttons --------------------------------------------------------- */

/* A key has a face and a side; pressing it pushes the face down over the side. */
.key {
  --face: var(--yellow);
  --side: var(--yellow-deep);
  --travel: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55em;
  padding: 0.75em 1.2em;
  border: var(--outline);
  border-radius: 12px;
  background: var(--face);
  box-shadow:
    0 var(--travel) 0 var(--side),
    0 var(--travel) 0 2.5px var(--ink);
  color: var(--ink);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.2;
  text-decoration: none;
  transition:
    transform 0.08s ease-out,
    box-shadow 0.08s ease-out,
    filter 0.15s;
}

.key:hover {
  filter: brightness(1.06);
}

.key:active {
  transform: translateY(calc(var(--travel) - 1px));
  box-shadow:
    0 1px 0 var(--side),
    0 1px 0 2.5px var(--ink);
}

.key--paper {
  --face: #fffaf0;
  --side: #cbbf9f;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 24px;
}

/* --- header ----------------------------------------------------------------- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-block: 22px;
}

.brand a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-name {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-tag {
  padding: 3px 7px 4px;
  border-radius: 6px;
  background: var(--chalk);
  color: var(--ink);
  font: 700 0.7rem/1 var(--font-pixel);
  text-transform: uppercase;
}

/* --- featured game ---------------------------------------------------------- */

.featured {
  padding-top: clamp(64px, 9vw, 112px);
}

.feature-card {
  --focus: var(--ink);
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  grid-template-areas:
    "media body"
    "facts body"
    "cast cast";
  gap: clamp(22px, 3vw, 38px);
  padding: clamp(16px, 2.6vw, 30px);
  border: var(--outline);
  border-radius: 24px;
  background: var(--paper);
  box-shadow:
    0 10px 0 #0a0810,
    0 40px 70px -30px rgba(0, 0, 0, 0.75);
  color: var(--ink);
}

.feature-media {
  grid-area: media;
  position: relative;
  align-self: start;
}

.media-frame {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: var(--outline);
  border-radius: 14px;
  background: #120f1a;
  box-shadow: 6px 6px 0 var(--ink);
  transition:
    transform 0.2s ease-out,
    box-shadow 0.2s ease-out;
}

.media-frame:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 var(--ink);
}

.media-frame img,
.media-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The clip sits over the cover and fades in while it plays. */
.media-frame video {
  opacity: 0;
  transition: opacity 0.3s;
}

.is-playing .media-frame video {
  opacity: 1;
}

.sticker {
  position: absolute;
  top: -14px;
  left: -12px;
  padding: 6px 11px 7px;
  border: var(--outline);
  border-radius: 9px;
  background: var(--tomato);
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  font: 700 0.85rem/1 var(--font-pixel);
  text-transform: uppercase;
  transform: rotate(-8deg);
}

.preview-toggle {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px 8px;
  border: 2px solid var(--ink);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink);
  font: 700 0.72rem/1 var(--font-pixel);
  text-transform: uppercase;
  cursor: pointer;
}

.preview-toggle[hidden] {
  display: none;
}

.preview-toggle:hover {
  background: var(--yellow);
}

.feature-body {
  grid-area: body;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

.eyebrow {
  color: var(--ink-soft);
  font: 700 0.75rem/1 var(--font-pixel);
  text-transform: uppercase;
}

.feature-body h2 {
  margin-top: -6px;
  font-size: clamp(2.1rem, 4.4vw, 3.3rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tags li {
  padding: 4px 9px 5px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper-shade);
  font: 400 0.68rem/1 var(--font-pixel);
  text-transform: uppercase;
}

.pitch {
  font-size: 1.08rem;
}

/* Three things worth knowing, in a row under the cover. */
.facts {
  grid-area: facts;
  align-self: start;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px clamp(14px, 2vw, 24px);
  color: var(--ink-soft);
  font-size: 0.93rem;
  line-height: 1.42;
}

.facts strong {
  display: flex;
  align-items: center;
  gap: 0.45em;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.25;
}

.facts strong::before {
  content: "";
  flex: none;
  width: 0.75em;
  height: 0.75em;
  background: var(--tomato);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}

.feature-body .actions {
  margin-top: 4px;
  gap: 16px;
}

/* Shown instead of the controls where there is no keyboard to play with. */
.touch-note {
  display: none;
  padding: 8px 12px;
  border-left: 4px solid var(--tomato);
  background: var(--paper-shade);
  font-size: 0.92rem;
}

.controls {
  display: grid;
  gap: 12px;
  width: 100%;
  margin-top: 6px;
  padding: 14px 16px 16px;
  border: 2px dashed rgba(23, 19, 31, 0.28);
  border-radius: 12px;
}

.controls h3 {
  color: var(--ink-soft);
  font: 700 0.7rem/1 var(--font-pixel);
  text-transform: uppercase;
}

.controls ul {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.controls li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

@media (hover: none) and (pointer: coarse) {
  .touch-note {
    display: block;
  }

  .controls {
    display: none;
  }
}

kbd {
  min-width: 1.9em;
  padding: 4px 6px 5px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: #fffaf0;
  box-shadow: 0 2px 0 var(--ink);
  color: var(--ink);
  font: 700 0.68rem/1 var(--font-pixel);
  text-align: center;
  text-transform: uppercase;
}

/* The cast: a row of slightly crooked snapshots. */
.cast {
  grid-area: cast;
  padding-top: clamp(18px, 2.4vw, 26px);
  border-top: 2px dashed rgba(23, 19, 31, 0.28);
}

.cast h3 {
  margin-bottom: 16px;
  color: var(--ink-soft);
  font: 700 0.75rem/1 var(--font-pixel);
  text-transform: uppercase;
}

.cast ul {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 24px);
}

.cast li {
  display: grid;
  gap: 2px;
}

.cast img {
  width: 100%;
  margin-bottom: 10px;
  border: var(--outline);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--ink);
  transform: rotate(-1.6deg);
  transition: transform 0.25s cubic-bezier(0.3, 1.5, 0.5, 1);
}

.cast li:nth-child(even) img {
  transform: rotate(1.3deg);
}

.cast li:hover img {
  transform: rotate(0deg) scale(1.04);
}

.cast strong {
  font-weight: 700;
  line-height: 1.2;
}

.cast span {
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.3;
}

/* --- shelf ------------------------------------------------------------------ */

.shelf {
  padding-top: 8px;
}

.shelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
  gap: 26px;
}

.game-card {
  --focus: var(--ink);
  position: relative;
  height: 100%;
  overflow: hidden;
  border: var(--outline);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 8px 0 #0a0810;
  color: var(--ink);
  transition:
    transform 0.2s cubic-bezier(0.3, 1.4, 0.5, 1),
    box-shadow 0.2s;
}

.game-card:hover,
.game-card:focus-within {
  transform: translateY(-5px) rotate(-0.6deg);
  box-shadow: 0 13px 0 #0a0810;
}

.game-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-bottom: var(--outline);
}

.game-card-body {
  display: grid;
  gap: 10px;
  padding: 16px 18px 20px;
}

.game-card h3 {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.game-card h3 a {
  text-decoration: none;
}

/* The whole card is the link. */
.game-card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.game-card h3 a:focus-visible {
  outline: none;
}

.game-card:has(a:focus-visible) {
  outline: 3px solid var(--yellow);
  outline-offset: 4px;
}

.game-card p {
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 1.45;
}

/* An empty slot, waiting for a game. */
.slot {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 6px;
  min-height: 240px;
  padding: 24px;
  border: 2.5px dashed rgba(243, 236, 220, 0.3);
  border-radius: 18px;
  background: repeating-linear-gradient(-45deg, transparent 0 14px, rgba(243, 236, 220, 0.025) 14px 28px);
  color: var(--chalk-soft);
  text-align: center;
}

.slot--far {
  opacity: 0.6;
}

.slot-label {
  font: 400 0.75rem/1 var(--font-pixel);
  text-transform: uppercase;
}

.slot-title {
  color: var(--chalk);
  font-size: 1.2rem;
  font-weight: 700;
}

/* --- footer ----------------------------------------------------------------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  padding-block: 26px 34px;
  border-top: 1.5px solid var(--desk-line);
  color: var(--chalk-soft);
  font-size: 0.95rem;
}

.site-footer a {
  text-decoration-color: var(--yellow);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.site-footer a:hover {
  color: var(--chalk);
}

/* --- smaller screens -------------------------------------------------------- */

@media (max-width: 880px) {
  .feature-card {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "media"
      "body"
      "facts"
      "cast";
  }
}

@media (max-width: 640px) {
  /* The cast becomes a strip to swipe through. */
  .cast ul {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 132px;
    margin-inline: calc(-1 * clamp(16px, 2.6vw, 30px));
    padding: 6px clamp(16px, 2.6vw, 30px) 12px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }

  .cast li {
    scroll-snap-align: start;
  }

  .feature-body .key {
    flex: 1 1 100%;
  }

  .facts {
    grid-template-columns: minmax(0, 1fr);
  }

  /* One short empty slot is enough on a phone. */
  .slot {
    min-height: 150px;
  }

  .slot--far {
    display: none;
  }

  .media-frame {
    box-shadow: 4px 4px 0 var(--ink);
  }
}

/* --- motion preferences ----------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

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