/*
 * ArcadeBench site shell.
 *
 * Layout and components only. Colour, type, spacing, radii, and the few brand
 * primitives (the bench mark lockup, the double crossbar rule) come from
 * brand.css, which must be linked first.
 *
 * The catalog is deliberately quiet: warm light neutrals, one restrained rule
 * weight, and no per-game colour. Game identity belongs to the cover images, so
 * nothing here competes with the artwork. Blue is spent on the mark and on the
 * play actions. The same shell styles the launcher and the custom 404 page.
 */

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--ab-paper);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: var(--ab-paper);
  color: var(--ab-ink);
  font-size: 16px;
  font-weight: var(--ab-weight-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--ab-focus);
  outline-offset: 3px;
}

/* Keyboard escape hatch. Off-screen until focused, then pinned top-left. */
.skip-link {
  position: fixed;
  z-index: 20;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  min-height: var(--ab-target);
  padding: 0 var(--ab-space-4);
  border: 2px solid var(--ab-ink);
  border-radius: var(--ab-radius);
  background: var(--ab-surface);
  color: var(--ab-ink);
  font-size: 15px;
  font-weight: var(--ab-weight-utility);
  text-decoration: none;
  transform: translateY(-220%);
}

.skip-link:focus {
  transform: none;
}

.page-shell {
  display: flex;
  flex-direction: column;
  width: min(var(--ab-content), calc(100% - 64px));
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
}

/* Masthead: the bench mark lockup plus a short set of real, useful links.
   The double rule under it is the mark's crossbar, echoed once per page. */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 60px;
}

.wordmark {
  min-height: var(--ab-target);
}

.site-nav > p {
  margin: 0;
  color: var(--ab-ink-muted);
  font-size: 15px;
}

/* Scarce warm red: the one place the catalog admits something is wrong. */
.site-nav__route {
  font-size: 13px;
  font-weight: var(--ab-weight-utility);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.error-page .site-nav__route {
  color: var(--ab-red);
}

.site-nav__links {
  display: flex;
  align-items: center;
  gap: var(--ab-space-1);
}

.site-nav__links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--ab-target);
  padding: 0 10px;
  border-radius: var(--ab-radius-sm);
  color: var(--ab-ink-muted);
  font-size: 15px;
  text-decoration: none;
  transition: color var(--ab-transition), background-color var(--ab-transition);
}

.site-nav__links a:hover {
  background: rgba(37, 40, 36, 0.05);
  color: var(--ab-ink);
}

/* Catalog: a compact introduction, then the games themselves. */
.catalog {
  flex: 1 1 auto;
  padding: clamp(16px, 2.6vh, 30px) 0 clamp(14px, 2.2vh, 26px);
}

.catalog__intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 430px);
  align-items: end;
  gap: var(--ab-space-6);
  margin-bottom: clamp(14px, 2.2vh, 26px);
}

h1 {
  margin: 0;
  font-size: clamp(32px, 3.6vw, 44px);
  font-weight: var(--ab-weight-title);
  letter-spacing: -0.035em;
  line-height: 1.04;
}

.catalog__note {
  max-width: 460px;
  margin: 0 0 3px;
  color: var(--ab-ink-muted);
  font-size: 15px;
  line-height: 1.5;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
  outline: none;
}

.game-grid > li {
  display: flex;
  min-width: 0;
}

.game-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--ab-rule);
  border-radius: var(--ab-radius);
  background: var(--ab-surface);
}

/* The artwork is the card's identity, so it gets the full 16:9 window. */
.game-card__art {
  margin: 0;
  border-bottom: 1px solid var(--ab-rule);
  background: var(--ab-plate);
}

.game-card__art img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.game-card__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  padding: 18px 20px 20px;
}

.game-card__title {
  margin: 0;
  font-size: clamp(22px, 2vw, 26px);
  font-weight: var(--ab-weight-title);
  letter-spacing: -0.025em;
  line-height: 1.12;
}

.game-card__premise {
  margin: var(--ab-space-2) 0 0;
  color: var(--ab-ink-soft);
  font-size: 15px;
  line-height: 1.45;
}

/* Items are separated by space alone: a typed glyph would leak into the play
   link's accessible description, and a wrapped line would open with it. */
.game-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px var(--ab-space-5);
  margin: var(--ab-space-3) 0 var(--ab-space-4);
  padding: 0;
  color: var(--ab-ink-muted);
  font-size: 13px;
  line-height: 1.4;
  list-style: none;
}

.game-card__play {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ab-space-3);
  min-height: 46px;
  margin-top: auto;
  padding: 0 var(--ab-space-4);
  border: 2px solid var(--ab-blue);
  border-radius: var(--ab-radius);
  background: var(--ab-blue);
  color: var(--ab-on-blue);
  font-size: 15px;
  font-weight: var(--ab-weight-utility);
  text-decoration: none;
  transition: background-color var(--ab-transition), border-color var(--ab-transition);
}

.game-card__arrow {
  font-size: 17px;
  transition: transform var(--ab-transition);
}

.game-card__play:hover {
  background: var(--ab-blue-strong);
  border-color: var(--ab-blue-strong);
}

.game-card__play:hover .game-card__arrow {
  transform: translateX(3px);
}

/* Secondary information stays visually quieter than the games. */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ab-space-5);
  min-height: 56px;
  padding: 6px 0;
  border-top: 1px solid var(--ab-rule);
  color: var(--ab-ink-muted);
  font-size: 13px;
}

.site-footer p {
  margin: 0;
}

/* The promise carries the mark at text size: the brand's claim about itself. */
.site-footer__promise {
  display: inline-flex;
  align-items: center;
  gap: var(--ab-space-2);
}

.site-footer__mark {
  width: 15px;
  height: 15px;
  flex: none;
  fill: var(--ab-blue);
}

.site-footer nav {
  display: flex;
  align-items: center;
  gap: var(--ab-space-1);
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: var(--ab-target);
  padding: 0 10px;
  border-radius: var(--ab-radius-sm);
  text-decoration: none;
  transition: color var(--ab-transition), background-color var(--ab-transition);
}

.site-footer a:hover {
  background: rgba(37, 40, 36, 0.05);
  color: var(--ab-ink);
}

/* Custom 404 page: same shell, one quiet recovery panel. */
/* Auto block margins centre the panel between masthead and footer on tall
   viewports and collapse to the shell gap on short ones. */
body.error-page .page-shell {
  gap: 20px;
}

.error-panel {
  align-self: center;
  width: min(700px, 100%);
  margin: auto 0;
  padding: clamp(26px, 5vw, 52px);
  border: 1px solid var(--ab-rule);
  border-radius: var(--ab-radius);
  background: var(--ab-surface);
  outline: none;
}

.kicker {
  margin: 0 0 14px;
  color: var(--ab-ink-muted);
  font-size: 12px;
  font-weight: var(--ab-weight-utility);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.error-panel h1 {
  font-size: clamp(34px, 5.4vw, 54px);
}

.error-panel > p:not(.kicker) {
  max-width: 520px;
  margin: 20px 0 28px;
  color: var(--ab-ink-muted);
  font-size: 16px;
  line-height: 1.6;
}

.error-actions {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 10px;
}

.error-action {
  display: grid;
  min-height: 48px;
  padding: 0 var(--ab-space-3);
  place-items: center;
  border: 1px solid var(--ab-rule-strong);
  border-radius: var(--ab-radius);
  color: var(--ab-ink);
  font-size: 14px;
  font-weight: var(--ab-weight-utility);
  text-align: center;
  text-decoration: none;
  transition: background-color var(--ab-transition), border-color var(--ab-transition);
}

.error-action:hover {
  border-color: var(--ab-ink);
  background: rgba(37, 40, 36, 0.05);
}

.error-action--primary {
  border: 2px solid var(--ab-blue);
  background: var(--ab-blue);
  color: var(--ab-on-blue);
}

.error-action--primary:hover {
  border-color: var(--ab-blue-strong);
  background: var(--ab-blue-strong);
  color: var(--ab-on-blue);
}

@media (max-width: 900px) {
  .catalog__intro {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: var(--ab-space-3);
  }

  .catalog__note {
    margin-bottom: 0;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 40px, var(--ab-content));
  }
}

@media (max-width: 699px) {
  .page-shell {
    width: calc(100% - 32px);
  }

  .catalog {
    padding: 18px 0 20px;
  }

  .catalog__intro {
    margin-bottom: var(--ab-space-4);
  }

  .game-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .game-card__body {
    padding: var(--ab-space-4) 17px 17px;
  }

  .game-card__meta {
    margin-bottom: 14px;
  }

  .site-footer {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: var(--ab-space-1) 18px;
    padding: var(--ab-space-2) 0 var(--ab-space-3);
  }

  .site-footer nav {
    width: 100%;
    margin-left: -10px;
  }

  .error-actions {
    grid-template-columns: 1fr;
  }

  .site-nav__route {
    font-size: 12px;
    letter-spacing: 0.05em;
  }
}

/* Narrowest supported width: keep the masthead on one row, just tighter. */
@media (max-width: 360px) {
  .ab-lockup {
    gap: var(--ab-space-2);
  }

  .ab-lockup__stack {
    font-size: 12px;
  }

  .site-nav__links a {
    padding: 0 6px;
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-nav__links a,
  .site-footer a,
  .game-card__play,
  .game-card__arrow,
  .error-action {
    transition: none;
  }

  .game-card__play:hover .game-card__arrow {
    transform: none;
  }
}
