/* =========================================================
   Retro Gamer Grid Edition
   ========================================================= */

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

:root {
  --rg-font-display: 'Bebas Neue', 'Arial Narrow', sans-serif;
  --rg-font-body: 'Inter', system-ui, sans-serif;
  --rg-bg: #0d0d0d;
  --rg-surface: #161616;
  --rg-border: rgba(255,255,255,0.08);
  --rg-text: #e8e8e8;
  --rg-muted: #888;
}

html { scroll-behavior: smooth; }

body {
  background: var(--rg-bg);
  color: var(--rg-text);
  font-family: var(--rg-font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  overscroll-behavior-y: none;
}

/* ── Loading ── */
.rg-loading {
  position: fixed;
  inset: 0;
  background: var(--rg-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.rg-loading-inner {
  font-family: var(--rg-font-display);
  font-size: 2rem;
  letter-spacing: 0.1em;
  color: var(--rg-muted);
}

/* ── Cover Story ── */
.rg-cover {
  position: relative;
  width: 100%;
  height: 62vh;
  min-height: 400px;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  display: block;
}

.rg-cover__bg {
  position: absolute;
  inset: -15% 0;
  background-size: cover;
  background-position: center;
  will-change: transform;
}

.rg-cover__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(0,0,0,0.88) 0%,
    rgba(0,0,0,0.65) 50%,
    rgba(0,0,0,0.18) 100%
  );
}

.rg-cover__content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  padding: 2.5rem clamp(1.5rem, 5vw, 4rem);
  align-items: center;
}

.rg-cover__left {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 540px;
}

.rg-cover__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.rg-cover__badge-rule {
  display: block;
  width: 28px;
  height: 4px;
}

.rg-cover__badge-label {
  font-family: var(--rg-font-display);
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  color: #fff;
  opacity: 0.9;
}

.rg-cover__title {
  font-family: var(--rg-font-display);
  font-size: clamp(3rem, 7vw, 6rem);
  line-height: 0.95;
  letter-spacing: 0.02em;
  color: #fff;
}

.rg-cover__tagline {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.78);
  line-height: 1.4;
}

.rg-cover__highlights {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.rg-cover__highlights li {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.65);
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.rg-cover__highlights li::before {
  content: '›';
  font-size: 1rem;
  line-height: 1.3;
  flex-shrink: 0;
}

.rg-cover__key-works {
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.rg-cover__key-work {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  padding: 0.2rem 0.55rem;
  white-space: nowrap;
}

.rg-cover__right {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  height: 70%;
  max-width: 200px;
}

.rg-cover__img {
  flex: 1;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(255,255,255,0.05);
}

.rg-cover__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Section Headers ── */
.rg-section {
  padding: 3rem clamp(1rem, 4vw, 3.5rem) 2rem;
}

.rg-section__header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--rg-border);
  transform: translateX(-40px);
  opacity: 0;
}

.rg-section__rule {
  display: block;
  width: 6px;
  height: 42px;
  border-radius: 2px;
  flex-shrink: 0;
}

.rg-section__label {
  font-family: var(--rg-font-display);
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  letter-spacing: 0.06em;
  color: #fff;
  line-height: 1;
}

.rg-section__count {
  font-family: var(--rg-font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--rg-muted);
  background: var(--rg-surface);
  border: 1px solid var(--rg-border);
  border-radius: 20px;
  padding: 0.2rem 0.7rem;
  margin-left: auto;
}

/* ── Cards Grid ── */
.rg-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

/* ── Card ── */
.rg-card {
  background: var(--rg-surface);
  border-radius: 6px;
  overflow: hidden;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(30px);
  cursor: pointer;
  position: relative;
}

.rg-card__band {
  height: 6px;
  flex-shrink: 0;
  transition: height 0.2s;
}

.rg-card__image {
  position: relative;
  height: 180px;
  overflow: hidden;
  background: #111;
}

.rg-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.rg-card__image-fade {
  position: absolute;
  inset: auto 0 0;
  height: 60px;
}

.rg-card__body {
  padding: 0.9rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
}

.rg-card__name {
  font-family: var(--rg-font-display);
  font-size: 1.25rem;
  letter-spacing: 0.03em;
  line-height: 1.1;
  color: #fff;
}

.rg-card__pages {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.6rem;
  margin-top: 0.1rem;
}

.rg-card__page-link {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--rg-muted);
  text-decoration: none;
  transition: color 0.15s;
  line-height: 1.2;
}

.rg-card__page-link:hover { color: #fff; }

.rg-card__page-link + .rg-card__page-link::before {
  content: '·';
  margin-right: 0.5rem;
  opacity: 0.4;
}

.rg-card__border-bottom {
  height: 1px;
  margin: 0;
}

/* ── Footer ── */
.rg-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2.5rem 1rem 3rem;
  margin-top: 1rem;
}

.rg-footer-link {
  font-size: 0.8rem;
  color: var(--rg-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.rg-footer-link:hover { color: var(--rg-text); }

.rg-footer-sep {
  color: var(--rg-border);
  font-size: 0.9rem;
}

/* ── Scroll hint on mobile ── */
.rg-scroll-hint {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 100%;
  background: linear-gradient(to right, transparent, rgba(13,13,13,0.6));
  pointer-events: none;
  display: none;
}

/* ── Responsive ── */
@media (max-width: 1100px) {
  .rg-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .rg-cover__right { display: none; }
  .rg-cover__content { grid-template-columns: 1fr; }
  .rg-cover__left { max-width: 100%; }

  .rg-section { padding: 2rem 1rem 1.5rem; }

  .rg-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 0.85rem;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .rg-grid::-webkit-scrollbar { display: none; }

  .rg-card {
    flex-shrink: 0;
    width: 72vw;
    scroll-snap-align: start;
  }

  .rg-section__container { position: relative; }
  .rg-scroll-hint { display: block; }
}

@media (max-width: 460px) {
  .rg-card { width: 82vw; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .rg-card, .rg-section__header {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .rg-cover__bg { will-change: auto; }
}
