/* =========================================================
   DIGIMON GAIDEN — 2026 remaster
   A CRT-terminal aesthetic built from the original palette:
   black backgrounds, red section titles, silver links,
   magenta visited-links — now responsive and readable.
   ========================================================= */

@font-face {
  font-family: 'Westminster';
  src: url('../fonts/WESTM.woff') format('woff'),
       url('../fonts/WESTM.TTF') format('truetype');
  font-display: swap;
}

:root {
  /* --- palette --- */
  --void:        #0a0a0f;
  --panel:       #14141c;
  --panel-line:  #2a1216;
  --red:         #ff2626;
  --red-deep:    #7a0f0f;
  --ink:         #e9e9ee;
  --ink-dim:     #9a9aa8;
  --link:        #c7c7d1;
  --visited:     #ff5ee0;

  /* --- type --- */
  --font-display: 'Westminster', 'Impact', 'Arial Narrow', sans-serif;
  --font-eyebrow: 'Press Start 2P', monospace;
  --font-body: 'Share Tech Mono', 'Consolas', monospace;

  --nav-width: 330px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--void);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  min-height: 100vh;
}

/* subtle CRT scanline overlay — the one signature flourish */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.025) 0px,
    rgba(255, 255, 255, 0.025) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}

@media (prefers-reduced-motion: no-preference) {
  .glow-title { animation: flicker 6s infinite; }
}

@keyframes flicker {
  0%, 92%, 100% { text-shadow: 0 0 6px rgba(255, 38, 38, 0.65), 0 0 18px rgba(255, 38, 38, 0.35); }
  93% { text-shadow: none; }
  94% { text-shadow: 0 0 6px rgba(255, 38, 38, 0.65), 0 0 18px rgba(255, 38, 38, 0.35); }
  95% { text-shadow: none; }
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--red); }
a:visited { color: var(--visited); }
a:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

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

hr {
  border: none;
  border-top: 1px solid var(--panel-line);
  margin: 1.75rem 0;
}

/* =========================
   Site shell / layout
   ========================= */

.site {
  display: grid;
  grid-template-columns: var(--nav-width) 1fr;
  min-height: 100vh;
}

/* Top bar — mobile only */
.topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 100;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  border-bottom: 1px solid var(--panel-line);
  padding: 0.75rem 1rem;
}

.topbar__brand {
  font-family: var(--font-display);
  color: var(--red);
  font-size: 1.4rem;
  letter-spacing: 0.05em;
}

.topbar__toggle {
  background: none;
  border: 1px solid var(--red-deep);
  color: var(--ink);
  font-family: var(--font-eyebrow);
  font-size: 0.6rem;
  padding: 0.5rem 0.7rem;
  cursor: pointer;
}
.topbar__toggle:hover { border-color: var(--red); color: var(--red); }

/* Sidebar nav */
.sidenav {
  background: var(--panel);
  border-right: 1px solid var(--panel-line);
  padding: 1.5rem 1.25rem 3rem;
  overflow-y: auto;
}

.sidenav__logo {
  display: block;
  margin: 0 auto 1.25rem;
  max-width: 300px;
}

.sidenav__version {
  text-align: center;
  font-family: var(--font-eyebrow);
  font-size: 0.55rem;
  color: var(--ink-dim);
  margin-bottom: 1.5rem;
  line-height: 1.8;
}
.sidenav__version span { color: var(--red); }

.sidenav h2 {
  font-family: var(--font-eyebrow);
  color: var(--red);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 1.5rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--panel-line);
}
.sidenav section:first-of-type h2 { margin-top: 0; }

.sidenav ul { list-style: none; }
.sidenav li { margin: 0.4rem 0; }

.sidenav a {
  display: block;
  font-family: var(--font-eyebrow);
  font-size: 0.58rem;
  line-height: 1.9;
  padding: 0.25rem 0.4rem;
  border-left: 2px solid transparent;
}
.sidenav a:hover,
.sidenav a[aria-current="page"] {
  color: var(--red);
  border-left-color: var(--red);
  background: rgba(255, 38, 38, 0.06);
}

/* Hidden by default so it never occupies a grid track on desktop;
   only shown (and only then positioned) once the mobile menu opens. */
.nav-scrim { display: none; }

/* Main content */
.content {
  padding: 2.5rem 3rem 4rem;
  max-width: 900px;
}
.content h1.glow-title {
  font-family: var(--font-display);
  color: var(--ink);
  font-size: clamp(2rem, 5vw, 3.2rem);
  text-align: center;
  letter-spacing: 0.03em;
  margin-bottom: 1.75rem;
}
.content h1.glow-title .accent { color: var(--red); }

.content h2.section-title {
  font-family: var(--font-display);
  color: var(--red);
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  text-align: center;
  margin: 2.5rem 0 1rem;
  letter-spacing: 0.02em;
}

.lede {
  color: var(--ink-dim);
  margin-bottom: 1.25rem;
}

.content p { margin-bottom: 1rem; }
.content p:last-child { margin-bottom: 0; }

.content strong, .content b { color: var(--ink); }

/* =========================
   Components
   ========================= */

/* Ticker (modern replacement for <marquee>) */
.ticker {
  border: 1px solid var(--red-deep);
  background: var(--panel);
  overflow: hidden;
  white-space: nowrap;
  margin-bottom: 2rem;
}
.ticker__track {
  display: inline-block;
  padding-left: 100%;
  font-family: var(--font-eyebrow);
  font-size: 0.6rem;
  color: var(--red);
  animation: ticker 22s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .ticker__track { animation: none; padding-left: 1rem; }
}
@keyframes ticker {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* News post */
.news-post {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 1.25rem;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-left: 3px solid var(--red);
  padding: 1.25rem;
  margin-bottom: 2rem;
}
.news-post__date {
  font-family: var(--font-eyebrow);
  color: var(--red);
  font-size: 0.65rem;
  line-height: 1.6;
}
@media (max-width: 640px) {
  .news-post { grid-template-columns: 1fr; }
}

/* Data tables (episode tracker, art index, digimon list) */
.table-wrap { overflow-x: auto; margin-bottom: 1.5rem; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.data caption {
  text-align: left;
  font-family: var(--font-eyebrow);
  font-size: 0.7rem;
  color: var(--ink);
  padding: 0.75rem 0 0.5rem;
}
table.data th, table.data td {
  border: 1px solid var(--panel-line);
  padding: 0.55rem 0.7rem;
  text-align: left;
}
table.data th {
  background: var(--panel);
  color: var(--red);
  font-family: var(--font-eyebrow);
  font-size: 0.6rem;
  text-transform: uppercase;
}
table.data tbody tr:hover { background: rgba(255, 38, 38, 0.05); }

/* Episode tracker grid */
.tracker { margin-bottom: 2rem; }
.tracker__title {
  font-family: var(--font-eyebrow);
  font-size: 0.65rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-left: 3px solid var(--red);
  padding: 0.6rem 0.9rem;
  margin-bottom: 0.4rem;
}
.tracker__cells {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 1.5rem;
}
.tracker__cell {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-eyebrow);
  font-size: 0.6rem;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  color: var(--ink-dim);
}
.tracker__cell.done { color: var(--red); border-color: var(--red-deep); }
.tracker__cell.empty { opacity: 0.35; }

/* Contact / team cards */
.team-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin: 1.5rem 0 2rem;
}
.team-card {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-top: 3px solid var(--red);
  padding: 1.25rem;
  text-align: center;
}
.team-card__name {
  font-family: var(--font-eyebrow);
  font-size: 0.75rem;
  color: var(--ink);
  margin-bottom: 0.4rem;
}
.team-card__alias { color: var(--ink-dim); font-size: 0.85rem; margin-bottom: 0.6rem; }
.team-card__role { color: var(--red); font-size: 0.8rem; margin-bottom: 0.75rem; }
.team-card a { font-size: 0.85rem; word-break: break-all; }

.contact-list { list-style: none; margin-bottom: 1.5rem; }
.contact-list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--panel-line);
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.contact-list b { color: var(--red); min-width: 170px; font-size: 0.9rem; }

footer.site-footer {
  text-align: center;
  font-family: var(--font-eyebrow);
  font-size: 0.55rem;
  color: var(--ink-dim);
  padding: 2.5rem 1rem;
}

/* =========================
   Digimon entry popup (modal)
   ========================= */
.modal-scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.75);
  padding: 3vh 4vw;
  overflow-y: auto;
}
.modal-scrim.is-open { display: block; }

.modal-box {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--red-deep);
  box-shadow: 0 0 40px rgba(255, 38, 38, 0.15);
}

.modal-box__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  border-bottom: 1px solid var(--panel-line);
  padding: 0.6rem 0.9rem;
}

.modal-box__label {
  font-family: var(--font-eyebrow);
  font-size: 0.6rem;
  color: var(--red);
  letter-spacing: 0.03em;
}

.modal-box__close {
  background: none;
  border: 1px solid var(--red-deep);
  color: var(--ink);
  font-family: var(--font-eyebrow);
  font-size: 0.6rem;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  line-height: 1;
}
.modal-box__close:hover { border-color: var(--red); color: var(--red); }

.modal-box__frame-wrap {
  background: #000;
}

.modal-box iframe {
  display: block;
  width: 100%;
  height: 70vh;
  border: 0;
}

@media (max-width: 640px) {
  .modal-scrim { padding: 0; }
  .modal-box { max-width: none; height: 100%; }
  .modal-box iframe { height: calc(100vh - 44px); }
}

/* =========================
   Responsive: collapse sidebar under 860px
   ========================= */
@media (max-width: 860px) {
  .site { grid-template-columns: 1fr; }
  .topbar { display: flex; }

  .sidenav {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(80vw, var(--nav-width));
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200;
    padding-top: 4.5rem;
    box-shadow: 4px 0 24px rgba(0,0,0,0.6);
  }
  .site.nav-open .sidenav { transform: translateX(0); }

  .nav-scrim {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 150;
  }
  .site.nav-open .nav-scrim { display: block; }

  .content { padding: 1.75rem 1.25rem 3rem; }
}
