/* =========================================================
   1-UP Fan Hub: Unofficial Nintendo fan site
   ========================================================= */

:root {
  --red: #e60012;
  --red-dark: #b8000e;
  --red-soft: #fff0f1;
  --ink: #1b1b1f;
  --ink-2: #4a4a55;
  --muted: #6b6b76;
  --line: #ececf1;
  --bg: #ffffff;
  --bg-alt: #f7f7fa;
  --dark: #141418;
  --dark-2: #1f1f26;
  --white: #ffffff;

  --font-display: "Fredoka", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 28px;
  --shadow-sm: 0 2px 8px rgba(20, 20, 30, .06);
  --shadow: 0 10px 30px rgba(20, 20, 30, .08);
  --shadow-lg: 0 24px 60px rgba(20, 20, 30, .16);
  --ease: cubic-bezier(.22, .9, .32, 1);
  --header-h: 72px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 8px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--red); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--red-dark); }
button { font: inherit; cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; border-radius: 6px; }

.container { width: min(1200px, 100% - 32px); margin-inline: auto; }

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 1000;
  background: var(--red); color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: 700;
  transition: top .2s;
}
.skip-link:focus { top: 12px; color: #fff; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .6em;
  padding: .9em 1.6em; border-radius: 999px; border: 2px solid transparent;
  font-family: var(--font-display); font-weight: 600; font-size: 1.05rem;
  text-decoration: none; transition: transform .25s var(--ease), box-shadow .25s, background .25s, color .25s;
}
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s var(--ease); }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 10px 24px rgba(230, 0, 18, .4); }
.btn-primary:hover { background: var(--red-dark); color: #fff; transform: translateY(-3px); box-shadow: 0 16px 32px rgba(230, 0, 18, .5); }
.btn-primary:hover svg { transform: translateX(4px); }
.btn-ghost { border-color: rgba(255,255,255,.8); color: #fff; backdrop-filter: blur(6px); background: rgba(255,255,255,.08); }
.btn-ghost:hover { background: #fff; color: var(--ink); transform: translateY(-3px); }

/* ---------- Header / Nav ---------- */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 100; height: var(--header-h);
  transition: background .3s, box-shadow .3s, height .3s;
}
.site-header.scrolled {
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  box-shadow: 0 1px 0 var(--line), var(--shadow-sm);
  --header-h: 64px;
}
.nav { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }

.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.logo-badge {
  display: grid; place-items: center;
  height: 40px; padding: 0 12px; border-radius: 12px;
  background: var(--red); color: #fff; border: 2px solid #fff;
  font-family: var(--font-display); font-weight: 700; font-size: 1rem; letter-spacing: .02em;
  box-shadow: 0 4px 14px rgba(230,0,18,.45);
  transition: transform .3s var(--ease);
}
.logo:hover .logo-badge { transform: rotate(-6deg) scale(1.06); }
.logo-text { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; line-height: 1; display: flex; flex-direction: column; }
.logo-text small { font-family: var(--font-body); font-weight: 600; font-size: .7rem; opacity: .8; margin-top: 3px; letter-spacing: .04em; text-transform: uppercase; }
.scrolled .logo { color: var(--ink); }
.scrolled .logo-badge { border-color: var(--red); }

.nav-menu { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.nav-link {
  display: block; padding: 8px 14px; border-radius: 999px;
  color: #fff; text-decoration: none; font-weight: 700; font-size: .95rem;
  transition: background .2s, color .2s;
}
.nav-link:hover { background: rgba(255,255,255,.16); color: #fff; }
.nav-link.active { background: var(--red); color: #fff; }
.scrolled .nav-link { color: var(--ink-2); }
.scrolled .nav-link:hover { background: var(--red-soft); color: var(--red); }
.scrolled .nav-link.active { background: var(--red); color: #fff; }

.nav-toggle {
  display: none; width: 44px; height: 44px; border: 0; border-radius: 12px;
  background: rgba(255,255,255,.15); padding: 11px 10px; flex-direction: column; justify-content: space-between;
}
.nav-toggle span { display: block; height: 3px; border-radius: 3px; background: #fff; transition: transform .3s var(--ease), opacity .2s; }
.scrolled .nav-toggle { background: var(--red-soft); }
.scrolled .nav-toggle span { background: var(--red); }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(8.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8.5px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center; overflow: hidden; color: #fff;
  padding: calc(var(--header-h) + 40px) 0 100px;
  isolation: isolate;
}
.hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; transform: scale(1.06); animation: heroZoom 18s ease-out forwards; }
.hero-overlay {
  position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(100deg, rgba(120, 0, 10, .92) 0%, rgba(200, 0, 16, .72) 38%, rgba(20, 10, 20, .35) 75%, rgba(0,0,0,.2) 100%),
    linear-gradient(0deg, rgba(0,0,0,.5), transparent 40%);
}
.hero-content { max-width: 1200px; }
.hero-content > * { max-width: 640px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 14px; border-radius: 999px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.3);
  font-weight: 700; font-size: .85rem; letter-spacing: .03em; backdrop-filter: blur(6px);
  animation: fadeUp .8s var(--ease) both;
}
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(255,255,255,.25); animation: pulse 2s infinite; }
.hero h1 {
  font-size: clamp(2.6rem, 6.5vw, 5rem); font-weight: 700; margin: 22px 0 18px; max-width: 760px;
  text-shadow: 0 4px 30px rgba(0,0,0,.25);
  animation: fadeUp .8s .1s var(--ease) both;
}
.highlight { position: relative; display: inline-block; white-space: nowrap; }
.highlight::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: .06em; height: .16em; border-radius: 99px;
  background: #fff; transform-origin: left; animation: underline 1s .7s var(--ease) both;
}
.hero-lead { font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: rgba(255,255,255,.92); animation: fadeUp .8s .2s var(--ease) both; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; animation: fadeUp .8s .3s var(--ease) both; }

.scroll-cue {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%);
  width: 28px; height: 46px; border: 2px solid rgba(255,255,255,.8); border-radius: 20px;
}
.scroll-cue span { position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px; border-radius: 4px; background: #fff; animation: scrollCue 1.8s infinite; }

/* ---------- Stats ---------- */
.stats { position: relative; z-index: 2; margin-top: -56px; }
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden;
}
.stat { padding: 28px 20px; text-align: center; position: relative; }
.stat + .stat::before { content: ""; position: absolute; left: 0; top: 24%; bottom: 24%; width: 1px; background: var(--line); }
.stat-num { display: block; font-family: var(--font-display); font-size: clamp(1.9rem, 3.4vw, 2.6rem); color: var(--red); line-height: 1.1; }
.stat span { color: var(--muted); font-weight: 600; font-size: .95rem; }

/* ---------- Sections ---------- */
.section { padding: clamp(72px, 10vw, 120px) 0; }
.section-head { text-align: center; max-width: 720px; margin: 0 auto 48px; }
.section-kicker {
  display: inline-block; margin: 0 0 12px; padding: 5px 14px; border-radius: 999px;
  background: var(--red-soft); color: var(--red-dark); font-weight: 800; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase;
}
.section-title { font-size: clamp(2rem, 4.2vw, 3rem); font-weight: 700; }
.section-intro { color: var(--ink-2); font-size: 1.1rem; }
.section-intro .note { display: block; font-size: .9rem; color: var(--muted); margin-top: 6px; }
.sub-title { font-size: clamp(1.5rem, 3vw, 2rem); margin: 80px 0 32px; text-align: center; }
.footnote { font-size: .875rem; color: var(--muted); margin-top: 24px; }
.footnote.center { text-align: center; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(32px, 6vw, 80px); align-items: center; }
.about-text p { color: var(--ink-2); }
.about-text strong { color: var(--ink); }
.about-text .section-title { margin-bottom: .6em; }
.mission {
  display: flex; gap: 16px; margin: 28px 0 0; padding: 22px 24px;
  background: linear-gradient(135deg, var(--red), var(--red-dark)); color: #fff; border-radius: var(--radius);
  box-shadow: 0 14px 30px rgba(230,0,18,.25);
}
.mission svg { flex: none; width: 34px; height: 34px; fill: rgba(255,255,255,.85); }
.mission p { color: #fff; margin: 0; }
.mission strong { color: #fff; }

.about-media { position: relative; padding-bottom: 60px; }
.about-media figure { margin: 0; position: relative; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-lg); background: var(--bg-alt); }
.about-media img { width: 100%; height: 100%; object-fit: cover; }
.media-main { aspect-ratio: 4 / 3.4; }
.media-float {
  position: absolute !important; width: 55%; left: -8%; bottom: 0; aspect-ratio: 4 / 3;
  border: 6px solid #fff; transform: rotate(-4deg); transition: transform .4s var(--ease);
}
.media-float:hover { transform: rotate(0) scale(1.03); }
.about-media figcaption {
  position: absolute; left: 12px; bottom: 12px; padding: 4px 12px; border-radius: 999px;
  background: rgba(0,0,0,.6); color: #fff; font-size: .8rem; font-weight: 700;
}
.media-main figcaption { left: auto; right: 12px; }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.timeline li {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
  transition: transform .3s var(--ease), box-shadow .3s, border-color .3s;
}
.timeline li:hover { transform: translateY(-6px); box-shadow: var(--shadow); border-color: transparent; }
.t-year {
  display: inline-block; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
  color: #fff; background: var(--red); padding: 2px 12px; border-radius: 999px; margin-bottom: 12px;
}
.timeline h4 { font-size: 1.15rem; margin-bottom: 6px; }
.timeline p { color: var(--ink-2); font-size: .95rem; margin: 0; }

/* Facts */
.facts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.fact-card {
  padding: 26px; border-radius: var(--radius); background: var(--bg-alt); border: 1px solid transparent;
  transition: transform .3s var(--ease), background .3s, border-color .3s, box-shadow .3s;
}
.fact-card:hover { transform: translateY(-6px); background: #fff; border-color: var(--line); box-shadow: var(--shadow); }
.fact-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: #fff; font-size: 1.6rem; box-shadow: var(--shadow-sm); margin-bottom: 14px; }
.fact-card h4 { font-size: 1.15rem; margin-bottom: 6px; }
.fact-card p { color: var(--ink-2); font-size: .97rem; margin: 0; }

/* ---------- Consoles ---------- */
.consoles { background: var(--dark); color: #fff; position: relative; overflow: hidden; }
.consoles::before {
  content: ""; position: absolute; width: 700px; height: 700px; border-radius: 50%;
  background: radial-gradient(circle, rgba(230,0,18,.35), transparent 65%); top: -280px; right: -200px; pointer-events: none;
}
.consoles .section-kicker { background: rgba(230,0,18,.18); color: #ff8a93; }
.consoles .section-intro { color: rgba(255,255,255,.75); }

.tabs { display: flex; justify-content: center; gap: 6px; margin: 0 auto 40px; padding: 6px; background: var(--dark-2); border-radius: 999px; width: fit-content; max-width: 100%; }
.tab {
  border: 0; padding: 10px 22px; border-radius: 999px; background: transparent; color: rgba(255,255,255,.75);
  font-family: var(--font-display); font-weight: 600; font-size: 1rem; transition: background .25s, color .25s;
}
.tab:hover { color: #fff; }
.tab.active { background: var(--red); color: #fff; box-shadow: 0 6px 18px rgba(230,0,18,.4); }
.tab-panel[hidden] { display: none; }
.tab-panel.active { animation: fadeUp .5s var(--ease) both; }

.console-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; position: relative; }
.console-card {
  display: flex; flex-direction: column; background: var(--dark-2); border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid rgba(255,255,255,.06);
  transition: transform .35s var(--ease), box-shadow .35s, border-color .35s;
}
.console-card:hover { transform: translateY(-8px); box-shadow: 0 30px 60px rgba(0,0,0,.45); border-color: rgba(230,0,18,.5); }
.console-img { position: relative; background: #fff; aspect-ratio: 16 / 9; display: grid; place-items: center; padding: 22px; overflow: hidden; }
.console-img img { width: 100%; height: 100%; object-fit: contain; transition: transform .5s var(--ease); }
.console-card:hover .console-img img { transform: scale(1.06); }
.badge {
  position: absolute; top: 14px; left: 14px; z-index: 1; padding: 4px 12px; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
}
.badge-new { background: var(--red); }
.console-body { padding: 26px 28px 30px; display: flex; flex-direction: column; flex: 1; }
.console-year { color: #ff8a93; font-weight: 700; font-size: .85rem; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 6px; }
.console-body h3 { font-size: 1.6rem; }
.console-body > p:not(.console-year) { color: rgba(255,255,255,.78); }
.specs { list-style: none; margin: auto 0 0; padding: 18px 0 0; border-top: 1px solid rgba(255,255,255,.1); display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; font-size: .93rem; }
.specs li { color: #fff; font-weight: 600; }
.specs span { display: block; color: rgba(255,255,255,.55); font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }

.classic-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.classic-card {
  background: var(--dark-2); border-radius: var(--radius); overflow: hidden; border: 1px solid rgba(255,255,255,.06);
  transition: transform .3s var(--ease), border-color .3s;
}
.classic-card:hover { transform: translateY(-6px); border-color: rgba(230,0,18,.5); }
.classic-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; padding: 16px; transition: transform .4s var(--ease); }
.classic-card:hover img { transform: scale(1.05); }
.classic-card > div { padding: 18px 20px 22px; }
.classic-card h3 { font-size: 1.2rem; margin-bottom: 2px; }
.classic-meta { color: #ff8a93; font-weight: 700; font-size: .85rem; margin-bottom: 8px; }
.classic-card p:last-child { color: rgba(255,255,255,.75); font-size: .93rem; margin: 0; }
.consoles .footnote { color: rgba(255,255,255,.55); }

/* ---------- Games ---------- */
.games { background: var(--bg-alt); }
.games-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.game-card {
  display: flex; flex-direction: column; background: #fff; border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-sm); transition: transform .35s var(--ease), box-shadow .35s;
}
.game-card:hover { transform: translateY(-8px); box-shadow: var(--shadow-lg); }
.game-img { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #ddd; }
.game-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.game-card:hover .game-img img { transform: scale(1.08); }
.genre {
  position: absolute; left: 14px; top: 14px; padding: 4px 12px; border-radius: 999px;
  background: rgba(255,255,255,.95); color: var(--red-dark); font-size: .75rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
}
.game-body { padding: 24px 26px 26px; display: flex; flex-direction: column; flex: 1; }
.game-body h3 { font-size: 1.45rem; }
.game-body > p { color: var(--ink-2); font-size: .98rem; }
.game-meta { margin: auto 0 0; padding-top: 16px; border-top: 1px dashed var(--line); display: grid; gap: 8px; font-size: .9rem; }
.game-meta div { display: flex; justify-content: space-between; gap: 12px; }
.game-meta dt { color: var(--muted); font-weight: 700; }
.game-meta dd { margin: 0; font-weight: 700; text-align: right; }

/* ---------- Characters ---------- */
.char-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.char-card {
  --accent: var(--red);
  position: relative; border-radius: var(--radius-lg); overflow: hidden; background: #fff;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm); outline: none;
  transition: transform .35s var(--ease), box-shadow .35s, border-color .35s;
}
.char-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 6px; background: var(--accent); z-index: 2; }
.char-card:hover, .char-card:focus-visible { transform: translateY(-8px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.char-img { aspect-ratio: 1 / 1; overflow: hidden; background: color-mix(in srgb, var(--accent) 15%, #fff); }
.char-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.char-card:hover .char-img img, .char-card:focus-visible .char-img img { transform: scale(1.07); }
.char-body { padding: 22px 24px 26px; }
.char-body h3 { font-size: 1.6rem; margin-bottom: 4px; }
.debut { display: inline-block; font-size: .8rem; font-weight: 800; color: var(--accent-ink, var(--accent)); letter-spacing: .03em; text-transform: uppercase; margin-bottom: 12px; }
.char-body > p:not(.debut) { color: var(--ink-2); font-size: .97rem; }
.char-fact {
  margin: 0 !important; padding: 12px 14px; border-radius: 12px; font-size: .9rem !important;
  background: color-mix(in srgb, var(--accent) 10%, #fff);
  max-height: 0; opacity: 0; padding-block: 0; overflow: hidden;
  transition: max-height .45s var(--ease), opacity .35s, padding .35s;
}
.char-card:hover .char-fact, .char-card:focus-visible .char-fact, .char-card.open .char-fact { max-height: 200px; opacity: 1; padding-block: 12px; }
@media (hover: none) { .char-fact { max-height: none; opacity: 1; padding-block: 12px; } }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 36px; }
.chip {
  border: 2px solid var(--line); background: #fff; color: var(--ink-2); padding: 8px 18px; border-radius: 999px;
  font-weight: 700; font-size: .93rem; transition: all .2s;
}
.chip:hover { border-color: var(--red); color: var(--red); }
.chip.active { background: var(--red); border-color: var(--red); color: #fff; }

/* ---------- News ---------- */
.news { background: var(--bg-alt); }
.news-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.news-card {
  background: #fff; border-radius: var(--radius); padding: 24px; border: 1px solid var(--line);
  transition: transform .3s var(--ease), box-shadow .3s, opacity .3s;
}
.news-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.news-card h3 { font-size: 1.25rem; margin: 10px 0 8px; }
.news-card p { color: var(--ink-2); font-size: .96rem; margin: 0; }
.news-card.is-hidden { display: none; }
.news-featured { grid-column: span 3; display: grid; grid-template-columns: 1.2fr 1fr; padding: 0; overflow: hidden; }
.news-img { background: #fff; min-height: 260px; display: grid; place-items: center; padding: 24px; overflow: hidden; }
.news-img img { width: 100%; height: 100%; object-fit: contain; transition: transform .5s var(--ease); }
.news-featured:hover .news-img img { transform: scale(1.04); }
.news-featured .news-body { padding: 36px; display: flex; flex-direction: column; justify-content: center; background: linear-gradient(135deg, var(--red), var(--red-dark)); color: #fff; }
.news-featured h3 { font-size: clamp(1.5rem, 2.6vw, 2rem); color: #fff; }
.news-featured p { color: rgba(255,255,255,.9); font-size: 1.02rem; }
.news-featured .news-meta time { color: rgba(255,255,255,.9); }
.news-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: .85rem; }
.news-meta time { color: var(--muted); font-weight: 700; }
.tag { padding: 3px 10px; border-radius: 999px; font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.tag-hardware { background: #fff; color: var(--red-dark); }
.tag-games { background: #e6f4ea; color: #166534; }
.tag-ent { background: #ede9fe; color: #5b21b6; }
.tag-upcoming { background: #fef3c7; color: #92400e; }

/* ---------- Gallery ---------- */
/* Masonry via CSS columns: no gaps, even when filtered */
.gallery-grid { columns: 4 240px; column-gap: 16px; }
.g-item {
  margin: 0 0 16px; position: relative; border-radius: var(--radius); overflow: hidden; background: var(--bg-alt);
  box-shadow: var(--shadow-sm); break-inside: avoid; transform: translateZ(0);
}
.g-item.is-hidden { display: none; }
.g-btn { all: unset; display: block; width: 100%; cursor: zoom-in; }
.g-btn:focus-visible { outline: 3px solid var(--red); outline-offset: -3px; }
.g-item img { width: 100%; height: auto; min-height: 140px; object-fit: cover; transition: transform .6s var(--ease); }
.g-item figcaption {
  position: absolute; inset: auto 0 0; padding: 40px 16px 14px; pointer-events: none;
  background: linear-gradient(transparent, rgba(0,0,0,.75)); color: #fff; font-weight: 700; font-size: .95rem;
  transform: translateY(8px); opacity: .92; transition: transform .35s var(--ease), opacity .35s;
}
.g-item:hover img { transform: scale(1.08); }
.g-item:hover figcaption { transform: translateY(0); opacity: 1; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; gap: 12px;
  background: rgba(10, 10, 14, .92); padding: 24px; animation: fadeIn .25s ease both;
}
.lightbox[hidden] { display: none; }
.lb-figure { margin: 0; max-width: min(1100px, 100%); text-align: center; }
.lb-figure img { max-width: 100%; max-height: 80vh; margin: 0 auto; border-radius: var(--radius); box-shadow: 0 30px 80px rgba(0,0,0,.6); animation: zoomIn .3s var(--ease) both; }
.lb-figure figcaption { color: #fff; margin-top: 14px; font-weight: 700; }
.lb-close, .lb-nav {
  border: 0; background: rgba(255,255,255,.12); color: #fff; border-radius: 50%;
  width: 52px; height: 52px; font-size: 2rem; line-height: 1; display: grid; place-items: center; flex: none;
  transition: background .2s, transform .2s;
}
.lb-close:hover, .lb-nav:hover { background: var(--red); transform: scale(1.08); }
.lb-close { position: absolute; top: 18px; right: 18px; }

/* ---------- Privacy modal ---------- */
.modal { border: 0; padding: 0; border-radius: var(--radius-lg); max-width: 640px; width: calc(100% - 32px); box-shadow: var(--shadow-lg); color: var(--ink); }
.modal::backdrop { background: rgba(10,10,14,.7); backdrop-filter: blur(4px); }
.modal-inner { position: relative; padding: 36px; max-height: 82vh; overflow-y: auto; }
.modal h2 { color: var(--red); font-size: 1.8rem; }
.modal h3 { font-size: 1.1rem; margin-top: 1.2em; }
.modal p { color: var(--ink-2); font-size: .97rem; }
.modal-close { position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--bg-alt); font-size: 1.6rem; line-height: 1; }
.modal-close:hover { background: var(--red); color: #fff; }

/* ---------- Footer ---------- */
.site-footer { background: var(--dark); color: rgba(255,255,255,.75); padding-top: 72px; font-size: .97rem; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 40px; padding-bottom: 48px; }
.footer-brand p { margin: 18px 0 22px; max-width: 340px; }
.logo-light { color: #fff; }
.footer-col h3 { color: #fff; font-size: 1.1rem; margin-bottom: 16px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.site-footer a, .link-btn { color: rgba(255,255,255,.75); text-decoration: none; transition: color .2s; }
.site-footer a:hover, .link-btn:hover { color: #fff; text-decoration: underline; }
.link-btn { background: none; border: 0; padding: 0; font-size: inherit; }
.contact-list li { display: flex; gap: 8px; align-items: center; }

.socials { display: flex; gap: 10px; }
.socials a {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  background: rgba(255,255,255,.08); transition: background .25s, transform .25s var(--ease);
}
.socials a:hover { background: var(--red); transform: translateY(-3px); }
.socials svg { width: 20px; height: 20px; fill: #fff; }
.socials svg .fill-bg { fill: var(--dark); }
.socials a:hover svg .fill-bg { fill: var(--red); }
.socials svg.stroke { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; }
.socials svg .dot-fill { fill: #fff; stroke: none; }

.disclaimer {
  padding: 20px 24px; margin-bottom: 24px; border-radius: var(--radius);
  background: rgba(230,0,18,.1); border: 1px solid rgba(230,0,18,.35); font-size: .88rem; line-height: 1.6;
}
.disclaimer strong { color: #fff; }

.credits { margin-bottom: 32px; font-size: .85rem; }
.credits summary { cursor: pointer; color: #fff; font-weight: 700; padding: 6px 0; width: fit-content; }
.credits ul { columns: 2; column-gap: 32px; padding-left: 18px; margin: 10px 0 0; }
.credits li { margin-bottom: 6px; break-inside: avoid; }
.credits a { text-decoration: underline !important; }

.footer-bottom { border-top: 1px solid rgba(255,255,255,.08); padding: 20px 0; font-size: .88rem; }
.footer-bottom-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; }
.footer-bottom p { margin: 0; }

/* Back to top */
.to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 90; width: 50px; height: 50px; border-radius: 50%; border: 0;
  background: var(--red); color: #fff; box-shadow: 0 10px 24px rgba(230,0,18,.45); display: grid; place-items: center;
  transition: transform .25s var(--ease), opacity .25s;
}
.to-top[hidden] { display: none; }
.to-top:hover { transform: translateY(-4px); }
.to-top svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

/* Image fallback */
img.img-error { object-fit: contain !important; background: linear-gradient(135deg, var(--red-soft), #fff); }

/* ---------- Reveal animations ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.visible { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes zoomIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes heroZoom { to { transform: scale(1); } }
@keyframes underline { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(255,255,255,0); } }
@keyframes scrollCue { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(16px); } }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .timeline { grid-template-columns: repeat(2, 1fr); }
  .classic-grid { grid-template-columns: repeat(3, 1fr); }
  .games-grid, .char-grid, .news-grid { grid-template-columns: repeat(2, 1fr); }
  .news-featured { grid-column: span 2; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .nav-toggle { display: flex; }
  .nav-menu {
    position: fixed; top: 0; right: 0; height: 100vh; height: 100dvh; width: min(320px, 85vw);
    flex-direction: column; gap: 6px; padding: calc(var(--header-h) + 20px) 20px 20px;
    background: #fff; box-shadow: -20px 0 50px rgba(0,0,0,.2);
    transform: translateX(105%); transition: transform .4s var(--ease); z-index: -1;
  }
  .nav-menu.open { transform: none; }
  .nav-link, .scrolled .nav-link { color: var(--ink); font-size: 1.1rem; padding: 12px 18px; }
  .nav-link:hover { background: var(--red-soft); color: var(--red); }
  .menu-open .logo { color: var(--ink); }
  .menu-open .nav-toggle { background: var(--red-soft); }
  .menu-open .nav-toggle span { background: var(--red); }

  .about-grid { grid-template-columns: 1fr; }
  .about-media { max-width: 560px; margin: 0 auto; width: 100%; }
  .media-float { left: 0; }
  .console-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3)::before { display: none; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
}

@media (max-width: 640px) {
  body { font-size: 1rem; }
  .hero { padding-bottom: 110px; }
  .hero-overlay { background: linear-gradient(180deg, rgba(150,0,12,.85), rgba(180,0,14,.75) 60%, rgba(0,0,0,.6)); }
  .hero-actions .btn { flex: 1 1 100%; justify-content: center; }
  .timeline, .facts-grid, .games-grid, .char-grid, .news-grid { grid-template-columns: 1fr; }
  .classic-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
  .classic-card > div { padding: 14px; }
  .classic-card p:last-child { display: none; }
  .news-featured { grid-column: auto; grid-template-columns: 1fr; }
  .news-img { min-height: 200px; }
  .news-featured .news-body { padding: 26px; }
  .specs { grid-template-columns: 1fr; }
  .gallery-grid { columns: 2; column-gap: 10px; }
  .g-item { margin-bottom: 10px; }
  .g-item figcaption { font-size: .82rem; padding: 30px 10px 10px; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .credits ul { columns: 1; }
  .lb-nav { position: absolute; bottom: 24px; }
  .lb-prev { left: calc(50% - 64px); }
  .lb-next { right: calc(50% - 64px); }
  .modal-inner { padding: 28px 22px; }
  .logo-text small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
