/* =================================================================
   Arcade Timelines — styles.css (shared by both pages)
   ================================================================= */

/* ---- COLORS + FONT ----------------------------------------------
   These are the starting colors (Retro Arcade). theme.js replaces
   them when a theme loads, so every color below can change. */
:root {
  --app-bg: #000000;
  --border-color: #243cff;
  --link-color: #ff4aa8;
  --ui-muted: #1ea0ff;
  --text-primary: #ffe36b;
  --surface: #020214;
  --font: "Press Start 2P", "Courier New", monospace;
  /* script.js recomputes this against the current --app-bg every time
     a theme loads, so it's always legible. */
  --footer-warning-color: #ff3b3b;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Anything with the hidden attribute is really hidden, even when a
   rule below gives it a display value. */
[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  background: var(--app-bg);
  color: var(--text-primary);
  font-family: var(--font);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---- THE NEON FRAME (the double lines around the page) ---------- */
.arcade-frame {
  flex: 1;
  /* Always a full viewport tall (minus the body's own padding), even
     though the footer below it pushes total page height past 100vh
     and requires a scroll — the frame itself never gets compressed. */
  min-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  border: 4px solid var(--border-color);
  border-radius: 22px;
  padding: 26px 32px 32px;
  box-shadow:
    inset 0 0 0 4px var(--app-bg),
    inset 0 0 0 8px var(--border-color);
}

/* ---- NEON LOGO ---------------------------------------------------- */
.site-header {
  text-align: center;
}

.neon-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  line-height: 1;
}

.neon-logo:focus {
  outline: none;
}

.neon-logo__arcade {
  font-size: 34px;
  color: var(--text-primary);
  text-shadow: 0 0 14px color-mix(in srgb, var(--text-primary) 55%, transparent);
}

.neon-logo__timelines {
  font-size: 34px;
  color: var(--ui-muted);
  text-shadow: 0 0 14px color-mix(in srgb, var(--ui-muted) 60%, transparent);
}

/* ---- CREDITS LOOP -------------------------------------------------
   All the .credit items sit in the same spot. script.js shows one at
   a time by adding and removing the .is-showing class. */
.credits {
  display: flex;
  justify-content: center;
}

.credits__rotator {
  position: relative;
  width: 520px;
  max-width: 60vw;
  height: 48px;
}

.credit {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s;
}

.credit.is-showing {
  opacity: 1;
  visibility: visible;
}

.credit--insert {
  font-size: 15px;
  letter-spacing: 3px;
  color: var(--link-color);
  text-shadow: 0 0 12px color-mix(in srgb, var(--link-color) 60%, transparent);
}

.credit--insert.is-showing {
  animation: insert-coin-flash 0.8s step-end infinite;
}

.credit--version {
  font-size: 10px;
  letter-spacing: 1px;
}

.credit-logo img {
  max-height: 100%;
  /* Wide banner logos stop at 280px so they all look a similar size. */
  max-width: min(280px, 100%);
  display: block;
}

.credit-logo:hover img {
  filter: brightness(1.15);
}

/* ---- TAB BUTTONS --------------------------------------------------- */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}

.tab {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 11px;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  background: transparent;
  border: 3px solid;
  border-radius: 8px;
  min-block-size: 32px;
  padding: 5px 12px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.tab--decade {
  inline-size: 78px;
  border-color: var(--ui-muted);
  color: var(--ui-muted);
}

/* The wide button's label ("ARCADE TIMELINES") must stay on one line,
   so the button is sized to the text instead of letting it wrap. */
.tab--systems {
  inline-size: auto;
  min-inline-size: 152px;
  padding-inline: 14px;
  font-size: 9px;
  line-height: 1.05;
  text-transform: uppercase;
  white-space: nowrap;
  border-color: var(--link-color);
  color: var(--link-color);
}

/* The "?" help button, square-ish, to the right of the other tabs. */
.tab--help {
  inline-size: 40px;
  min-inline-size: 40px;
  border-color: var(--text-primary);
  color: var(--text-primary);
  font-size: 13px;
}

.tab--help.is-active {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: var(--app-bg);
  box-shadow: 0 0 16px color-mix(in srgb, var(--text-primary) 60%, transparent);
}

.tab:hover {
  background: color-mix(in srgb, var(--ui-muted) 14%, transparent);
}

.tab--decade.is-active {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: var(--app-bg);
  box-shadow: 0 0 16px color-mix(in srgb, var(--text-primary) 60%, transparent);
}

.tab--systems.is-active {
  background: var(--link-color);
  border-color: var(--link-color);
  color: var(--app-bg);
  box-shadow: 0 0 16px color-mix(in srgb, var(--link-color) 60%, transparent);
}

/* ---- GAMES GRID (main page) ------------------------------------------
   The 70s/80s tabs each show a grid of game tiles here. script.js fills
   .games-grid with one .game-tile per entry in data/games.json. */
.games-wrap {
  flex: 1;
  min-height: 0;
  border: 4px solid var(--border-color);
  border-radius: 14px;
  background: color-mix(in srgb, var(--app-bg) 86%, var(--border-color));
  overflow: auto;
  padding: 28px;
}

.games-grid {
  display: grid;
  /* Tiles are at least 160px wide and share the extra space evenly. */
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px;
}

/* Each tile is a square: the screenshot as the background, the game
   name at the top, and the year badge in the bottom-right corner. */
.game-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  display: block;
  border: 3px solid var(--ui-muted);
  border-radius: 10px;
  overflow: hidden;
  background-color: var(--surface);
  background-size: cover;
  background-position: center;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.game-tile:hover {
  border-color: var(--text-primary);
  box-shadow: 0 0 16px color-mix(in srgb, var(--text-primary) 45%, transparent);
}

.game-tile__name {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 6px 8px;
  font-size: 10px;
  color: var(--text-primary);
  background: color-mix(in srgb, var(--app-bg) 55%, transparent);
  text-shadow: 0 0 6px color-mix(in srgb, var(--app-bg) 80%, transparent);
}

.game-tile__year {
  position: absolute;
  bottom: 6px;
  right: 6px;
  padding: 3px 6px;
  font-size: 9px;
  color: var(--link-color);
  background: color-mix(in srgb, var(--app-bg) 55%, transparent);
  border-radius: 4px;
}

/* ---- SCREENSHOT PREVIEW (hover) ---------------------------------------
   Shown by script.js while the mouse is over a game tile: an enlarged
   copy of that tile's screenshot, centered over the whole page. */
.screenshot-overlay {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, var(--app-bg) 78%, transparent);
  /* So it never steals the mouseleave event from the tile underneath. */
  pointer-events: none;
}

.screenshot-overlay__img {
  max-width: min(80vw, 720px);
  max-height: 80vh;
  border: 4px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 0 30px color-mix(in srgb, var(--border-color) 50%, transparent);
}

/* ---- SITE FOOTER (legal / credits) -------------------------------------
   --footer-warning-color is set by script.js: red by default, black
   whenever red wouldn't be legible against the current theme's --app-bg. */
.site-footer {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.site-footer__warning {
  color: var(--footer-warning-color);
  font-size: 9px;
  line-height: 1.7;
  letter-spacing: 0.5px;
  text-align: center;
  margin-bottom: 14px;
}

.site-footer__credit {
  font-size: 8px;
  line-height: 1.9;
  letter-spacing: 0.3px;
  text-align: center;
  color: color-mix(in srgb, var(--ui-muted) 45%, var(--text-primary));
}

.site-footer__credit a {
  color: var(--link-color);
}

.site-footer__spacer {
  height: 10px;
}

.site-footer__copyright {
  font-size: 8px;
  letter-spacing: 0.3px;
  text-align: center;
  color: color-mix(in srgb, var(--ui-muted) 45%, var(--text-primary));
}

/* ---- HELP PANEL --------------------------------------------------------
   Centered on screen over everything. The steps reveal one at a time. */
.help-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, var(--app-bg) 78%, transparent);
}

.help-panel {
  max-width: 720px;
  max-height: 80vh;
  overflow: auto;
  padding: 30px 36px;
  border: 4px solid var(--border-color);
  border-radius: 14px;
  background: color-mix(in srgb, var(--app-bg) 92%, var(--border-color));
  box-shadow: 0 0 24px color-mix(in srgb, var(--border-color) 45%, transparent);
  text-align: left;
  font-weight: 700;
}

.help-intro {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 11px;
  line-height: 1.9;
  color: var(--text-primary);
  margin-bottom: 24px;
}

.help-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.help-step {
  font-size: 10px;
  line-height: 1.8;
  color: color-mix(in srgb, var(--ui-muted) 40%, var(--text-primary));
  /* Starts invisible; script.js adds .is-revealed one step at a time. */
  opacity: 0;
  transform: translateX(-12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.help-step.is-revealed {
  opacity: 1;
  transform: none;
}

.help-step a {
  color: var(--link-color);
}

/* ---- ANIMATIONS -------------------------------------------------------- */
@keyframes insert-coin-flash {
  0%   { opacity: 1; }
  50%  { opacity: 0; }
  100% { opacity: 1; }
}

/* ---- SMALL SCREENS ------------------------------------------------------ */
@media (max-width: 640px) {
  body {
    padding: 10px;
  }

  .arcade-frame {
    min-height: calc(100vh - 20px);
    padding: 20px 16px 22px;
  }

  .neon-logo__arcade,
  .neon-logo__timelines {
    font-size: 22px;
  }

  .tab {
    font-size: 9px;
    min-block-size: 28px;
    padding: 4px 8px;
  }

  .tab--decade {
    inline-size: 68px;
  }

  .tab--systems {
    inline-size: auto;
    min-inline-size: 126px;
    padding-inline: 10px;
    font-size: 8px;
  }

  .credits__rotator {
    max-width: 55vw;
  }
}

.thumbnail{
  width: 100px;
  height: auto;
}
.thumbnail:hover {
    border-radius: 10px;
    transform: scale(5.0);
}
