/*
Theme Name: SwitchRoms
Theme URI: https://example.com/switchroms
Author: SwitchRoms
Author URI: https://example.com
Description: A modern, fast, dark-themed game library WordPress theme built for ROM/game download sites. Includes Custom Post Type "ROM" with Format, Size, Version, Firmware, Region metadata, genre chips, popular/latest sections, badges, schema.org VideoGame markup, and a responsive layout. Works with any game database content the site owner provides.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: switchroms
Tags: dark, game, download, custom-post-type, responsive, seo
*/

:root {
  --bg: #0b0e13;
  --bg-2: #11151d;
  --bg-3: #171c26;
  --card: #151a23;
  --card-hover: #1c2330;
  --border: #232a37;
  --text: #e8ecf2;
  --muted: #98a2b3;
  --accent: #e60012;
  --accent-hover: #ff1a2c;
  --accent-soft: rgba(230, 0, 18, 0.12);
  --blue: #3b82f6;
  --green: #22c55e;
  --yellow: #eab308;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --container: 1200px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
ul, ol { list-style-position: inside; }

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

/* ─── Header ─────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 14, 19, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 22px;
  height: 64px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.site-logo .logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  position: relative;
  flex: none;
}

.site-logo .logo-mark::before {
  content: "";
  position: absolute;
  right: 2px;
  top: 3px;
  bottom: 3px;
  width: 20px;
  border-radius: 999px;
  background: var(--accent);
}

.site-logo span.accent { color: var(--accent); }

.main-nav { margin-left: auto; }
.main-nav ul { display: flex; gap: 6px; list-style: none; }
.main-nav a {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: var(--muted);
  transition: 0.2s;
}
.main-nav a:hover, .main-nav .current-menu-item > a {
  color: var(--text);
  background: var(--bg-3);
}

.header-search {
  flex: none;
  width: 260px;
  position: relative;
}

.header-search input[type="search"] {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 14px 9px 38px;
  border-radius: 999px;
  font-size: 0.9rem;
  outline: none;
  transition: 0.2s;
}

.header-search input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.header-search::before {
  content: "\1F50D";
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem;
  opacity: 0.7;
}

.nav-toggle {
  display: none;
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.3rem;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  cursor: pointer;
}

/* ─── Buttons ────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: 0.2s;
  white-space: nowrap;
}
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); color: #fff; transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-3); border-color: var(--muted); }
.btn-lg { padding: 14px 30px; font-size: 1.05rem; }

/* ─── Hero ───────────────────────────────── */
.hero {
  padding: 56px 0 40px;
  text-align: center;
  background:
    radial-gradient(800px 320px at 50% -60px, rgba(230, 0, 18, 0.14), transparent 70%);
}

.hero h1 {
  font-size: clamp(1.7rem, 4.4vw, 2.8rem);
  font-weight: 800;
  line-height: 1.25;
}

.hero h1 .accent { color: var(--accent); }

.hero p.sub {
  max-width: 720px;
  margin: 14px auto 24px;
  color: var(--muted);
}

.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ─── Genre chips ────────────────────────── */
.genre-chips {
  padding: 8px 0 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: center;
}

.genre-chip {
  padding: 7px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--muted);
  transition: 0.2s;
}

.genre-chip:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.genre-chip .count { opacity: 0.65; font-weight: 500; }

/* ─── Sections ───────────────────────────── */
.section { padding: 34px 0; }

.section-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.section-head h2 { font-size: 1.4rem; font-weight: 800; }

.section-head .rule {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  border-radius: 2px;
  opacity: 0.5;
}

.section-head .more { font-size: 0.9rem; font-weight: 600; color: var(--muted); }
.section-head .more:hover { color: var(--accent); }

/* ─── Game grid + cards ──────────────────── */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.game-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: 0.25s;
  display: flex;
  flex-direction: column;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: #3a4356;
  box-shadow: var(--shadow);
}

.game-card .thumb {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--bg-3);
  overflow: hidden;
}

.game-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: 0.3s;
}

.game-card:hover .thumb img { transform: scale(1.05); }

.game-card .badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.game-card .format-tag {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 6px;
}

.game-card .body { padding: 11px 13px 14px; }

.game-card .title {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}

.game-card .title a:hover { color: var(--accent); }

.game-card .meta {
  display: flex;
  gap: 5px;
  align-items: center;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 6px;
}

.game-card .meta .size { color: var(--green); font-weight: 600; }

/* ─── Single ROM page ────────────────────── */
.breadcrumbs {
  padding: 18px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { margin: 0 7px; opacity: 0.5; }

.single-rom-hero { padding: 24px 0 8px; }

.rom-hero-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 30px;
  align-items: start;
}

.rom-cover {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  aspect-ratio: 3 / 4;
  background: var(--bg-3);
}
.rom-cover img { width: 100%; height: 100%; object-fit: cover; }

.rom-title-area h1 { font-size: clamp(1.5rem, 3.4vw, 2.2rem); font-weight: 800; line-height: 1.25; }

.rom-title-area .rom-badges { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 14px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--muted);
}

.pill-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill-note { color: var(--accent); }

.rom-excerpt { color: var(--muted); max-width: 640px; }

.rom-download-box {
  margin-top: 20px;
  background: linear-gradient(135deg, var(--bg-2), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.rom-download-box .big-size { font-size: 1.15rem; font-weight: 800; color: var(--green); }

.spec-table {
  margin-top: 24px;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  border-collapse: collapse;
}

.spec-table th, .spec-table td {
  text-align: left;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 0.94rem;
}
.spec-table tr:last-child th, .spec-table tr:last-child td { border-bottom: none; }
.spec-table th { width: 190px; color: var(--muted); font-weight: 600; background: var(--bg-2); }

.rom-content { padding: 26px 0; max-width: 860px; }
.rom-content h2, .rom-content h3 { margin: 22px 0 10px; font-weight: 800; }
.rom-content p { margin-bottom: 14px; color: #c6cdd8; }
.rom-content ul { margin: 0 0 14px 6px; color: #c6cdd8; }

/* ─── Info cards (emulators etc.) ────────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.info-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

.info-card h3 { font-size: 1.08rem; margin-bottom: 8px; }
.info-card .tag { color: var(--accent); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.info-card p { color: var(--muted); font-size: 0.92rem; }

/* ─── FAQ ────────────────────────────────── */
.faq-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
}

.faq-item summary {
  padding: 15px 20px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after { content: "+"; font-size: 1.25rem; color: var(--accent); transition: 0.2s; }

.faq-item[open] summary::after { transform: rotate(45deg); }

.faq-item .faq-body { padding: 0 20px 16px; color: var(--muted); }

/* ─── Archive toolbar / filters ──────────── */
.archive-head { padding: 40px 0 6px; }
.archive-head h1 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); font-weight: 800; }
.archive-head .count { color: var(--muted); }

.filter-bar {
  margin: 18px 0 22px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-bar select, .filter-bar input[type="search"] {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.9rem;
  outline: none;
}

.filter-bar select:focus, .filter-bar input:focus { border-color: var(--accent); }

/* ─── Pagination ─────────────────────────── */
.pagination { display: flex; justify-content: center; gap: 8px; padding: 30px 0; }

.pagination .page-numbers {
  min-width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-weight: 700;
  color: var(--muted);
  padding: 0 12px;
}

.pagination .page-numbers.current { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination .page-numbers:hover { color: var(--text); border-color: var(--muted); }

/* ─── Sidebar pages / generic content ────── */
.page-wrap { padding: 34px 0; max-width: 860px; }
.page-wrap h1 { font-size: 2rem; margin-bottom: 18px; }
.page-wrap h2 { font-size: 1.35rem; margin: 24px 0 10px; }
.page-wrap p { margin-bottom: 14px; color: #c6cdd8; }
.page-wrap a { color: var(--accent); }
.entry-content img { border-radius: var(--radius-sm); }

.not-found { text-align: center; padding: 80px 0; }
.not-found h1 { font-size: 3rem; }

/* ─── Footer ─────────────────────────────── */
.site-footer {
  margin-top: 40px;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 44px 0 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 30px;
}

.footer-grid h4 { font-size: 0.95rem; font-weight: 800; margin-bottom: 12px; }
.footer-grid ul { list-style: none; }
.footer-grid li { margin-bottom: 8px; color: var(--muted); font-size: 0.92rem; }
.footer-grid a { color: var(--muted); }
.footer-grid a:hover { color: var(--accent); }
.footer-about p { color: var(--muted); font-size: 0.92rem; max-width: 380px; }

.footer-bottom {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ─── Responsive ─────────────────────────── */
@media (max-width: 900px) {
  .rom-hero-grid { grid-template-columns: 200px 1fr; gap: 20px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .header-search { display: none; }
  .nav-toggle { display: block; }
  .main-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    padding: 10px 18px 16px;
  }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; gap: 2px; }
  .rom-hero-grid { grid-template-columns: 1fr; }
  .rom-cover { max-width: 220px; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .footer-grid { grid-template-columns: 1fr; }
  .spec-table th { width: 130px; }
}

@media (max-width: 400px) {
  .game-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
