@font-face { font-family: 'ZX ROM';         src: url('../fonts/zxrom.woff2') format('woff2');             font-weight: 400; font-display: block; }
@font-face { font-family: 'Press Start 2P'; src: url('../fonts/PressStart2P.woff2') format('woff2');      font-weight: 400; font-display: swap; }
@font-face { font-family: 'Space Mono';     src: url('../fonts/SpaceMono-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Space Mono';     src: url('../fonts/SpaceMono-Bold.woff2') format('woff2');    font-weight: 700; font-display: swap; }

:root {
  --bg:        #07111f;
  --panel:     #0c1d33;
  --panel-hi:  #11284a;
  --line:      #1d3d66;
  --blue:      #006699;   /* esxdos.org page blue */
  --blue-dk:   #003366;
  --blue-md:   #004477;
  --accent:    #66ccff;   /* esxdos.org link */
  --accent-hi: #ffffff;
  --text:      #d6e2ef;
  --muted:     #8ea6c0;
  --zx-red:    #d70000;
  --zx-yellow: #d7d700;
  --zx-green:  #00d700;
  --zx-cyan:   #00d7d7;
  --shot-w:    256px;     /* 1:1 Spectrum pixels; sources are 2x for HiDPI */
  --title-w:   230px;
}

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

html { background: var(--bg); }

body {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.6 'Space Mono', 'Courier New', monospace;
  font-variant-ligatures: none;
}

a         { color: var(--accent); text-decoration: none; }
a:hover,
a:focus-visible { color: var(--accent-hi); }
a:focus-visible { outline: 2px dashed var(--accent); outline-offset: 3px; }

hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }

/* ---- masthead -------------------------------------------------------- */

.masthead { text-align: center; padding: 48px 0 0; }

/* ZX ROM glyphs are 8x8: keep the size a multiple of 8px so every Spectrum pixel is whole */
.title {
  margin: 0;
  font: 400 64px/1.2 'ZX ROM', monospace;

  -webkit-font-smoothing: none;
  font-smooth: never;
}
.title a { color: var(--text); }
.title a:hover { color: var(--accent-hi); }

.stripe {
  display: flex;
  justify-content: center;
  margin: 22px auto 0;
  transform: skewX(-45deg);
}
.stripe i { width: 26px; height: 10px; }
.stripe i:nth-child(1) { background: var(--zx-red); }
.stripe i:nth-child(2) { background: var(--zx-yellow); }
.stripe i:nth-child(3) { background: var(--zx-green); }
.stripe i:nth-child(4) { background: var(--zx-cyan); }

.byline { margin: 14px 0 0; color: var(--muted); font-size: 13px; letter-spacing: 1px; }

/* ---- menu ------------------------------------------------------------ */

.menu {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  margin: 30px 0 12px;
  background: var(--blue);
  border-top: 2px solid var(--accent);
  border-bottom: 2px solid var(--blue-dk);
  font: 400 15px/1 'Press Start 2P', monospace;
}
.menu a {
  padding: 14px 26px;
  color: #ffffff;
}
.menu a:hover,
.menu a:focus-visible { background: var(--blue-md); color: var(--accent); outline-offset: -4px; }
.menu a[aria-current="page"] { background: var(--blue-dk); color: var(--accent); }

/* ---- intro ----------------------------------------------------------- */

.intro { text-align: justify; }
.intro b { color: #ffffff; }

/* ---- list ------------------------------------------------------------ */

.cat-title {
  margin: 0 0 18px;
  font: 400 18px/1.4 'Press Start 2P', monospace;
  color: var(--accent);
}

.app {
  display: grid;
  grid-template-columns: var(--title-w) 1fr var(--shot-w);
  gap: 28px;
  padding: 20px;
  margin-bottom: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
}
.app:hover { background: var(--panel-hi); border-left-color: var(--accent); }

.app-name { margin: 0; font: 700 19px/1.3 'Space Mono', monospace; }
.app-name a { color: var(--accent); }
.app-name a:hover { color: var(--accent-hi); }
.app-name .dl {
  display: inline-block;
  margin-left: 6px;
  font-size: 13px;
  vertical-align: 2px;
}

.app-meta { margin: 10px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 13px; }
.app-meta li + li { margin-top: 2px; }

.app-desc { text-align: justify; }
.app-desc p { margin: 0 0 0.9em; }
.app-desc p:last-child { margin-bottom: 0; }
.app-desc .links { font-size: 13px; }

.shots { display: flex; flex-direction: column; gap: 8px; }
.shots img,
.shots .noshot {
  width: var(--shot-w);
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
}
.shots img { display: block; object-fit: contain; background: #000; cursor: zoom-in; }
.shots img:hover { border-color: var(--accent); }

.noshot {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,0.025) 3px 4px),
    #000;
  color: #2a5584;
  font: 400 10px/1 'Press Start 2P', monospace;
}

.empty { color: var(--muted); }

/* ---- lightbox -------------------------------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(3, 8, 16, 0.92);
  cursor: zoom-out;
  overflow: hidden;
  overscroll-behavior: contain;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border: 2px solid var(--blue);
  image-rendering: pixelated;
  transition: transform 0.08s ease-out;
}

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

.foot {
  margin-top: 40px;
  padding: 18px 0 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* ---- narrow screens -------------------------------------------------- */

@media (max-width: 760px) {
  .title { font-size: 48px; }
}

@media (max-width: 480px) {
  .title { font-size: 32px; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr var(--shot-w); }
  .app-head { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .intro, .app-desc { text-align: left; }
  .menu { font-size: 11px; }
  .menu a { padding: 12px 12px; }
  .app { grid-template-columns: 1fr; gap: 16px; padding: 16px; }
  .shots { flex-direction: row; overflow-x: auto; }
  .shots img, .shots .noshot { width: 70vw; max-width: var(--shot-w); flex: none; }
}
