/* ── Turrican Fan Page — Shared Stylesheet ─────────────────────── */
/* Covers: CSS custom properties, reset, nav, page-header, footer,  */
/* pixel divider, utility classes, scroll-reveal, hamburger menu,   */
/* back-to-top, reading progress bar, CRT mode, glassmorphism,      */
/* crosshair cursor, CSS parallax, prefers-reduced-motion guards.   */

/* ── Google Fonts ──────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323:wght@400&family=Courier+Prime:ital,wght@0,400;0,700;1,400&display=swap');

/* ── CSS Custom Properties ─────────────────────────────────────── */
:root {
  --bg:        #0a0a1a;
  --bg-card:   #0f0f2a;
  --blue:      #00aaff;
  --orange:    #ff6600;
  --magenta:   #cc00cc;
  --green:     #00ff44;
  --text:      #c8c8e8;
  --text-dim:  #7878a8;
  --border:    #1a1a3a;
  --font-head: 'Press Start 2P', monospace;
  --font-body: 'VT323', 'Courier Prime', 'Courier New', monospace;
}

/* ── Reset & Base ───────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.2rem;
  line-height: 1.7;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
  line-height: 1.4;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  color: var(--green);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

/* ── Crosshair cursor (fine pointer only — not touch) ──────────── */
@media (pointer: fine) {
  body {
    cursor: crosshair;
  }
  a, button, [role="button"] {
    cursor: crosshair;
  }
}

/* ── Navigation ─────────────────────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 200;
  background-color: rgba(10, 10, 26, 0.97);
  border-bottom: 2px solid var(--blue);
  padding: 0.75rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  justify-content: center;
}

nav a {
  font-family: var(--font-head);
  font-size: 0.5rem;
  color: var(--blue);
  letter-spacing: 0.05em;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--blue);
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
  display: inline-block;
}

nav a:hover,
nav a[aria-current="page"] {
  background-color: var(--blue);
  color: var(--bg);
  text-decoration: none;
  box-shadow: 0 0 8px var(--blue);
}

nav a:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* Hamburger toggle button */
.nav-hamburger {
  display: none;
  background: transparent;
  border: 2px solid var(--blue);
  color: var(--blue);
  font-family: var(--font-head);
  font-size: 0.6rem;
  padding: 0.4rem 0.8rem;
  cursor: crosshair;
  letter-spacing: 0.05em;
  transition: background 0.2s, color 0.2s;
}

.nav-hamburger:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.nav-hamburger:hover {
  background: var(--blue);
  color: var(--bg);
}

/* Nav link container (for hamburger collapse) */
#nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  justify-content: center;
}

/* Nav items with dropdowns */
.nav-item-dropdown {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 300;
  background: rgba(10, 10, 26, 0.98);
  border: 1px solid var(--blue);
  border-top: none;
  list-style: none;
  min-width: 160px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.nav-item-dropdown.dropdown-open .nav-dropdown {
  display: block;
}

.nav-dropdown a {
  display: block;
  padding: 0.4rem 0.8rem;
  border: none;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: 0.4rem;
}

.nav-dropdown a:last-child {
  border-bottom: none;
}

.nav-dropdown a.nav-section-active {
  background: rgba(0, 170, 255, 0.15);
  color: var(--green);
  border-color: var(--green);
}

/* Font-size toggle group */
.nav-font-group {
  display: inline-flex;
  gap: 0.2rem;
  align-items: center;
}

.nav-font-btn[aria-pressed="true"] {
  color: var(--green);
  border-color: var(--green);
}

/* Nav utility buttons (CRT, SFX) */
.nav-util-btn {
  font-family: var(--font-head);
  font-size: 0.4rem;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
  cursor: crosshair;
  letter-spacing: 0.04em;
  transition: color 0.2s, border-color 0.2s;
}

.nav-util-btn:hover,
.nav-util-btn:focus-visible {
  color: var(--magenta);
  border-color: var(--magenta);
  outline: none;
}

.nav-util-btn:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* Hamburger responsive */
@media (max-width: 768px) {
  .nav-hamburger {
    display: inline-block;
  }

  #nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    padding-top: 0.5rem;
  }

  #nav-links.is-open {
    display: flex;
  }

  #nav-links a,
  #nav-links .nav-util-btn {
    text-align: center;
    width: 100%;
  }

  nav {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem 1rem;
  }

  /* On mobile, dropdowns collapse inline under their parent link */
  .nav-item-dropdown {
    display: block;
    width: 100%;
  }

  .nav-dropdown {
    position: static;
    border: none;
    border-left: 2px solid var(--blue);
    padding-left: 0.5rem;
    margin-top: 0.2rem;
    box-shadow: none;
  }

  .nav-item-dropdown.dropdown-open .nav-dropdown {
    display: block;
  }

  .nav-font-group {
    justify-content: center;
    width: 100%;
  }
}

/* ── Page Header (inner pages) ──────────────────────────────────── */
.page-header {
  padding: 3rem 1.5rem 2rem;
  text-align: center;
  border-bottom: 2px solid var(--border);
}

.page-title {
  font-family: var(--font-head);
  font-size: clamp(0.7rem, 3vw, 1.2rem);
  margin-bottom: 0.75rem;
}

.page-subtitle {
  font-size: 1.3rem;
  color: var(--text-dim);
  max-width: 700px;
  margin: 0 auto;
}

/* ── Pixel Divider ─────────────────────────────────────────────── */
.pixel-divider {
  width: 100%;
  height: 4px;
  background: linear-gradient(
    to right,
    transparent,
    var(--blue) 20%,
    var(--orange) 40%,
    var(--magenta) 60%,
    var(--green) 80%,
    transparent
  );
  margin: 1.5rem 0;
}

/* ── Main container ─────────────────────────────────────────────── */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

section {
  padding: 4rem 0;
}

/* ── Section Title (utility) ────────────────────────────────────── */
.section-title {
  font-family: var(--font-head);
  font-size: clamp(0.7rem, 3vw, 1.1rem);
  color: var(--orange);
  text-shadow: 0 0 8px var(--orange);
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}

/* ── Footer ─────────────────────────────────────────────────────── */
footer {
  background: var(--bg-card);
  border-top: 2px solid var(--border);
  padding: 3rem 1.5rem;
  text-align: center;
}

.footer-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
}

.footer-title {
  font-family: var(--font-head);
  font-size: 0.55rem;
  color: var(--magenta);
  text-shadow: 0 0 6px var(--magenta);
}

.footer-disclaimer {
  font-size: 0.95rem;
  color: var(--text-dim);
  max-width: 700px;
  line-height: 1.6;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.footer-links a {
  font-family: var(--font-head);
  font-size: 0.4rem;
  color: var(--blue);
  border: 1px solid var(--blue);
  padding: 0.5rem 0.8rem;
  transition: background 0.2s, color 0.2s;
}

.footer-links a:hover {
  background: var(--blue);
  color: var(--bg);
  text-decoration: none;
}

.footer-copy {
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* ── Utility Classes ────────────────────────────────────────────── */
.neon-text {
  text-shadow:
    0 0 8px currentColor,
    0 0 20px currentColor;
}

.pixel-border {
  border: 2px solid var(--blue);
  box-shadow: 0 0 8px var(--blue), inset 0 0 8px rgba(0, 170, 255, 0.05);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ── Glassmorphism Card Variant ─────────────────────────────────── */
.card-glass {
  background: rgba(15, 15, 42, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 170, 255, 0.3);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  border-radius: 2px;
}

/* ── Breadcrumb ──────────────────────────────────────────────────── */
.breadcrumb {
  padding: 0.75rem 1.5rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-dim);
  max-width: 1400px;
  margin: 0 auto;
}

.breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.breadcrumb li + li::before {
  content: ' › ';
  color: var(--text-dim);
  margin-right: 0.25rem;
}

.breadcrumb a {
  color: var(--blue);
}

.breadcrumb [aria-current="page"] {
  color: var(--orange);
}

/* ── Scroll-Reveal ──────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ── Reading Progress Bar ───────────────────────────────────────── */
#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(to right, var(--blue), var(--magenta), var(--orange));
  z-index: 999;
  transition: width 0.1s linear;
  pointer-events: none;
}

/* ── Back to Top ────────────────────────────────────────────────── */
#back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 300;
  background: var(--bg-card);
  border: 2px solid var(--blue);
  color: var(--blue);
  font-family: var(--font-head);
  font-size: 0.45rem;
  padding: 0.6rem 0.8rem;
  cursor: crosshair;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  letter-spacing: 0.05em;
  box-shadow: 0 0 10px rgba(0, 170, 255, 0.4);
}

#back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

#back-to-top:hover {
  background: var(--blue);
  color: var(--bg);
  text-decoration: none;
}

#back-to-top:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* ── SID Mini-Player ────────────────────────────────────────────── */
#sid-player {
  position: fixed;
  bottom: 5rem;
  right: 2rem;
  z-index: 300;
  background: var(--bg-card);
  border: 2px solid var(--magenta);
  box-shadow: 0 0 12px rgba(204, 0, 204, 0.4);
  padding: 0.75rem 1rem;
  min-width: 200px;
  font-family: var(--font-head);
  font-size: 0.4rem;
}

#sid-player .sid-title {
  color: var(--magenta);
  text-shadow: 0 0 6px var(--magenta);
  margin-bottom: 0.5rem;
  font-size: 0.45rem;
}

#sid-player .sid-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

#sid-player button {
  background: transparent;
  border: 1px solid var(--magenta);
  color: var(--magenta);
  font-family: var(--font-head);
  font-size: 0.4rem;
  padding: 0.3rem 0.5rem;
  cursor: crosshair;
  transition: background 0.2s, color 0.2s;
}

#sid-player button:hover {
  background: var(--magenta);
  color: var(--bg);
}

#sid-player button:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

#sid-player .sid-track {
  color: var(--text-dim);
  font-size: 0.4rem;
  margin-top: 0.4rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
}

/* ── CRT Mode ───────────────────────────────────────────────────── */
body.crt-mode {
  animation: none;
}

body.crt-mode::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.18) 2px,
    rgba(0, 0, 0, 0.18) 4px
  );
}

body.crt-mode * {
  text-shadow: 0 0 1px rgba(0, 170, 255, 0.15);
}

/* ── Neon Glow Pulse Animation ──────────────────────────────────── */
@keyframes neon-pulse {
  0%, 100% {
    text-shadow:
      0 0 10px var(--blue),
      0 0 30px var(--blue),
      0 0 60px rgba(0, 170, 255, 0.4);
  }
  50% {
    text-shadow:
      0 0 20px var(--blue),
      0 0 60px var(--blue),
      0 0 100px rgba(0, 170, 255, 0.6),
      0 0 5px #fff;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .neon-pulse {
    animation: neon-pulse 2.5s ease-in-out infinite;
  }
}

/* ── CSS Parallax Hero ──────────────────────────────────────────── */
.parallax-hero {
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
}

@media (prefers-reduced-motion: reduce) {
  .parallax-hero {
    background-attachment: scroll;
  }
}

/* ── CSS Pixel Art Decorations ──────────────────────────────────── */
/* Pixel corner ornament using box-shadow mosaic */
.pixel-corner {
  position: relative;
}

.pixel-corner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 8px;
  height: 8px;
  background: var(--blue);
  box-shadow:
    8px 0 0 var(--blue),
    0 8px 0 var(--blue),
    16px 8px 0 var(--blue),
    8px 16px 0 var(--blue);
  pointer-events: none;
}

/* Pixel scanline decoration */
.pixel-scanlines {
  position: relative;
  overflow: hidden;
}

.pixel-scanlines::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.2) 2px,
    rgba(0, 0, 0, 0.2) 4px
  );
  z-index: 1;
}

/* ── Reduced Motion: Kill all animations ────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  /* Reveal elements immediately without animation */
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  #reading-progress {
    transition: none;
  }
}

/* ── Boot Screen ────────────────────────────────────────────────── */
#boot-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-size: 0.55rem;
  color: var(--green);
  padding: 2rem;
  text-align: center;
}

#boot-screen .boot-line {
  margin-bottom: 0.5rem;
  line-height: 2;
}

#boot-screen.hidden {
  display: none;
}

/* ── Secret Section (Konami Easter Egg) ────────────────────────── */
#secret {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(0, 0, 0, 0.92);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 2rem;
}

#secret.active {
  display: flex;
}

#secret .secret-title {
  font-family: var(--font-head);
  font-size: clamp(0.6rem, 3vw, 1rem);
  color: var(--green);
  text-shadow: 0 0 20px var(--green);
  margin-bottom: 1.5rem;
}

#secret .secret-text {
  font-family: var(--font-body);
  font-size: 1.4rem;
  color: var(--text);
  max-width: 600px;
  margin-bottom: 2rem;
}

#secret .secret-close {
  font-family: var(--font-head);
  font-size: 0.5rem;
  background: transparent;
  border: 2px solid var(--green);
  color: var(--green);
  padding: 0.6rem 1.2rem;
  cursor: crosshair;
  transition: background 0.2s, color 0.2s;
}

#secret .secret-close:hover {
  background: var(--green);
  color: var(--bg);
}

#secret .secret-close:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* ── Font-size toggle classes ────────────────────────────────────── */
/* Only scale body/paragraph text — headings (.font-head) are excluded */
body.font-size-medium {
  font-size: 1.4rem;
}

body.font-size-large {
  font-size: 1.8rem;
}

/* ── Portrait image fix ─────────────────────────────────────────── */
/* Use contain so portrait screenshots display without cropping */
.gallery-thumb img {
  object-fit: contain;
  background: var(--bg-card);
}

/* Game card cover images: contain preserves portrait aspect ratio */
.game-image-slot img {
  object-fit: contain !important;
  background: var(--bg-card);
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 600px) {
  body {
    font-size: 1rem;
  }

  main {
    padding: 0 1rem;
  }

  section {
    padding: 2.5rem 0;
  }

  #back-to-top {
    bottom: 1rem;
    right: 1rem;
  }

  #sid-player {
    bottom: 4rem;
    right: 1rem;
    min-width: 160px;
  }
}
