/**
 * RPG MTG Deck Showcase - EarthBound Beginnings (Mother) Theme
 *
 * Font (game font only):
 *   Earthbound Beginnings - pixel-accurate FontStruct replica of the NES game's font.
 *   It is drawn on an 8px grid, so every size here is a multiple of 8 (16, 24, 32, 48).
 *
 * Palette: NES 2C02 PPU entries. The game's menus are black with white text
 * and borders, so color is kept for accents only. The hex values follow the
 * widely used FCEUX rendering of the NES palette; the $xx index is noted on
 * each one. There is no single correct RGB NES palette, so a different emulator
 * palette may differ slightly.
 * .magicant-variant swaps to Magicant's pinks.
 */

@font-face {
  font-family: 'Earthbound Beginnings';
  src: url('Earthbound Beginnings Font.ttf') format('truetype');
  font-display: swap;
}

:root {
  --nes-black:  #000000; /* $0F */
  --nes-white:  #FCFCFC; /* $30 */
  --nes-gray:   #BCBCBC; /* $10 */
  --nes-dgray:  #747474; /* $00 */
  --nes-red:    #D82800; /* $16 */
  --nes-blue:   #0070EC; /* $11 */
  --nes-yellow: #F8B800; /* $28 */
  --nes-cream:  #F8D878; /* $38 */

  --eb1-accent: var(--nes-red);
  --eb1-window: var(--nes-black);
  --eb1-edge:   var(--nes-white);

  --eb1-font: 'Earthbound Beginnings', monospace;
}

.magicant-variant {
  --eb1-accent: #F878F8; /* $25 */
  --eb1-edge:   #F8B8F8; /* $35 */
}

/* ===== BASE ===== */
html, body {
  background: var(--nes-black);
  color: var(--nes-white);
  font-family: var(--eb1-font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: none;
  font-smooth: never;
}

button, input, select, textarea { font-family: inherit; }

/* Very faint static scanlines, every other 2px row. No motion, no color tint. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 2px,
    rgba(0, 0, 0, 0.18) 2px 4px
  );
  animation: none;
}
body::after { content: none; }

#content-wrapper {
  position: relative;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

::selection { background: var(--nes-white); color: var(--nes-black); }
:focus-visible { outline: 2px solid var(--nes-white); outline-offset: 2px; }

/* ===== THE NES WINDOW: black fill, square 2px white frame ===== */
.window-top-bar,
nav.game-nav,
header.page-header,
.search-input,
.card-modal .modal-content,
footer.page-footer {
  background: var(--eb1-window);
  color: var(--nes-white);
  border: 2px solid var(--eb1-edge);
  border-radius: 0;
  box-shadow: none;
  text-shadow: none;
}

/* ===== WINDOW BAR ===== */
.window-top-bar { margin: 8px; font-family: var(--eb1-font); font-size: 16px; }
.window-title { color: var(--nes-white); font-weight: normal; text-shadow: none; }

.window-controls button {
  font-family: var(--eb1-font);
  font-size: 16px;
  color: var(--nes-white);
  background: var(--nes-black);
  border: 2px solid var(--nes-white);
  border-radius: 0;
  box-shadow: none;
}
.window-controls button:hover { color: var(--nes-black); background: var(--nes-white); box-shadow: none; }
.volume-slider { accent-color: var(--nes-white); }

/* ===== NAVIGATION: a command menu with the NES arrow cursor ===== */
nav.game-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 32px;
  margin: 16px 0;
  padding: 16px 24px;
}

nav.game-nav a {
  position: relative;
  padding: 0 0 0 24px;
  font-family: var(--eb1-font);
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0;
  text-decoration: none;
  color: var(--nes-white);
  background: none;
  border: none;
  box-shadow: none;
  transition: none;
}

nav.game-nav a::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  border-style: solid;
  border-width: 6px 0 6px 8px;
  border-color: transparent transparent transparent var(--nes-white);
  visibility: hidden;
}
nav.game-nav a:hover::before,
nav.game-nav a:focus-visible::before,
nav.game-nav a.active::before { visibility: visible; }

nav.game-nav a:hover,
nav.game-nav a.active { color: var(--nes-white); background: none; box-shadow: none; }

/* ===== HERO ===== */
header.page-header {
  margin: 24px 0 32px;
  padding: 32px;
  position: relative;
}

/* The NES title screen used a single accent color for the logo */
header h1 {
  font-family: var(--eb1-font);
  font-size: 48px;
  font-weight: normal;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--eb1-accent);
  text-shadow: none;
  margin: 0 0 16px;
  animation: none;
}

header .subtitle {
  font-family: var(--eb1-font);
  font-size: 16px;
  color: var(--nes-white);
  margin: 0;
  animation: none;
}

header .card-count {
  display: inline-block;
  margin-top: 16px;
  font-family: var(--eb1-font);
  font-size: 16px;
  color: var(--nes-yellow);
}

/* ===== CONTROLS ===== */
.controls-section { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 32px; }
.search-box { flex: 1; min-width: 240px; }

.search-input {
  width: 100%;
  padding: 8px 16px;
  font-family: var(--eb1-font);
  font-size: 16px;
  text-transform: uppercase;
}
.search-input::placeholder { color: var(--nes-dgray); }
.search-input:focus { outline: none; border-color: var(--nes-yellow); box-shadow: none; background: var(--nes-black); }

/* ===== SECTIONS ===== */
.cards-container { display: flex; flex-direction: column; gap: 48px; }
.cards-section   { display: flex; flex-direction: column; gap: 16px; }

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 0 0 8px;
  font-family: var(--eb1-font);
  font-size: 24px;
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--nes-white);
  border-bottom: 2px solid var(--eb1-edge);
}
.section-header .count { font-family: var(--eb1-font); font-size: 16px; color: var(--nes-gray); opacity: 1; }

/* ===== CARD GRID ===== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 24px;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
}

.card-item {
  position: relative;
  aspect-ratio: 63 / 88;
  padding: 0;
  background: var(--nes-black);
  border: 2px solid var(--nes-black);
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
  transition: none;
}

.card-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.card-item:hover,
.card-item:focus-visible {
  border-color: var(--nes-white);
  background: var(--nes-black);
  box-shadow: none;
  transform: none;
}

.card-item.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  font-family: var(--eb1-font);
  font-size: 16px;
  text-transform: uppercase;
  color: var(--nes-dgray);
  border: 2px solid var(--nes-dgray);
  opacity: 1;
}
.card-item.placeholder::before { content: none; }

/* ===== MODAL ===== */
.card-modal .modal-content { padding: 24px; max-width: min(92vw, 560px); max-height: 92vh; }

.card-modal .modal-image {
  display: block;
  width: 100%;
  max-height: 68vh;
  object-fit: contain;
  margin: 0 auto 16px;
  border: none;
  image-rendering: pixelated;
}

.card-modal .modal-info h3 {
  font-family: var(--eb1-font);
  font-size: 24px;
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--nes-white);
  text-shadow: none;
  margin: 0 0 8px;
}
.card-modal .modal-info .series { font-family: var(--eb1-font); font-size: 16px; color: var(--nes-gray); }

.card-modal .modal-close {
  width: 36px;
  height: 36px;
  font-family: var(--eb1-font);
  font-size: 16px;
  color: var(--nes-white);
  background: var(--nes-black);
  border: 2px solid var(--nes-white);
  border-radius: 0;
}
.card-modal .modal-close:hover { color: var(--nes-black); background: var(--nes-white); box-shadow: none; }

.card-modal .nav-buttons { display: flex; justify-content: center; gap: 32px; margin-top: 16px; }
.card-modal .nav-buttons button {
  padding: 4px 0;
  font-family: var(--eb1-font);
  font-size: 16px;
  text-transform: uppercase;
  color: var(--nes-white);
  background: none;
  border: none;
  box-shadow: none;
}
.card-modal .nav-buttons button:hover { color: var(--nes-yellow); box-shadow: none; }

/* ===== FOOTER ===== */
footer.page-footer { margin: 64px 0 32px; padding: 24px 32px; }

footer h3 {
  font-family: var(--eb1-font);
  font-size: 24px;
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--nes-white);
  text-shadow: none;
  margin: 0 0 16px;
}
footer p { font-family: var(--eb1-font); font-size: 16px; line-height: 1.75; color: var(--nes-white); }

.cta-button {
  padding: 8px 24px;
  font-family: var(--eb1-font);
  font-size: 16px;
  font-weight: normal;
  text-transform: uppercase;
  color: var(--nes-black);
  background: var(--nes-white);
  border: 2px solid var(--nes-white);
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
}
.cta-button:hover,
.cta-button:focus-visible {
  color: var(--nes-white);
  background: var(--nes-black);
  box-shadow: none;
  transform: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  header.page-header { padding: 24px 20px; }
  header h1 { font-size: 32px; }
  .section-header { font-size: 16px; }
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 16px; }
}

@media (max-width: 480px) {
  nav.game-nav { gap: 8px 16px; padding: 12px; }
  header h1 { font-size: 24px; }
  .cards-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  footer.page-footer { padding: 16px 20px; }
}
