/* ==========================================================================
   polish.css — loaded last. Visual refinement + universal responsiveness.
   Pure CSS (no build step). Safe to remove: nothing else depends on it.
   ========================================================================== */

/* ---------- 1. Fluid foundation (every rem-based size scales with screen) ---------- */
html {
  /* 15px on small phones -> ~17.5px on large desktops / TVs */
  font-size: clamp(15px, 13.6px + 0.24vw, 17.5px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
  scroll-padding-top: clamp(5rem, 9vw, 7rem); /* anchor links clear the sticky header */
  -webkit-tap-highlight-color: transparent;
}
body {
  min-width: 320px;
  overflow-x: clip;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
}
#app {
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
/* mobile browsers: 100vh includes the URL bar; dvh does not */
.min-h-screen { min-height: 100vh; min-height: 100dvh; }
.h-screen { height: 100vh; height: 100dvh; }
.max-h-screen { max-height: 100vh; max-height: 100dvh; }

img, video, canvas, svg, iframe, embed, object { max-width: 100%; }
iframe { border: 0; }
button, [role="button"], a, label, select, summary { touch-action: manipulation; }
h1, h2, h3, h4 { text-wrap: balance; }
p, li, blockquote { text-wrap: pretty; }
h1, h2, h3, h4, h5, h6, p, li, td, th, blockquote, dd, dt {
  overflow-wrap: break-word;
  word-break: break-word;
}
pre, code, kbd { max-width: 100%; overflow-x: auto; }

::selection { background: rgba(var(--cl-accent), .35); color: #fff; }

/* thin, themed scrollbars on desktop */
@media (hover: hover) and (pointer: fine) {
  * { scrollbar-width: thin; scrollbar-color: rgba(var(--cl-accent), .35) transparent; }
  *::-webkit-scrollbar { width: 10px; height: 10px; }
  *::-webkit-scrollbar-track { background: transparent; }
  *::-webkit-scrollbar-thumb {
    background: rgba(var(--cl-accent), .3);
    border-radius: 99px;
    border: 2px solid transparent;
    background-clip: content-box;
  }
  *::-webkit-scrollbar-thumb:hover { background: rgba(var(--cl-accent), .55); background-clip: content-box; }
}

/* ---------- 2. Accessibility + interaction polish ---------- */
:where(a, button, summary, [tabindex]):focus-visible {
  outline: 2px solid rgb(var(--cl-accent));
  outline-offset: 3px;
  border-radius: 8px;
}
:where(button, .premium-button, [role="button"]):active:not(:disabled) { transform: scale(.975); }
:where(button, a, input, select, textarea) { transition-timing-function: cubic-bezier(.2, .8, .2, 1); }
:disabled { cursor: not-allowed; }

/* Altcha used `val(` instead of `var(` — fixed in source, forced here too */
:root { --altcha-color-base: rgb(var(--cl-card)); }

/* ---------- 3. Header / navigation ---------- */
.premium-nav__mobile {
  max-height: calc(100vh - 110px);
  max-height: calc(100dvh - 110px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* ---------- 4. Hero + sections: fluid spacing ---------- */
.premium-section {
  margin-top: clamp(24px, 4vw, 48px);
  margin-bottom: clamp(24px, 4vw, 48px);
}
.premium-hero { min-height: auto; padding-top: clamp(24px, 4vw, 48px); padding-bottom: 0; gap: clamp(24px, 4vw, 56px); }
.premium-hero__glow { max-width: 80vw; max-height: 80vw; }

/* ---------- 5. (reserved) ---------- */
.review-card__message > span { overflow-wrap: anywhere; }

/* ---------- 6. Bug fixes ---------- */

/* Before/after slider: image used 100vw, so it misaligned whenever the box was
   narrower than the screen. Clip instead of resizing -> always aligned. */
.comparison__before {
  width: 100%;
  border-right: 0;
  clip-path: inset(0 calc(100% - var(--split, 50%)) 0 0);
}
.comparison__before img { width: 100%; max-width: none; }
.comparison__stage::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: var(--split, 50%);
  width: 2px;
  margin-left: -1px;
  background: #fff;
  pointer-events: none;
}

/* Review carousel: slides were absolutely positioned inside a fixed min-height,
   so long reviews overflowed. Stack them in a grid so height follows content. */
.product-review-carousel__viewport { display: grid; min-height: 0; }
.product-review-slide { position: relative; inset: auto; grid-area: 1 / 1; min-width: 0; }
/* bigger invisible tap area for the tiny carousel dots */
.product-review-carousel__dots button { position: relative; }
.product-review-carousel__dots button::after { content: ""; position: absolute; inset: -12px -4px; }

/* Toasts + purchase popup must never exceed the screen or sit under notches */
.sa-toasts {
  width: min(18rem, calc(100vw - 2rem));
  right: max(1rem, env(safe-area-inset-right, 0px));
  bottom: max(1rem, env(safe-area-inset-bottom, 0px));
}
.recent-purchase-card { min-width: 0; width: min(320px, calc(100vw - 32px)); max-width: calc(100vw - 32px); }

/* Product modal grid: more sensible steps on small screens */
@media (max-width: 700px) { .product-group-modal__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 400px) { .product-group-modal__grid { grid-template-columns: minmax(0, 1fr); } }

/* Pagination was capped by a viewport-based width */
.premium-pagination__numbers { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.premium-pagination__numbers::-webkit-scrollbar { display: none; }
.review-filters__buttons { scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.review-filters__buttons::-webkit-scrollbar { display: none; }

/* ---------- 7. Tablets & below ---------- */
@media (max-width: 1050px) {
  .product-experience { width: min(1440px, calc(100% - 32px)) !important; padding-top: 32px; }
  .product-live-stats { grid-template-columns: 1fr 1fr; }
  .cart-recommendations__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- 8. Phones ---------- */
@media (max-width: 760px) {
  .product-experience { padding-bottom: 64px; }
  .product-description-card, .product-review-carousel { padding: 18px; }
  .checkout-form__body { padding: 16px; }
  .product-review-carousel__heading { flex-wrap: wrap; align-items: center; }
  .product-review-carousel__heading h2 { font-size: 1.35rem; }
  .product-live-stats { grid-template-columns: 1fr; }
  .cart-recommendations__grid { grid-template-columns: 1fr; }
  .premium-pagination__pages { flex-wrap: wrap; justify-content: center; }
  .review-card { min-height: 0; }
  .stats-showcase__grid article { min-height: 170px; padding: 20px 10px; }
  .feedback-hero h1 { font-size: clamp(2.2rem, 11vw, 3.2rem); }

  /* tables scroll sideways inside themselves instead of widening the page */
  .component table, main table, .prose table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* readable minimum text size (several labels were 7–9px) */
  .review-card__product small, .review-card__country, .review-card__rating time,
  .review-card__message small, .review-card__reply small, .review-card__footer > span,
  .review-card__footer > a, .review-filters > div:first-child small,
  .review-filters__buttons a, .premium-pagination > p, .premium-pagination a,
  .premium-pagination span, .stats-showcase__grid small, .product-review-slide footer,
  .product-review-carousel__heading small, .payments-security, .comparison__label,
  .product-live-stat, .volume-discount-nudge > div, .premium-hero__trust {
    font-size: max(.72rem, 11.5px);
  }
  .review-card__reply p, .review-card__message > span, .checkout-field > label { font-size: max(.78rem, 12.5px); }
}

/* ---------- 9. Touch devices ---------- */
@media (pointer: coarse) {
  /* iOS zooms the page when an input is < 16px */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select, textarea, .premium-variant-select { font-size: 16px !important; }

  .premium-button, .premium-nav__menu, .premium-nav__mobile > a, .premium-nav__mobile > button,
  .variant-pill, .review-filters__buttons a, .premium-pagination a, .premium-pagination span,
  .product-read-more, .premium-quantity button, .product-review-carousel__heading button {
    min-height: 44px;
  }
  .premium-nav__menu { min-width: 44px; }
}

/* hover-lift effects get "stuck" after a tap on touch screens — switch them off */
@media (hover: none) {
  .review-card:hover, .feature-card:hover, .stats-showcase__grid article:hover,
  .quantity-deal-card:hover, .product-live-stat:hover, .variant-pill:hover,
  .product-read-more:hover, .premium-pagination__pages a:hover,
  .review-filters__buttons a:hover, .review-card__footer > a:hover,
  .product-review-carousel__heading button:hover {
    transform: none !important;
  }
  .review-card__footer > a { opacity: 1; }
}

/* ---------- 10. Very small phones (<= 360px) ---------- */
@media (max-width: 360px) {
  .premium-hero__title { font-size: clamp(2.4rem, 14vw, 3rem); }
  .premium-hero__actions .premium-button { padding-inline: 14px; }
  .stats-showcase__grid { gap: 8px; }
  .payment-pill { min-width: 130px; padding: 14px; }
  .product-group-modal { padding: 8px; }
}

/* ---------- 11. Landscape phones: short viewports ---------- */
@media (max-height: 480px) and (orientation: landscape) {
  .premium-hero { min-height: auto; padding-top: 24px; }
  .premium-nav__mobile { max-height: calc(100dvh - 80px); }
  .product-buybox { position: relative; top: auto; }
}

/* ---------- 12. Big screens / TVs / ultra-wide ---------- */
@media (min-width: 1800px) {
  .premium-section, .product-experience, .premium-feedbacks__inner { max-width: 1680px; }
}
@media (min-width: 2400px) {
  html { font-size: clamp(17.5px, 0.73vw, 28px); }
}

/* ---------- 13. RTL languages (ar / fa / he) ---------- */
[dir="rtl"] .fa-arrow-right, [dir="rtl"] .fa-chevron-right, [dir="rtl"] .fa-angle-right,
[dir="rtl"] .fa-arrow-right-long { transform: scaleX(-1); }
[dir="rtl"] .review-card__message { text-align: right; }
[dir="rtl"] .variant-pill:hover:not(:disabled) { transform: translateX(-3px); }

/* ---------- 14. Motion + print ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
@media (prefers-contrast: more) {
  .review-card, .checkout-card, .product-gallery-card, .premium-pagination { border-color: rgba(255, 255, 255, .35); }
}
@media print {
  header.component, footer, .sa-toasts, #snow { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
}

/* ==========================================================================
   Product-group popup ("In-game items" -> games -> products) on phones/tablets.
   The popup used nested fixed-height scrolling, which hides the product cards
   on many mobile browsers. On small/short screens the whole popup now scrolls
   as one piece, so every product is reachable.
   ========================================================================== */
.product-group-modal .reveal-on-scroll { opacity: 1; transform: none; }
.product-group-modal__grid { align-content: start; grid-auto-rows: auto; }
.product-group-modal__grid > * { min-width: 0; min-height: 0; }

@media (max-width: 780px), (max-height: 560px) {
  .product-group-modal {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    place-items: start center;
    align-content: start;
  }
  .product-group-modal__backdrop { position: fixed; }
  .product-group-modal__dialog {
    max-height: none !important;
    overflow: visible !important;
    margin: 0 auto;
    width: min(100%, 1100px);
  }
  .product-group-modal__surface {
    max-height: none !important;
    overflow: visible !important;
  }
  .product-group-modal__grid {
    overflow: visible !important;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }
  .product-group-modal__header {
    position: sticky;
    top: -14px;
    z-index: 3;
    margin: -14px -14px 12px;
    padding: 14px;
    border-bottom: 1px solid var(--premium-line);
    border-radius: 16px 16px 0 0;
    background: color-mix(in srgb, rgb(var(--cl-card)) 94%, #000);
  }
}
/* Generic (non-premium) group popup used by snippets/group-modal.njk */
.sa-group-modal { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

/* ---------- Tighter vertical spacing between sections ---------- */
.section-heading, .stats-showcase__heading { margin-bottom: clamp(16px, 2.5vw, 28px); }
.premium-hero__copy { margin: clamp(16px, 2vw, 22px) auto; }
.premium-hero__trust { margin-top: clamp(14px, 2vw, 20px); }
.stats-showcase__heading:not(:has(h2)) { margin-bottom: 12px; }
.premium-feedbacks__inner { padding-top: clamp(40px, 6vw, 64px); padding-bottom: clamp(48px, 7vw, 72px); }
.product-experience { padding-top: clamp(24px, 4vw, 40px); padding-bottom: clamp(48px, 6vw, 72px); }
footer { margin-top: clamp(32px, 5vw, 56px) !important; }
