/* ============== YoungM Games • Global Styles ============== */

/* Theme tokens (single source of truth) */
:root{
  --bg:#1a0f3b;
  --panel:#2a1b57;
  --card:#3a2a75;
  --ink:#eee;
  --muted:#c9c9e8;
  --brand:#3b82f6;   /* primary brand blue */
  --brand-soft:#6ca0ff; /* lighter sky blue for CTAs */
  --accent:#10b981;
  --line:rgba(255,255,255,.12);
  --shadow:rgba(0,0,0,.45);

  /* NEW: responsive product-grid tokens (used across pages) */
  --pg-min: 260px;   /* min card width */
  --pg-img-h: 250px; /* main image area height */
}

/* Resets / base */
* { box-sizing: border-box; }
html, body { height: 100%; }
/* Mobile rendering safeguards */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { overflow-x: hidden; }
img, video, canvas, svg { max-width: 100%; height: auto; }
body {
  margin: 0;
  font-family: 'Montserrat', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  /* Sticky footer layout */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* +20% base font size */
  font-size: 1.2rem;
}

/* Links */
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header / nav / footer (shared across pages) */
header {
  background: var(--panel);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 2;
}
.logo {
  font: 700 1.8rem 'Press Start 2P', cursive;
  color: var(--brand);
  letter-spacing: 2px;
}
/* Use PNG logo in the site header while preserving footer text logo */
header .logo {
  display: inline-block;
  width: clamp(280px, 40vw, 500px);    /* ~250% of original footprint */
  height: clamp(50px, 10vw, 110px);
  background: url('/images/YoungM-Blue.png') no-repeat left center;
  background-size: contain;
  text-indent: -9999px;      /* hide text visually; keeps markup intact */
  white-space: nowrap;
  overflow: hidden;
}
nav ul { list-style: none; display: flex; gap: 2rem; margin: 0; padding: 0;
  /* NEW: allow wrapping so items never vanish */
  flex-wrap: wrap;
}
nav li { font-weight: 600; font-size: 1rem; }

/* Let main fill remaining height so footer sits at bottom */
/* UPDATED: widen and make padding responsive */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(1rem, 2.2vw, 2.2rem);
  flex: 1;
}

footer {
  background: var(--bg);
  color: #9aa3cf;
  text-align: center;
  padding: 1rem 2rem;
  font-size: .9rem;
  border-top: 1px solid var(--line);
}

/* Headings */
h1, h2 { color: var(--brand); }
h1 {
  font-family: 'Press Start 2P', cursive;
  text-align: center;
  margin: 0 0 1.2rem;
}

/* Generic cards / sections */
.card, .section-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px var(--shadow);
  padding: 1.6rem;
  margin-bottom: 1.8rem; /* gentle spacing between stacks */
}
.section-card p { color: var(--muted); line-height: 1.6; }

/* CTA blocks are centered */
.cta { text-align: center; }

/* Buttons */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #1e2a5c;
  color: var(--ink);
  padding: .75rem 1.2rem;            /* a bit larger by default */
  border-radius: 10px;
  font-weight: 700;
  font-size: 1.05em;                 /* slightly larger text on buttons */
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}
.btn:hover { transform: translateY(-2px); }

/* Primary CTA — keep both syntaxes:
   1) .btn.primary  (space)
   2) .btn-primary  (dash)  <-- your about.html uses this */
.btn.primary,
.btn-primary {
  background: linear-gradient(180deg, var(--brand-soft), var(--brand));
  border-color: #2563eb;
  color: #fff;
  padding: 0.9rem 1.6rem;     /* larger tap target */
  font-size: 1.1em;           /* a touch bigger for prominence */
  letter-spacing: .2px;
}

/* “Buy” style (used on product pages) */
.btn.buy {
  background: var(--accent);
  border-color: #059669;
  color: #062b22;
}

/* Forms (Admin / Contact) */
label { display:block; font-weight:600; margin:10px 0 6px; }
input, select, textarea {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #11163a;
  color: var(--ink);
}
textarea { min-height: 100px; resize: vertical; }
.row { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.actions { display:flex; gap:10px; margin-top:14px; }
.status { margin-top:8px; font-weight:600; }
.status.ok { color:#48d597; }
.status.err { color:#ff6b6b; }
.toggle { display:flex; gap:10px; align-items:center; margin:8px 0 0; }
.preview { margin-top:8px; display:flex; gap:12px; align-items:center; flex-wrap:wrap; }
.preview img { width:140px; height:105px; object-fit:cover; border-radius:10px; border:1px solid var(--line); }
.toast {
  margin-top:10px; padding:10px; border-radius:8px;
  background:#11204f; border:1px solid #2c3f80; display:none;
}
.list { display:grid; gap:10px; }
.item {
  display:grid; grid-template-columns:90px 1fr auto; gap:12px; align-items:center;
  background:#151a3e; border:1px solid var(--line); border-radius:12px; padding:10px;
}
.item img { width:90px; height:68px; object-fit:cover; border-radius:8px; }

/* ========== SHOP (global defaults that your shop.html can rely on) ========== */

/* Controls row used on some pages */
.filters {
  display:flex; justify-content:center; gap:1rem; margin: 0 0 2rem; flex-wrap:wrap;
}
.filters select {
  padding: 0.6rem 1rem; border-radius: 8px; border: 1px solid var(--line);
  font-size: 1rem; background: var(--card); color: var(--ink); cursor: pointer;
}

/* Core grid helpers (ensure grids fill the width instead of centering) */
.products-grid,
.grid.products,
#productGrid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--pg-min), 1fr));
  gap: 1.5rem;
  justify-content: normal;
  justify-items: stretch;
  align-items: stretch;
}

/* Legacy/product-card look (kept for other pages that use it) */
.products-grid { gap: 1.5rem; }
.product-card {
  background: var(--card);
  border-radius: 14px;
  padding: 1rem;
  border: 1px solid var(--line);
  text-align: center;
  box-shadow: 0 6px 20px var(--shadow);
  transition: transform .25s ease, box-shadow .25s ease;
  cursor: pointer;
}
.product-card:hover { transform: translateY(-4px); box-shadow: 0 10px 30px var(--shadow); }

/* Image wraps – support both class names used across pages */
.img-wrap,
.imgWrap {
  position: relative;
  width:100%;
  height: var(--pg-img-h);
  background: linear-gradient(135deg, rgba(108,160,255,.12), rgba(179,136,255,.06));
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: .8rem;
  display:flex; align-items:center; justify-content:center;
}
.img-wrap img,
.imgWrap img {
  width:100%; height:100%; object-fit:contain; display:block; transition: opacity .2s ease;
}

.h3 { color: var(--brand); margin: .3rem 0 .25rem; font-weight: 700; }
.desc { font-size:.9rem; margin:0 0 .6rem; color:#ccc; min-height:2.6em; }
.price { font-weight:800; font-size:1.05rem; margin-bottom:.8rem; }
.btn-group { display:flex; justify-content:center; gap:.5rem; }
.dots { display:flex; gap:6px; justify-content:center; margin-top:.35rem; min-height:10px; }
.dot { width:6px; height:6px; border-radius:50%; background:#6b78b6; opacity:.65; }
.dot.active { opacity:1; background:#9db6ff; }

/* Product detail page */
.product-card-lg {
  background:#3a2a75; border:1px solid var(--line);
  border-radius:10px; padding:1.2rem;
  display:grid; grid-template-columns:1.6fr 1fr; gap:1.2rem;
}
.product-card-lg .details { display:flex; flex-direction:column; }
@media (max-width: 900px){
  .product-card-lg { grid-template-columns: 1fr; }
  .thumbs img { width:72px; height:72px; }
}
.media {
  background:linear-gradient(135deg,#3a1c6e, #5a2ea6);
  border-radius:10px; padding:.8rem;
  display:flex; flex-direction:column; gap:.6rem;
}
.mainImg { width:100%; aspect-ratio:4/3; object-fit:contain; display:block; border-radius:8px; background:#251e4a; }
.thumbs { display:flex; gap:.5rem; flex-wrap:wrap; }
.thumbs img {
  width:90px; height:68px; object-fit:cover; border-radius:8px;
  cursor:pointer; border:2px solid transparent; background:#251e4a;
}
.thumbs img.active { border-color: var(--brand); }
.details h1 { color: var(--brand); margin:0 0 .5rem; font-size:1.8rem; }
.meta { color: var(--muted); margin:.3rem 0 1rem; }
.price-lg { font-weight:800; font-size:1.4rem; margin:1rem 0; }
.cta { display:flex; gap:.6rem; flex-wrap:wrap; }

/* Related products */
.related { margin-top:2rem; background:#251e4a; border-radius:10px; padding:1.2rem; }
.related h2 { font-family:'Press Start 2P',cursive; color:var(--brand); margin:0 0 1rem; font-size:1.3rem; }
.grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:1rem;
  /* NEW: make sure generic grids also fill the row */
  justify-content: normal; justify-items: stretch; align-items: stretch;
}
.mini-card {
  background:#3a2a75; border:1px solid var(--line); border-radius:10px;
  padding:.8rem; text-align:center;
}
.mini-card img {
  width:100%; max-width:160px; height:120px; object-fit:contain;
  background:#251e4a; border-radius:8px; margin:.3rem auto .6rem; display:block;
}
.mini-price { font-weight:700; margin-bottom:.6rem; color:#eee; }
.mini-btn { background:#1e2a5c; color:#eee; border:1px solid var(--line);
  padding:.45rem .8rem; border-radius:8px; font-weight:700; cursor:pointer; }

/* About page characters */
.side-character {
  position: fixed;
  width: clamp(190px, 18vw, 320px);
  z-index: 0; user-select:none; pointer-events:none;
  will-change: transform; transform-origin:center;
  animation: float-wobble 4.8s ease-in-out infinite alternate;
}
.side-character.left  { left:8px;  top: clamp(96px, 22vh, 320px); }
.side-character.right { right:8px; bottom: clamp(96px, 18vh, 260px); animation-duration:5.4s; }
@keyframes float-wobble {
  0%   { transform: translate(0px, 6px)  rotate(0.2deg); }
  50%  { transform: translate(8px, -18px) rotate(-0.2deg); }
  100% { transform: translate(-6px, -32px) rotate(0.2deg); }
}
@media (prefers-reduced-motion: reduce) { .side-character { animation: none; } }
@media (max-width: 768px) { .side-character { display:none; } }

/* Helpers */
.center { text-align:center; }
.status-inline { color: var(--muted); }

/* === UX & Visual Enhancements === */

/* subtle 3D tilt on product cards */
.card-tilt {
  transform-style: preserve-3d;
  transition: transform .25s ease, box-shadow .25s ease;
}
.card-tilt:hover {
  transform: translateY(-4px) rotateX(.8deg) rotateY(.8deg) scale(1.01);
  box-shadow: 0 14px 40px rgba(0,0,0,.45);
}

/* badges (e.g., console type, condition, includes) */
.badges {
  display:flex; gap:.35rem; justify-content:center; flex-wrap:wrap;
  margin:.35rem 0 .5rem;
}
.badge {
  font-size:.8rem; font-weight:800; letter-spacing:.2px;
  padding:.25rem .5rem; border-radius:999px;
  border:1px solid rgba(255,255,255,.15);
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(0,0,0,.15));
  color:#e9e9ff;
}
.badge.nintendo  { background: linear-gradient(180deg, #3b82f6, #2b5db3); color:#fff; border-color:#3b73da; }
.badge.xbox      { background: linear-gradient(180deg, #22c55e, #168c42); color:#021b0e; border-color:#18924a; }
.badge.playstation{background: linear-gradient(180deg, #60a5fa, #2a5bd7); color:#07142e; border-color:#3f76ea;}
.badge.retro     { background: linear-gradient(180deg, #fbbf24, #c08400); color:#231800; border-color:#d09a12; }

/* skeleton shimmer (for big images while they load) */
.skeleton {
  position:relative; overflow:hidden; background:#2a2f55;
}
.skeleton::after {
  content:""; position:absolute; inset:0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent);
  transform: translateX(-100%); animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  100% { transform: translateX(100%); }
}

/* section header helper (used on product page recommendations) */
.section-head {
  display:flex; align-items:center; justify-content:space-between;
  margin: 1.2rem 0 .6rem;
}
.section-head h3 { margin:0; font-family:'Press Start 2P', cursive; color:var(--brand); font-size:1.1rem; }

/* ========== RESPONSIVE TUNING ========== */
@media (max-width: 1024px){
  :root{ --pg-min: 240px; --pg-img-h: 220px; }
}
@media (max-width: 768px){
  :root{ --pg-min: 220px; --pg-img-h: 200px; }
  body { font-size: 1.05rem; }
}
@media (max-width: 520px){
  :root{ --pg-min: 180px; --pg-img-h: 180px; }
  body { font-size: 1rem; }
}

/* Mobile-first header and layout tweaks */
@media (max-width: 768px){
  header { padding: .75rem 1rem; }
  .logo { font-size: 1.4rem; }
  nav ul { gap: 1rem; }
}
@media (max-width: 768px){
  header .logo { width: clamp(220px, 70vw, 420px); height: clamp(40px, 14vw, 92px); }
}
@media (max-width: 640px){
  header { flex-direction: column; align-items: flex-start; gap: .5rem; }
  nav li { font-size: .95rem; }
  main { padding: 1rem; }
  .row { grid-template-columns: 1fr; }
  .actions { flex-wrap: wrap; }
  .btn-group { flex-wrap: wrap; }
}

/* === Hide scrollbars globally (keep scrolling working) === */
html, body {
  -ms-overflow-style: none; /* IE and legacy Edge */
  scrollbar-width: none;    /* Firefox */
}
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 0;
  height: 0;
  background: transparent;
}
