/* ═══════════════════════════════════════════════════════════════
   responsive.css — GGV Mobile-First Responsive Styles
   Breakpoints: 320 / 375 / 425 / 768 / 1024 / 1440px
   NOTE: Desktop layout is preserved; only mobile behaviour added.
═══════════════════════════════════════════════════════════════ */

/* ── GLOBAL RESET FOR MOBILE ─────────────────────────────────── */
html, body {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  /* Prevent double-tap zoom on all interactive elements */
  touch-action: manipulation;
}
/* Prevent iOS auto-zoom on input focus (triggers when font-size < 16px) */
input, select, textarea, button {
  font-size: 16px;
  touch-action: manipulation;
}
img, video, iframe {
  max-width: 100%;
  height: auto;
}

/* ── HAMBURGER MENU BUTTON ───────────────────────────────────── */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: background 0.15s;
  flex-shrink: 0;
}
.hamburger-btn:hover { background: var(--bg-surface2); }
.hamburger-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease, width 0.2s ease;
  transform-origin: center;
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; width: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── MOBILE NAV DRAWER ───────────────────────────────────────── */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 500;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.mobile-nav-overlay.open { opacity: 1; }

.mobile-nav-drawer {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 80%;
  max-width: 300px;
  height: 100%;
  background: var(--bg-surface);
  z-index: 510;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto;
  border-right: 0.5px solid var(--border);
}
.mobile-nav-drawer.open { transform: translateX(0); }

.mobile-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 0.5px solid var(--border);
}
.mobile-nav-close {
  width: 30px; height: 30px;
  border: none; background: none;
  color: var(--text-secondary);
  font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.mobile-nav-close:hover { background: var(--bg-surface2); color: var(--text-primary); }

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 2px;
  flex: 1;
}
.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: 'DM Sans', sans-serif;
}
.mobile-nav-link:hover,
.mobile-nav-link.active { background: var(--bg-surface2); color: var(--text-primary); }
.mobile-nav-link.accent { color: #94a3b8; }
.mobile-nav-link svg { flex-shrink: 0; }

.mobile-nav-divider {
  height: 0.5px;
  background: var(--border);
  margin: 8px 12px;
}

.mobile-nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 8px 14px 4px;
}

/* Browse sub-list in drawer */
.mobile-browse-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 12px;
  margin-top: 2px;
}
.mobile-browse-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mobile-browse-chevron {
  font-size: 10px;
  transition: transform 0.2s;
}
.mobile-browse-toggle.open .mobile-browse-chevron { transform: rotate(180deg); }
.mobile-browse-sub {
  display: none;
  flex-direction: column;
  gap: 1px;
  padding: 4px 0 4px 14px;
}
.mobile-browse-sub.open { display: flex; }
.mobile-browse-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.mobile-browse-item:hover { background: var(--bg-surface2); color: var(--text-primary); }
.mobile-browse-count { font-size: 10px; color: var(--text-muted); }

.mobile-nav-footer {
  padding: 16px 12px 24px;
  border-top: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mobile-nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-surface2);
  border-radius: 10px;
}
.mobile-nav-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid rgba(100,116,139,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  flex-shrink: 0;
}
.mobile-nav-username {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

/* ──────────────────────────────────────────────────────────────
   BREAKPOINT: ≤ 1024px  (Small laptops & tablets landscape)
─────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .inner { padding: 0 28px; }

  /* Header */
  .header-logo-bar { padding: 14px 28px 10px; }
  .header-nav-bar  { padding: 0 28px; }

  /* Footer */
  .footer-main   { padding: 40px 28px 32px; gap: 36px; }
  .footer-bottom { padding: 18px 28px; }

  /* Home hero */
  .hero-content { padding: 0 28px; }
  .hero-title   { font-size: 44px; }

  /* Section divider */
  .section-divider { margin: 0 28px; }

  /* Cart / checkout page */
  .page  { padding: 28px 28px; }
  .co-page { padding: 28px 28px; }
  .cart-layout { grid-template-columns: 1fr 320px; gap: 20px; }
  .co-layout   { grid-template-columns: 1fr 360px; }

  /* Account */
  .account-tabs { padding: 0 28px; }
  .acc-page     { padding: 0 28px 40px; }
  .overview-top { grid-template-columns: 260px 1fr; }

  /* Product page */
  .viewer-col { flex: 0 0 560px; max-width: 560px; }
  .vault-grid { grid-template-columns: repeat(4, 1fr); }

  /* Vault preview */
  .vault-cards-row { grid-template-columns: repeat(4, 1fr); }
  .vault-grid-full { grid-template-columns: repeat(4, 1fr); }

  /* YMAK / cart upsell */
  .ymak-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ──────────────────────────────────────────────────────────────
   BREAKPOINT: ≤ 768px  (Tablets portrait)
─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .inner { padding: 0 16px; }

  /* ── HEADER ── */
  .header-logo-bar {
    padding: 12px 16px 10px;
    justify-content: space-between;
  }

  /* Move search/cart/theme/user to logo bar on mobile */
  .header-nav-bar { display: none; }

  /* Hamburger visible on tablet/mobile */
  .hamburger-btn { display: flex; }

  /* Mobile overlay & drawer active */
  .mobile-nav-overlay { display: block; }
  .mobile-nav-drawer  { display: flex; }

  /* Show mobile action icons in logo bar */
  .mobile-header-actions {
    display: flex !important;
    align-items: center;
    gap: 4px;
  }

  /* Footer */
  .footer-main {
    grid-template-columns: 1fr;
    padding: 32px 16px 28px;
    gap: 28px;
  }
  .footer-links {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
  .footer-tagline { max-width: 100%; }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 16px;
  }
  .footer-payments { justify-content: flex-start; }

  /* Home hero */
  .hero { height: 400px; }
  .hero-content { padding: 0 16px; }
  .hero-title { font-size: 36px; max-width: 100%; }
  .hero-subtitle { font-size: 13px; max-width: 100%; }
  .hero-price { font-size: 28px; }
  .section-divider { margin: 0 16px; }

  /* Home scroll rows — show 2 cards */
  .game-card { flex: 0 0 calc(50% - 6px); min-width: 140px; }
  .fd-card   { flex: 0 0 calc(50% - 6px); min-width: 150px; }

  /* Charts — stack */
  .section > .inner > div[style*="grid"] {
    grid-template-columns: 1fr !important;
  }

  /* Product page */
  .top-row {
    flex-direction: column;
  }
  .viewer-col {
    flex: 0 0 auto !important;   /* stop 780px flex-basis from becoming height */
    width: 100%;
    max-width: 100%;
  }
  .viewer-card {
    aspect-ratio: unset !important;
    height: auto !important;
    max-height: 220px;
  }
  .viewer-main-img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    object-position: center top;
  }
  .purchase-card { width: 100%; }
  .gal-grid { grid-template-columns: repeat(4, 1fr); }
  .sysreq-grid { grid-template-columns: 1fr; gap: 16px; }
  .lang-header-row,
  .lang-item {
    grid-template-columns: 1fr 80px 80px 80px;
  }

  /* Tabs — horizontal scroll with swipe indicator */
  .tabs-wrap {
    position: relative;
  }
  .tabs-wrap::after {
    content: '›';
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 48px;
    background: linear-gradient(to right, transparent, var(--bg-surface) 70%);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    pointer-events: none;
    font-size: 20px;
    color: var(--text-secondary);
    border-radius: 0 0 0 0;
  }
  .tabs-row {
    overflow-x: auto;
    scrollbar-width: none;
    flex-wrap: nowrap;
  }
  .tabs-row::-webkit-scrollbar { display: none; }

  /* Cart */
  .page { padding: 20px 16px; }
  .cart-layout {
    grid-template-columns: 1fr;
  }
  .summary-card { position: static; }
  .cart-item { grid-template-columns: 96px 1fr; gap: 12px; }
  .ci-art { width: 96px; height: 54px; }
  .ci-price-col { grid-column: 2; justify-self: start; }
  .ymak-grid { grid-template-columns: repeat(3, 1fr); }

  /* Checkout */
  .co-page { padding: 20px 16px; }
  .co-layout { grid-template-columns: 1fr; }
  .co-field-grid { grid-template-columns: 1fr; }
  .co-field.span2 { grid-column: 1; }
  .co-title-row { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* Account */
  .account-tabs { padding: 0 16px; }
  .acc-page     { padding: 0 16px 32px; }
  .overview-top { grid-template-columns: 1fr; }
  .vault-cards-row { grid-template-columns: repeat(3, 1fr); }
  .vault-grid-full { grid-template-columns: repeat(3, 1fr); }
  .wl-grid { grid-template-columns: 1fr; }
  .wl-art  { width: 120px; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-field.span2 { grid-column: 1; }
  .oh-head,
  .og-row { grid-template-columns: 110px 1fr 100px; }
  .oh-head > *:last-child,
  .og-row  > *:last-child { display: none; }
  .orders-wrap { overflow-x: auto; }

  /* Catalog filter bar — 2-row layout on mobile */
  .filter-bar-wrap { overflow: visible; }
  .filter-bar {
    flex-wrap: wrap !important;
    overflow-x: visible;
    gap: 6px;
    padding-bottom: 6px;
  }

  /* Row break — invisible full-width element forces Search+Sort to row 2 */
  .filter-row-break { width: 100%; height: 0; }

  /* ALL filter bar direct children stretch equally (both rows) */
  .filter-bar > div:not(.filter-row-break):not(.col-toggle),
  .filter-bar > button.filter-btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
  }

  /* Buttons inside wrappers also fill full width */
  .filter-bar > div:not(.filter-row-break):not(.col-toggle) > .filter-btn,
  .filter-bar > div:not(.filter-row-break):not(.col-toggle) > .sort-btn {
    width: 100%;
    justify-content: center;
  }

  /* Hide the desktop divider between Search and Sort */
  .filter-divider { display: none; }

  /* Teleported dropdowns — appended to <body> by JS */
  .dd-teleport {
    position: fixed;
    left: 12px;
    right: 12px;
    min-width: 0;
    max-height: 55vh;
    overflow-y: auto;
    z-index: 99999;
    border-radius: 12px;
  }

  /* Pages (static) */
  .page-hero { padding: 52px 0 44px; }
  .page-body { padding: 40px 16px 60px; }
  .contact-form { padding: 22px 18px; }
  .troubleshoot-block { padding: 20px 18px; }
  .legal-layout { grid-template-columns: 1fr; gap: 24px; }

  /* More from the Vault — show only 2 cards, 2-column grid */
  .vault-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
  }
  .vault-card:nth-child(n+3) { display: none !important; }
}

/* ──────────────────────────────────────────────────────────────
   BREAKPOINT: ≤ 425px  (Mobile L)
─────────────────────────────────────────────────────────────── */
@media (max-width: 425px) {
  .inner { padding: 0 12px; }

  /* Header logo scale */
  .logo-mark { width: 34px; height: 34px; }
  .logo-game-vault { font-size: 18px; }
  .logo-good { font-size: 9px; }

  /* Hero */
  .hero { height: 320px; }
  .hero-title { font-size: 28px; }
  .hero-subtitle { font-size: 12px; margin-bottom: 16px; }
  .hero-price { font-size: 24px; }
  .hero-btn { padding: 10px 20px; font-size: 13px; }

  /* Scroll rows */
  .game-card { flex: 0 0 calc(50% - 6px); }
  .fd-card   { flex: 0 0 calc(50% - 6px); }

  /* Footer */
  .footer-main { padding: 28px 12px 24px; }
  .footer-links { grid-template-columns: 1fr 1fr; gap: 16px; }
  .footer-bottom { padding: 14px 12px; }
  .pay-icon { font-size: 8px; padding: 2px 5px; }

  /* Cart items */
  .cart-item { grid-template-columns: 80px 1fr; gap: 10px; }
  .ci-art    { width: 80px; height: 45px; }
  .ci-title  { font-size: 13px; }
  .ci-price  { font-size: 16px; }

  /* Checkout */
  .co-page-title { font-size: 22px; }

  /* Account */
  .vault-cards-row { grid-template-columns: repeat(2, 1fr); }
  .vault-grid-full { grid-template-columns: repeat(2, 1fr); }
  .wl-card { flex-direction: column; }
  .wl-art  { width: 100%; aspect-ratio: 16/9; }

  /* Product page */
  .gal-grid { grid-template-columns: repeat(3, 1fr); }
  .vault-grid { grid-template-columns: repeat(2, 1fr); }
  .dlc-row {
    grid-template-columns: 48px 1fr auto;
    gap: 10px;
  }
  .dlc-price-cell { display: none; }

  /* YMAK grid */
  .ymak-grid { grid-template-columns: repeat(2, 1fr); }

  /* Catalog grid override */
  .product-grid.cols-2,
  .product-grid.cols-3,
  .product-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }

  /* Settings */
  .settings-btn-row { flex-direction: column; }
  .theme-options { grid-template-columns: 1fr; }

  /* Page hero */
  .page-hero { padding: 40px 0 36px; }
  .page-hero-title { font-size: 28px; }
  .contact-grid { grid-template-columns: 1fr; }
  .about-stats  { grid-template-columns: 1fr 1fr; }
  .cs-grid      { grid-template-columns: 1fr; }

  /* Orders table scrollable */
  .orders-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .oh-head,
  .og-row { grid-template-columns: 90px 1fr 80px; min-width: 280px; }

  /* Tabs */
  .tabs-row { overflow-x: auto; scrollbar-width: none; }
  .tabs-row::-webkit-scrollbar { display: none; }
  .tab { padding: 10px 14px; font-size: 13px; }

  /* Account tabs */
  .account-tabs { overflow-x: auto; scrollbar-width: none; }
  .account-tabs::-webkit-scrollbar { display: none; }
  .atab { padding: 10px 14px; }
}

/* ──────────────────────────────────────────────────────────────
   BREAKPOINT: ≤ 375px  (Mobile M)
─────────────────────────────────────────────────────────────── */
@media (max-width: 375px) {
  .inner { padding: 0 10px; }

  .hero-title { font-size: 24px; }
  .hero { height: 290px; }
  .hero-price-row { flex-wrap: wrap; }

  /* Footer */
  .footer-links { grid-template-columns: 1fr; gap: 14px; }

  /* Catalog single col on very small */
  .product-grid.cols-2,
  .product-grid.cols-3,
  .product-grid.cols-4 { grid-template-columns: 1fr; }

  /* Scroll rows — full width cards */
  .game-card { flex: 0 0 calc(80% - 6px); }
  .fd-card   { flex: 0 0 calc(80% - 6px); }

  /* Cart */
  .cart-item { grid-template-columns: 72px 1fr; }
  .ci-art    { width: 72px; height: 40px; }

  /* Account vault */
  .vault-cards-row { grid-template-columns: repeat(2, 1fr); }
  .vault-grid-full { grid-template-columns: repeat(2, 1fr); }
}

/* ──────────────────────────────────────────────────────────────
   BREAKPOINT: ≤ 320px  (Mobile S)
─────────────────────────────────────────────────────────────── */
@media (max-width: 320px) {
  .logo-game-vault { font-size: 15px; }
  .logo-good       { display: none; }

  .hero { height: 260px; }
  .hero-title { font-size: 20px; }
  .hero-btn { padding: 9px 16px; font-size: 12px; }

  .game-card { flex: 0 0 calc(100% - 6px); }
  .fd-card   { flex: 0 0 calc(100% - 6px); }

  .footer-links { grid-template-columns: 1fr; }
}

/* ──────────────────────────────────────────────────────────────
   BREAKPOINT: ≥ 1440px  (Large screens)
─────────────────────────────────────────────────────────────── */
@media (min-width: 1440px) {
  .inner { max-width: 1400px; padding: 0 48px; }
  .header-logo-bar { padding: 16px 48px 12px; }
  .header-nav-bar  { padding: 0 48px; }
  .hero-content    { padding: 0 48px; }
  .footer-main     { padding: 48px 48px 40px; }
  .footer-bottom   { padding: 20px 48px; }
}

/* ──────────────────────────────────────────────────────────────
   UTILITY: Touch-friendly tap targets
─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-link,
  .btn-primary,
  .btn-outline,
  .checkout-btn,
  .btn-cart,
  .btn-wish,
  .coupon-btn,
  .hero-btn,
  .login-btn,
  .filter-btn,
  .sort-btn,
  .load-more-btn,
  .mobile-nav-link,
  .atab {
    min-height: 44px;
  }

  .coupon-input,
  .co-input,
  .settings-input,
  .auth-input {
    min-height: 44px;
    font-size: 16px; /* prevents iOS zoom */
  }

  /* Ensure forms don't cause zoom */
  input, select, textarea { font-size: 16px !important; }
}

/* ──────────────────────────────────────────────────────────────
   MOBILE HEADER ACTIONS (shown in logo bar on mobile)
─────────────────────────────────────────────────────────────── */
.mobile-header-actions {
  display: none; /* hidden on desktop, shown via media query */
}

/* ──────────────────────────────────────────────────────────────
   LIGHT MODE — mobile nav drawer
─────────────────────────────────────────────────────────────── */
html.light-mode .mobile-nav-drawer {
  background: var(--bg-surface);
  border-color: var(--border);
}
html.light-mode .mobile-nav-overlay {
  background: rgba(0,0,0,0.35);
}
