/*
Theme Name: RomsMania
Theme URI: https://romsmania.cc
Author: RomsMania Team
Description: Retro gaming discovery & buying platform. A killer retro-arcade theme that helps users find the best way to play classic games — through original hardware, modern handhelds, and licensed digital stores. Built for WP All Import with 100k+ game pages.
Version: 2.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: romsmania
Tags: retro, gaming, custom-post-types, affiliate, e-commerce
*/

/* ============================================================
   CSS VARIABLES — DESIGN SYSTEM
   ============================================================ */
:root {
  /* Brand */
  --rm-blue:        #3c65c7;
  --rm-blue-dark:   #2a4a9e;
  --rm-blue-light:  #5a82e0;
  --rm-orange:      #f47e1e;
  --rm-orange-dark: #d4680f;
  --rm-green:       #04aa6d;
  --rm-green-dark:  #038755;
  --rm-red:         #ff0000;
  --rm-red-dark:    #cc0000;
  --rm-yellow:      #ffd23f;

  /* Neutrals — white-dominant to match live site */
  --rm-bg:          #ffffff;
  --rm-bg-alt:      #f7f8fa;
  --rm-bg-dark:     #0d0f1a;
  --rm-bg-darker:   #060812;
  --rm-border:      #e4e7ef;
  --rm-border-dark: #1e2235;
  --rm-text:        #1a1d2e;
  --rm-text-muted:  #6b7280;
  --rm-text-light:  #9ca3af;

  /* Retro layer */
  --rm-pixel-bg:    #0d0f1a;
  --rm-pixel-grid:  rgba(60, 101, 199, 0.06);
  --rm-scanline:    rgba(0, 0, 0, 0.04);
  --rm-glow-blue:   0 0 24px rgba(60, 101, 199, 0.35);
  --rm-glow-orange: 0 0 24px rgba(244, 126, 30, 0.35);
  --rm-glow-green:  0 0 24px rgba(4, 170, 109, 0.35);

  /* Typography */
  --font-pixel:  'Press Start 2P', 'Courier New', monospace;
  --font-display:'Nunito', 'Segoe UI', system-ui, sans-serif;
  --font-body:   'Nunito', 'Segoe UI', system-ui, sans-serif;

  /* Spacing & form */
  --rm-radius:     6px;
  --rm-radius-lg:  12px;
  --rm-radius-xl:  20px;
  --rm-shadow:     0 2px 8px rgba(13,15,26,0.06);
  --rm-shadow-lg:  0 12px 32px rgba(13,15,26,0.10);
  --rm-shadow-xl:  0 24px 60px rgba(13,15,26,0.16);

  /* Transitions */
  --rm-transition: 0.2s ease;
  --rm-transition-slow: 0.4s ease;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--rm-text);
  background: var(--rm-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--rm-blue); text-decoration: none; transition: color var(--rm-transition); }
a:hover { color: var(--rm-blue-dark); }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

::selection { background: var(--rm-orange); color: #fff; }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.2;
  color: var(--rm-text);
  letter-spacing: -0.01em;
}
.pixel-text {
  font-family: var(--font-pixel);
  letter-spacing: 0.05em;
  line-height: 1.4;
  text-transform: uppercase;
}

/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */
.rm-container {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: 24px;
}
.rm-container--narrow { max-width: 900px; }
.rm-container--wide   { max-width: 1440px; }
.rm-container--narrower { max-width: 960px; }

.rm-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.rm-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.rm-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.rm-grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px; }

@media (max-width: 1024px) {
  .rm-grid-5 { grid-template-columns: repeat(3, 1fr); }
  .rm-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .rm-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .rm-grid-2,
  .rm-grid-3,
  .rm-grid-4,
  .rm-grid-5 { grid-template-columns: 1fr; }
}

.rm-section { padding: 64px 0; }
.rm-section--alt { background: var(--rm-bg-alt); }
.rm-section--dark { background: var(--rm-bg-dark); color: #fff; }
.rm-section--dark h1, .rm-section--dark h2, .rm-section--dark h3 { color: #fff; }
.rm-stack-sm > * + * { margin-top: 16px; }
.rm-stack-md > * + * { margin-top: 24px; }

/* Generic layout helpers for legacy cleanup */
.rm-page-shell {
  padding: 60px 0;
}
.rm-page-grid-gap {
  margin-top: 32px;
}
.rm-page-pagination-gap {
  margin-top: 40px;
}
.rm-page-block-top {
  margin-top: 24px;
}
.rm-page-block-bottom {
  margin-bottom: 56px;
}
.rm-inline-cta-gap {
  margin-top: 16px;
}
.rm-404 {
  padding: 100px 0;
  text-align: center;
}
.rm-404__code {
  margin-bottom: 24px;
  color: var(--rm-blue);
  font-size: 4rem;
  text-shadow: 6px 6px 0 var(--rm-blue-dark);
}
.rm-404__title {
  margin-bottom: 12px;
  font-size: 1.8rem;
}
.rm-404__desc {
  margin-bottom: 32px;
  color: var(--rm-text-muted);
  font-size: 1.05rem;
}
.rm-404__actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

@media (max-width: 768px) { .rm-section { padding: 40px 0; } }

/* ============================================================
   BUTTONS
   ============================================================ */
.rm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--rm-radius);
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--rm-transition);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.rm-btn--primary {
  background: var(--rm-green);
  color: #fff;
  border-color: var(--rm-green);
}
.rm-btn--primary:hover {
  background: var(--rm-green-dark);
  border-color: var(--rm-green-dark);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--rm-glow-green);
}
.rm-btn--orange {
  background: var(--rm-green);
  color: #fff;
  border-color: var(--rm-green);
}
.rm-btn--orange:hover {
  background: var(--rm-green-dark);
  border-color: var(--rm-green-dark);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--rm-glow-green);
}
.rm-btn--green {
  background: var(--rm-green);
  color: #fff;
  border-color: var(--rm-green);
}
.rm-btn--green:hover {
  background: var(--rm-green-dark);
  border-color: var(--rm-green-dark);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--rm-glow-green);
}
.rm-btn--outline {
  background: transparent;
  color: var(--rm-blue);
  border-color: var(--rm-blue);
}
.rm-btn--outline:hover {
  background: var(--rm-blue);
  color: #fff;
}
.rm-btn--ghost {
  background: var(--rm-bg-alt);
  color: var(--rm-text);
  border-color: transparent;
}
.rm-btn--ghost:hover {
  background: var(--rm-border);
  color: var(--rm-text);
}
.rm-btn--pixel {
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  padding: 14px 20px;
  border-width: 3px;
  box-shadow: 4px 4px 0 var(--rm-bg-dark);
  border-radius: 0;
}
.rm-btn--pixel:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--rm-bg-dark);
}
.rm-btn--sm  { padding: 8px 16px;  font-size: 0.85rem; }
.rm-btn--lg  { padding: 16px 32px; font-size: 1.05rem; }
.rm-btn--full{ width: 100%; }

/* ============================================================
   CARDS — base
   ============================================================ */
.rm-card {
  background: #fff;
  border: 1px solid var(--rm-border);
  border-radius: var(--rm-radius-lg);
  overflow: hidden;
  transition: all var(--rm-transition);
  box-shadow: var(--rm-shadow);
  position: relative;
}
.rm-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--rm-shadow-lg);
  border-color: var(--rm-blue);
}
.rm-card__img {
  aspect-ratio: 1/1;
  overflow: hidden;
  background: var(--rm-bg-alt);
  position: relative;
}
.rm-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--rm-transition-slow);
}
.rm-card:hover .rm-card__img img { transform: scale(1.06); }
.rm-card__body  { padding: 16px; }
.rm-card__title { font-size: 0.95rem; font-weight: 800; margin-bottom: 6px; color: var(--rm-text); line-height: 1.3; }
.rm-card__meta  { font-size: 0.78rem; color: var(--rm-text-muted); }

/* ============================================================
   BADGES
   ============================================================ */
.rm-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.rm-badge--blue   { background: rgba(60,101,199,0.12); color: var(--rm-blue); }
.rm-badge--orange { background: rgba(244,126,30,0.12); color: var(--rm-orange); }
.rm-badge--green  { background: rgba(4,170,109,0.12);  color: var(--rm-green); }
.rm-badge--red    { background: rgba(255,0,0,0.10);    color: var(--rm-red); }
.rm-badge--gray   { background: var(--rm-bg-alt);      color: var(--rm-text-muted); }
.rm-badge--solid-blue   { background: var(--rm-blue);   color: #fff; }
.rm-badge--solid-orange { background: var(--rm-orange); color: #fff; }

/* ============================================================
   RATING STARS
   ============================================================ */
.rm-stars {
  display: inline-flex;
  gap: 1px;
  font-size: 1rem;
  line-height: 1;
}
.rm-stars .rm-star {
  color: var(--rm-orange);
  display: inline-block;
}
.rm-stars .rm-star--full { color: var(--rm-orange); }
.rm-stars .rm-star--empty { color: #d4d7e0; }
.rm-stars .rm-star--half {
  position: relative;
  color: #d4d7e0;
}
.rm-stars .rm-star--half::before {
  content: '★';
  position: absolute;
  left: 0;
  top: 0;
  width: 50%;
  overflow: hidden;
  color: var(--rm-orange);
}
.rm-rating { display: flex; align-items: center; gap: 6px; }
.rm-rating__score { font-weight: 800; color: var(--rm-text); }
.rm-rating__count { font-size: 0.78rem; color: var(--rm-text-muted); }

/* ============================================================
   SECTION HEADINGS
   ============================================================ */
.rm-section-title {
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
.rm-section-title--center,
.rm-section-subtitle--center {
  text-align: center;
}
.rm-section-title span { color: var(--rm-blue); }
.rm-section-subtitle {
  color: var(--rm-text-muted);
  margin-bottom: 32px;
  font-size: 1.05rem;
}
.rm-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.rm-section-header .rm-section-title { margin-bottom: 4px; }
.rm-section-header .rm-section-subtitle { margin-bottom: 0; }

@media (max-width: 768px) {
  .rm-section-title { font-size: 1.5rem; }
}

/* ============================================================
   PIXEL DECORATIONS
   ============================================================ */
.rm-pixel-border {
  border: 3px solid var(--rm-blue);
  box-shadow: 4px 4px 0 var(--rm-blue-dark);
  border-radius: 0;
}
.rm-pixel-border--orange {
  border-color: var(--rm-orange);
  box-shadow: 4px 4px 0 var(--rm-orange-dark);
}

.rm-scanlines { position: relative; overflow: hidden; }
.rm-scanlines::after {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    var(--rm-scanline) 2px, var(--rm-scanline) 4px
  );
  pointer-events: none;
  z-index: 10;
}

.rm-pixel-grid-bg {
  background-image:
    linear-gradient(var(--rm-pixel-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--rm-pixel-grid) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* ============================================================
   BREADCRUMBS
   ============================================================ */
.rm-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--rm-text-muted);
  padding: 16px 0;
  flex-wrap: wrap;
}
.rm-breadcrumbs a { color: var(--rm-blue); }
.rm-breadcrumbs span.sep { opacity: 0.4; }

/* ============================================================
   AFFILIATE CARDS
   ============================================================ */
.rm-affiliate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.rm-affiliate-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 2px solid var(--rm-border);
  border-radius: var(--rm-radius);
  text-decoration: none;
  color: var(--rm-text);
  transition: all var(--rm-transition);
  background: #fff;
  position: relative;
  overflow: hidden;
}
.rm-affiliate-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(244,126,30,0.06) 100%);
  opacity: 0;
  transition: opacity var(--rm-transition);
}
.rm-affiliate-card:hover {
  border-color: var(--rm-orange);
  color: var(--rm-text);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(244,126,30,0.18);
}
.rm-affiliate-card:hover::before { opacity: 1; }
.rm-affiliate-card__icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  background: var(--rm-bg-alt);
  border-radius: 8px;
}
.rm-affiliate-card__body { flex: 1; min-width: 0; }
.rm-affiliate-card__name { font-weight: 800; font-size: 0.92rem; line-height: 1.2; }
.rm-affiliate-card__desc { font-size: 0.76rem; color: var(--rm-text-muted); margin-top: 2px; }
.rm-affiliate-card__arrow { color: var(--rm-orange); font-weight: 900; }

/* ============================================================
   FAQ
   ============================================================ */
.rm-faq {
  border: 2px solid var(--rm-border);
  border-radius: var(--rm-radius-lg);
  overflow: hidden;
  background: #fff;
}
.rm-faq__item { border-bottom: 1px solid var(--rm-border); }
.rm-faq__item:last-child { border-bottom: none; }
.rm-faq__question {
  width: 100%;
  background: none;
  border: none;
  padding: 20px 22px;
  text-align: left;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  color: var(--rm-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: background var(--rm-transition);
}
.rm-faq__question:hover { background: var(--rm-bg-alt); }
.rm-faq__question.active { color: var(--rm-blue); background: rgba(60,101,199,0.04); }
.rm-faq__icon {
  transition: transform var(--rm-transition);
  flex-shrink: 0;
  font-size: 1.3rem;
  color: var(--rm-orange);
}
.rm-faq__question.active .rm-faq__icon { transform: rotate(45deg); }
.rm-faq__answer {
  display: none;
  padding: 0 22px 20px;
  font-size: 0.95rem;
  color: var(--rm-text-muted);
  line-height: 1.7;
}
.rm-faq__answer.open { display: block; }

/* ============================================================
   NOTICES
   ============================================================ */
.rm-notice {
  padding: 16px 20px;
  border-radius: var(--rm-radius);
  border-left: 4px solid;
  font-size: 0.9rem;
  line-height: 1.6;
}
.rm-notice--info  { background: rgba(60,101,199,0.08); border-color: var(--rm-blue); color: var(--rm-blue-dark); }
.rm-notice--warn  { background: rgba(244,126,30,0.08); border-color: var(--rm-orange); color: var(--rm-orange-dark); }
.rm-notice--legal { background: rgba(0,0,0,0.04); border-color: var(--rm-text-muted); color: var(--rm-text-muted); font-size: 0.82rem; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .rm-container { padding-inline: 16px; }
  .rm-hide-mobile { display: none !important; }
}
@media (min-width: 769px) {
  .rm-hide-desktop { display: none !important; }
}

/* WordPress core */
.alignnone   { margin: 5px 20px 20px 0; }
.aligncenter { display: block; margin: 0 auto 20px; }
.alignright  { float: right; margin: 0 0 20px 20px; }
.alignleft   { float: left; margin: 0 20px 20px 0; }
.screen-reader-text {
  border: 0; clip: rect(1px,1px,1px,1px); clip-path: inset(50%);
  height: 1px; margin: -1px; overflow: hidden; padding: 0;
  position: absolute; width: 1px; word-wrap: normal !important;
}

/* ============================================================
   A11Y — focus-visible + reduced motion
   ============================================================ */
*:focus { outline: none; }
*:focus-visible {
  outline: 3px solid var(--rm-orange, #f47e1e);
  outline-offset: 3px;
  border-radius: 3px;
}
.rm-btn:focus-visible,
.rm-card:focus-visible,
.rm-platform-tile:focus-visible,
.rm-route-card__cta:focus-visible,
.rm-marketplace-card:focus-visible {
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
