/* NESd website: dark only, brand red #dd2222 */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/Inter.woff2') format('woff2');
}

:root {
  --bg: #111;
  --surface: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.1);
  --rule: #202020;
  --text: #eee;
  --text-muted: #c8c8c8;
  --text-dim: #999;
  --accent: #dd2222;
  --max-width: 1100px;
  --header-height: 3.4rem;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

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

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

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

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Header */

.page {
  position: relative;
}

.site-header {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 5;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem 1rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.site-brand {
  margin-right: auto;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--text);
  text-decoration: none;
}

.nav-links a:hover,
.site-brand:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 6px;
}

/* Hero */

.hero {
  background: linear-gradient(120deg, #0a0a0a 0%, #150a0a 45%, #3a0f0f 100%);
}

.hero .container {
  padding-top: calc(var(--header-height) + 2.5rem);
  padding-bottom: 3rem;
}

.hero-top {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 3rem;
  align-items: center;
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.accent-rule {
  width: 56px;
  height: 3px;
  margin: 1rem 0;
  background: var(--accent);
}

.tagline {
  margin-bottom: 1.5rem;
  color: var(--text-muted);
  font-size: 1.15rem;
}

.tagline-link {
  color: var(--text);
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

.downloads {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.web-card {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
}

.download-card {
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.download-card h3 {
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.card-note {
  margin-top: 0.6rem;
  color: var(--text-dim);
  font-size: 0.8rem;
  line-height: 1.45;
}

.card-note a {
  color: var(--text-muted);
}

.card-warn {
  padding-left: 0.6rem;
  border-left: 2px solid var(--accent);
  color: var(--text-muted);
}

.web-card h3,
.web-card .card-note {
  margin: 0;
}

.play-badge {
  display: block;
  width: fit-content;
  margin: 0.75rem 0;
}

.play-badge img {
  display: block;
}

.download-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.dl {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: #2a2a2a;
  color: #fff;
  border-radius: 5px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.dl:hover {
  filter: brightness(1.15);
}

.dl.primary {
  background: var(--accent);
}

.download-more {
  margin-top: 0.5rem;
}

.download-more summary {
  width: fit-content;
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
}

.download-more summary:hover {
  color: var(--text);
}

.download-more .download-links {
  margin-top: 0.5rem;
}

.release-meta {
  margin-top: 1rem;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.release-meta a {
  color: var(--text-muted);
}

.hero-logo {
  display: flex;
  justify-content: center;
}

.hero-logo img {
  width: 220px;
  height: 220px;
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.5));
}

/* Bring your own ROMs */

.rom-note {
  border-top: 1px solid var(--rule);
  background: #0d0d0d;
}

.rom-note .container {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 2.5rem;
  align-items: start;
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
}

.rom-note h2 {
  margin-bottom: 0.75rem;
  font-size: 1.35rem;
}

.rom-note p {
  margin-bottom: 0.75rem;
  color: var(--text-muted);
  max-width: 60ch;
}

.rom-note code {
  padding: 0.1em 0.35em;
  background: var(--surface);
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}

.rom-sources {
  display: grid;
  gap: 0.75rem;
}

.rom-sources li {
  padding: 0.7rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.rom-sources a {
  display: block;
  font-weight: 600;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

.rom-source-note {
  display: block;
  margin-top: 0.15rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* Screenshots */

.screenshots {
  border-top: 1px solid var(--rule);
}

.screenshots .container {
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
}

.screenshots h2 {
  margin-bottom: 1.25rem;
  font-size: 1.35rem;
}

.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  align-items: start;
  gap: 1rem;
}

.screenshot-grid .wide {
  grid-column: 1 / -1;
}

.screenshot-grid img {
  width: 100%;
  height: auto;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
}

.screenshot-caption {
  display: block;
  margin-top: 0.4rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.shot-open {
  display: block;
}

.lightbox {
  display: none;
}

.lightbox:target {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.88);
}

.lightbox img {
  position: relative;
  width: auto;
  max-width: 100%;
  max-height: 100%;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
}

/* Covers the backdrop so a click anywhere outside the image closes it. */
.lightbox-dismiss {
  position: absolute;
  inset: 0;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  color: var(--text-muted);
  font-size: 2rem;
  line-height: 1;
  text-decoration: none;
}

.lightbox-close:hover {
  color: var(--text);
}

/* Features */

.features {
  border-top: 1px solid var(--rule);
}

.features .container {
  padding-top: 2.5rem;
  padding-bottom: 3rem;
}

.features h2 {
  margin-bottom: 1.25rem;
  font-size: 1.35rem;
}

.feature-groups {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.feature-group h3 {
  margin-bottom: 0.6rem;
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.feature-list {
  display: grid;
  gap: 0.5rem;
  color: var(--text-muted);
}

.feature-list li::before {
  content: '✓ ';
  color: var(--accent);
  font-weight: 700;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--rule);
  color: var(--text-dim);
  font-size: 0.9rem;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.site-footer .legal {
  flex-basis: 100%;
  font-size: 0.8rem;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
}

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

/* Prose (privacy policy) */

.prose {
  padding-top: calc(var(--header-height) + 2rem);
  padding-bottom: 4rem;
  line-height: 1.7;
}

.prose > * {
  max-width: 70ch;
}

.prose h1 {
  margin-bottom: 1rem;
  font-size: 2rem;
}

.prose h2 {
  margin: 2rem 0 0.75rem;
  font-size: 1.35rem;
}

.prose p,
.prose ul {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.prose ul {
  padding-left: 1.25rem;
  list-style: disc;
}

.prose code {
  padding: 0.1em 0.35em;
  background: var(--surface);
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}

.prose a {
  color: var(--text);
}

/* Responsive */

@media (max-width: 900px) {
  .hero .container {
    padding-top: calc(var(--header-height) + 1.5rem);
    padding-bottom: 2.5rem;
  }

  .hero-top {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .downloads {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-logo {
    order: -1;
  }

  .web-card {
    justify-content: center;
    text-align: center;
  }

  .hero-logo img {
    width: 160px;
    height: 160px;
  }

  .accent-rule {
    margin-left: auto;
    margin-right: auto;
  }

  .download-card {
    text-align: left;
  }

  .rom-note .container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .feature-groups {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .screenshot-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .downloads {
    grid-template-columns: 1fr;
  }

  .feature-groups {
    grid-template-columns: 1fr;
  }

  .nav-links {
    gap: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
