/*
Theme Name: Moban 8-2-32
Description: Chủ đề WordPress Retro Pixel Arcade phong cách máy FC / NES: nền kem trắng, đỏ cờ, xám bạc; bố cục kệ băng game ngang, viền pixel cứng và bóng đổ bậc thang.
Version: 1.0
Author: Moban82
Text Domain: moban82
*/

/* Google Fonts (Press Start 2P + Be Vietnam Pro) are enqueued in functions.php — no @import here. */

/* ============================================================
   1. Design tokens — FC / NES console palette
   ============================================================ */
:root {
  --fc-red: #E40400;
  --fc-red-deep: #A81000;
  --fc-blue: #3055B0;
  --fc-black: #1D1D1D;
  --fc-white: #FCFCFC;
  --fc-cream: #F2EDDF;
  --fc-gray: #BCBCBC;
  --fc-gray-deep: #7C7C7C;
  --bg: var(--fc-cream);
  --surface: var(--fc-white);
  --ink: var(--fc-black);
  --text: #26221C;
  --text-muted: #6E6557;
  --pxu: 4px; /* pixel unit */
  --shadow-px: 8px 8px 0 var(--ink);
  --shadow-px-sm: 4px 4px 0 var(--ink);
  --font-display: 'Press Start 2P', 'Be Vietnam Pro', sans-serif;
  --font-body: 'Be Vietnam Pro', 'Segoe UI', sans-serif;
  --wrap: 1180px;
}

/* ============================================================
   2. Reset & base — hard edges, zero radius
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  border-radius: 0 !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    repeating-linear-gradient(0deg, rgba(29, 29, 29, 0.035) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(90deg, rgba(29, 29, 29, 0.035) 0 1px, transparent 1px 24px);
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  image-rendering: pixelated;
}

a {
  color: var(--fc-red);
  text-decoration: none;
  transition: color 0.15s steps(2);
}

a:hover {
  color: var(--fc-red-deep);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.6;
  color: var(--fc-red);
  margin: 0 0 0.9em;
  text-transform: uppercase;
}

h1 { font-size: clamp(1.05rem, 3vw, 1.7rem); text-shadow: 3px 3px 0 rgba(29, 29, 29, 0.18); }
h2 { font-size: clamp(0.9rem, 2.4vw, 1.25rem); }
h3 { font-size: clamp(0.78rem, 1.8vw, 0.95rem); }

p {
  margin: 0 0 1.2em;
}

.wrap {
  width: min(var(--wrap), 92%);
  margin-inline: auto;
}

.section {
  padding: 3.2rem 0;
}

/* Section kicker as pixel badge */
.section-kicker {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fc-white);
  background: var(--fc-red);
  border: 3px solid var(--ink);
  box-shadow: var(--shadow-px-sm);
  padding: 0.5rem 0.9rem;
  margin-bottom: 1.2rem;
}

.section-title {
  position: relative;
  display: inline-block;
  padding-bottom: 1rem;
}

/* Pixel underline: stepped squares */
.section-title::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 96px;
  height: 6px;
  background: repeating-linear-gradient(90deg, var(--fc-red) 0 12px, transparent 12px 18px);
}

/* Pixel divider between sections */
.px-divider {
  height: 10px;
  margin: 0;
  border: 0;
  background: repeating-linear-gradient(90deg, var(--ink) 0 10px, transparent 10px 20px),
    repeating-linear-gradient(90deg, var(--fc-red) 5px 15px, transparent 15px 30px);
  background-blend-mode: multiply;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ============================================================
   3. Header & navigation — controller-style pixel tabs
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--fc-white);
  border-bottom: 4px solid var(--ink);
  box-shadow: 0 6px 0 var(--fc-red);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0 0.9rem;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.site-brand__logo {
  width: 50px;
  height: 50px;
  border: 3px solid var(--ink);
  box-shadow: var(--shadow-px-sm);
  background: var(--fc-white);
}

.site-brand__name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--fc-red);
  line-height: 1.5;
}

.site-brand__tag {
  display: block;
  font-family: var(--font-body);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fc-gray-deep);
}

.site-nav {
  display: none;
}

.site-nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav__link {
  display: block;
  padding: 0.55rem 0.85rem;
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: var(--fc-white);
  border: 3px solid var(--ink);
  box-shadow: var(--shadow-px-sm);
  transition: transform 0.1s steps(2), box-shadow 0.1s steps(2), background 0.1s steps(2);
}

.site-nav__link:hover,
.site-nav__link:focus {
  background: var(--fc-red);
  color: var(--fc-white);
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--ink);
}

.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 48px;
  height: 48px;
  padding: 12px;
  background: var(--fc-white);
  border: 3px solid var(--ink);
  box-shadow: var(--shadow-px-sm);
  cursor: pointer;
}

.nav-toggle__bar {
  display: block;
  width: 100%;
  height: 4px;
  background: var(--fc-red);
  transition: transform 0.2s steps(3), opacity 0.2s steps(3);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) {
  transform: translateY(10px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) {
  transform: translateY(-10px) rotate(-45deg);
}

.site-nav.is-open {
  display: block;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--fc-white);
  border-bottom: 4px solid var(--ink);
  box-shadow: 0 10px 0 rgba(29, 29, 29, 0.15);
}

.site-nav.is-open .site-nav__list {
  flex-direction: column;
  padding: 1rem 4%;
}

@media (min-width: 1024px) {
  .site-nav {
    display: block;
  }

  .nav-toggle {
    display: none;
  }
}

/* ============================================================
   4. Hero — TV title screen + pixel marquee ticker
   ============================================================ */
.fc-hero {
  background: var(--fc-white);
  border-bottom: 4px solid var(--ink);
  padding: 2.6rem 0 3rem;
}

.fc-hero__grid {
  display: grid;
  gap: 2.2rem;
  align-items: center;
}

@media (min-width: 900px) {
  .fc-hero__grid {
    grid-template-columns: 1.05fr 1fr;
  }
}

/* CRT-free TV shell: thick bezel, power LED */
.tv-frame {
  position: relative;
  background: var(--fc-black);
  border: 4px solid var(--ink);
  box-shadow: 10px 10px 0 rgba(29, 29, 29, 0.25);
  padding: 18px 18px 34px;
}

.tv-frame img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 3px solid var(--fc-gray);
}

.tv-frame::after {
  content: 'POWER';
  position: absolute;
  left: 20px;
  bottom: 8px;
  font-family: var(--font-display);
  font-size: 0.5rem;
  color: var(--fc-gray);
  letter-spacing: 0.2em;
}

.tv-frame__led {
  position: absolute;
  right: 22px;
  bottom: 10px;
  width: 12px;
  height: 12px;
  background: var(--fc-red);
  animation: led-blink 1.6s steps(2) infinite;
}

@keyframes led-blink {
  0%, 100% { background: var(--fc-red); }
  50% { background: var(--fc-gray-deep); }
}

.fc-hero__title {
  margin-top: 0.4rem;
}

.fc-hero__lead {
  color: var(--text-muted);
  max-width: 52ch;
}

.fc-hero__hud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin: 1.2rem 0 1.6rem;
}

.hud-chip {
  font-family: var(--font-display);
  font-size: 0.55rem;
  color: var(--ink);
  background: var(--fc-gray);
  border: 3px solid var(--ink);
  padding: 0.55rem 0.8rem;
}

.hud-chip b {
  color: var(--fc-red-deep);
}

/* Pixel marquee ticker (pure CSS) */
.ticker {
  overflow: hidden;
  background: var(--fc-red);
  border-top: 4px solid var(--ink);
  border-bottom: 4px solid var(--ink);
}

.ticker__track {
  display: flex;
  width: max-content;
  animation: ticker-run 22s linear infinite;
}

.ticker__track span {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--fc-white);
  padding: 0.9rem 0;
  white-space: nowrap;
}

@keyframes ticker-run {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ============================================================
   5. CTA button — pixel start button
   ============================================================ */
.cta-btn {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--fc-white);
  background: var(--fc-red);
  border: 4px solid var(--ink);
  box-shadow: var(--shadow-px);
  padding: 1.05rem 2.2rem;
  transition: transform 0.1s steps(2), box-shadow 0.1s steps(2), background 0.1s steps(2);
  animation: cta-bob 1.4s steps(2) infinite;
}

.cta-btn::before {
  content: '▶ ';
  animation: cta-cursor 1s steps(2) infinite;
}

@keyframes cta-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes cta-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.cta-btn:hover,
.cta-btn:focus {
  color: var(--fc-white);
  background: var(--fc-red-deep);
  transform: translate(4px, 4px);
  box-shadow: 2px 2px 0 var(--ink);
  animation: none;
}

.cta-btn--block {
  display: block;
  width: max-content;
  margin-inline: auto;
}

/* ============================================================
   6. Cartridge shelf — horizontal game-cart rack
   ============================================================ */
.cart-shelf {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
  margin-top: 2.2rem;
}

@media (min-width: 640px) {
  .cart-shelf {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .cart-shelf {
    grid-template-columns: repeat(4, 1fr);
  }
}

.cart-card {
  position: relative;
  background: var(--fc-gray);
  border: 4px solid var(--ink);
  box-shadow: var(--shadow-px);
  padding-top: 26px;
  transition: transform 0.12s steps(2), box-shadow 0.12s steps(2);
}

/* Grip ridges on top of the cartridge */
.cart-card::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 12px;
  right: 12px;
  height: 12px;
  background: repeating-linear-gradient(90deg, var(--fc-gray-deep) 0 6px, var(--fc-gray) 6px 12px);
}

.cart-card:hover {
  transform: translate(-4px, -4px);
  box-shadow: 12px 12px 0 var(--ink);
}

.cart-card__label {
  margin: 0 12px;
  background: var(--fc-white);
  border: 3px solid var(--ink);
}

.cart-card__label img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.cart-card__body {
  padding: 1rem 1rem 1.3rem;
}

.cart-card__title {
  margin-bottom: 0.5rem;
}

.cart-card__text {
  font-size: 0.92rem;
  color: #3d382f;
  margin: 0;
}

/* Shelf plank under the rack */
.cart-shelf-wrap {
  position: relative;
  padding-bottom: 26px;
}

.cart-shelf-wrap::after {
  content: '';
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: 0;
  height: 14px;
  background: var(--ink);
  box-shadow: 0 8px 0 var(--fc-red);
}

/* ============================================================
   7. Manual panel (rules)
   ============================================================ */
.manual-panel {
  background: var(--fc-white);
  border: 4px solid var(--ink);
  box-shadow: var(--shadow-px);
  margin-top: 2rem;
}

.manual-panel__head {
  background: var(--fc-blue);
  color: var(--fc-white);
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  padding: 0.8rem 1.2rem;
  border-bottom: 4px solid var(--ink);
  text-transform: uppercase;
}

.rules-table {
  width: 100%;
  border-collapse: collapse;
}

.rules-table th,
.rules-table td {
  padding: 0.9rem 1.1rem;
  text-align: left;
  border-bottom: 2px dashed var(--fc-gray);
  font-size: 0.94rem;
}

.rules-table th {
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  color: var(--fc-red-deep);
  background: var(--fc-cream);
  text-transform: uppercase;
}

.rules-table td:last-child {
  font-family: var(--font-display);
  font-size: 0.6rem;
  color: var(--fc-red-deep);
  white-space: nowrap;
}

.rules-table tbody tr:hover {
  background: rgba(228, 4, 0, 0.05);
}

.table-scroll {
  overflow-x: auto;
}

/* ============================================================
   8. Symbol select grid
   ============================================================ */
.icon-grid {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: repeat(2, 1fr);
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 640px) {
  .icon-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .icon-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.icon-tile {
  text-align: center;
  background: var(--fc-white);
  border: 3px solid var(--ink);
  box-shadow: var(--shadow-px-sm);
  padding: 1.1rem 0.8rem;
  transition: transform 0.12s steps(2), background 0.12s steps(2);
}

.icon-tile:hover {
  transform: translateY(-6px);
  background: var(--fc-cream);
}

.icon-tile img {
  width: 84px;
  height: 84px;
  margin: 0 auto 0.8rem;
  border: 3px solid var(--ink);
}

.icon-tile__name {
  font-family: var(--font-display);
  font-size: 0.62rem;
  color: var(--fc-red);
}

/* ============================================================
   9. High-score table (community reviews)
   ============================================================ */
.hiscore-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--fc-white);
  border: 4px solid var(--ink);
  box-shadow: var(--shadow-px);
  margin-top: 2rem;
}

.hiscore-table th,
.hiscore-table td {
  padding: 1rem 1.1rem;
  text-align: left;
  font-size: 0.93rem;
  border-bottom: 3px solid var(--fc-cream);
  vertical-align: top;
}

.hiscore-table thead th {
  font-family: var(--font-display);
  font-size: 0.56rem;
  letter-spacing: 0.1em;
  background: var(--ink);
  color: var(--fc-white);
  text-transform: uppercase;
}

.hiscore-table .rank {
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--fc-red);
  white-space: nowrap;
}

.hiscore-table .stars {
  color: var(--fc-red);
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.hiscore-table tbody tr:nth-child(even) {
  background: var(--fc-cream);
}

/* ============================================================
   10. Breadcrumbs — level route
   ============================================================ */
.breadcrumbs {
  padding: 1.1rem 0 0;
  font-size: 0.85rem;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumbs li {
  background: var(--fc-white);
  border: 2px solid var(--ink);
  padding: 0.2rem 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
}

.breadcrumbs li + li::before {
  content: '▸';
  position: relative;
  left: -0.85rem;
  color: var(--fc-red);
  font-weight: 700;
}

.breadcrumbs a {
  color: var(--text-muted);
}

.breadcrumbs a:hover {
  color: var(--fc-red);
}

.breadcrumbs [aria-current="page"] {
  background: var(--fc-red);
  color: var(--fc-white);
}

.breadcrumbs [aria-current="page"] a {
  color: var(--fc-white);
}

/* ============================================================
   11. Archive — level cards
   ============================================================ */
.page-head {
  padding: 2.2rem 0 0.6rem;
}

.post-grid {
  display: grid;
  gap: 1.8rem;
  grid-template-columns: 1fr;
  padding: 1.8rem 0 3rem;
}

@media (min-width: 640px) {
  .post-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .post-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.post-card {
  background: var(--fc-white);
  border: 4px solid var(--ink);
  box-shadow: var(--shadow-px);
  overflow: hidden;
  transition: transform 0.12s steps(2), box-shadow 0.12s steps(2);
}

.post-card:hover {
  transform: translate(-4px, -4px);
  box-shadow: 12px 12px 0 var(--ink);
}

.post-card__media img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-bottom: 4px solid var(--ink);
}

.post-card__body {
  padding: 1.1rem 1.2rem 1.4rem;
}

.post-card__title {
  font-size: 0.72rem;
  line-height: 1.9;
  margin-bottom: 0.6rem;
}

.post-card__title a {
  color: var(--ink);
}

.post-card__title a:hover {
  color: var(--fc-red);
}

.post-card__excerpt {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
}

.post-card__meta {
  font-family: var(--font-display);
  font-size: 0.52rem;
  color: var(--fc-gray-deep);
}

.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}

/* Pagination — square pixel keys */
.pagination,
.nav-links {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.5rem 0 3rem;
}

.page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 46px;
  padding: 0 0.7rem;
  border: 3px solid var(--ink);
  box-shadow: var(--shadow-px-sm);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.62rem;
  background: var(--fc-white);
  transition: transform 0.1s steps(2), box-shadow 0.1s steps(2);
}

.page-numbers.current {
  background: var(--fc-red);
  color: var(--fc-white);
}

.page-numbers:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
  color: var(--fc-red);
}

.page-numbers.current:hover {
  color: var(--fc-white);
}

/* ============================================================
   12. Single post — manual page frame
   ============================================================ */
.single-head {
  padding: 2rem 0 1rem;
}

.single-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.4rem;
}

.single-meta span {
  background: var(--fc-white);
  border: 2px solid var(--ink);
  padding: 0.25rem 0.7rem;
}

.entry-content {
  max-width: 780px;
  background: var(--fc-white);
  border: 4px solid var(--ink);
  box-shadow: var(--shadow-px);
  padding: 2rem clamp(1.2rem, 4vw, 3rem) 2.4rem;
  margin-bottom: 2.5rem;
}

.entry-content img {
  border: 3px solid var(--ink);
}

.entry-content h2,
.entry-content h3 {
  margin-top: 1.8em;
}

.entry-content blockquote {
  margin: 1.6em 0;
  padding: 1rem 1.4rem;
  border-left: 8px solid var(--fc-red);
  background: var(--fc-cream);
  font-style: italic;
}

.related-block {
  padding: 2.5rem 0 3rem;
}

.cta-strip {
  text-align: center;
  padding: 2.6rem 1rem;
  margin: 2rem 0 3rem;
  background: var(--fc-white);
  border: 4px dashed var(--ink);
}

.cta-strip h2 {
  margin-bottom: 0.6rem;
}

/* ============================================================
   13. Footer — console plastic
   ============================================================ */
.site-footer {
  border-top: 6px solid var(--fc-red);
  background: var(--ink);
  padding: 2.8rem 0 1.6rem;
  text-align: center;
  color: var(--fc-gray);
}

.site-footer__nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.6rem;
  margin: 0 0 1.6rem;
  padding: 0;
  list-style: none;
}

.site-footer__nav a {
  color: var(--fc-gray);
  font-size: 0.92rem;
  font-weight: 600;
}

.site-footer__nav a:hover {
  color: var(--fc-white);
}

.site-footer__badge {
  margin: 1.4rem 0;
}

.site-footer__disclaimer {
  max-width: 720px;
  margin: 1.2rem auto 0;
  font-size: 0.82rem;
  line-height: 1.8;
  color: var(--fc-gray);
}

.site-footer__disclaimer p {
  margin: 0.3em 0;
}

.site-footer__copy {
  margin-top: 1.4rem;
  font-family: var(--font-display);
  font-size: 0.5rem;
  color: var(--fc-gray-deep);
}

/* ============================================================
   14. Motion & a11y
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}

:focus-visible {
  outline: 3px solid var(--fc-red);
  outline-offset: 3px;
}
