/* Joymax homepage (template "Joymax homepage"): hero, game tiles, latest accounts, numbers, help.
   Loaded only on that template. Colours come from the tokens in main.css. */

/* Astra's page box: full width, no padding (our sections set their own width) */
body.jx-home-page #content > .ast-container { display: block; max-width: none; padding: 0; }
body.jx-home-page #content { padding-left: 0; padding-right: 0; padding-bottom: 0; }   /* top gap comes from main.css (0.6.1) */

/* Reset Astra / Elementor / old Additional CSS looks inside the homepage */
/* The old shop CSS paints every link in #content gold with an ID selector; this beats it. Each link's colour is set
   below through --jx-link (plain text colour when not set). */
body.joymax-theme #content #jx-home a { color: var(--jx-link, inherit); text-decoration: none; }
body.joymax-theme .jx-home :is(h1, h2, h3, p, ul) { margin: 0; padding: 0; }
body.joymax-theme .jx-home button { font-family: var(--body); text-transform: none; letter-spacing: normal; line-height: 1.2; }
body.joymax-theme .jx-home img { max-width: 100%; }

.jx-home { padding-bottom: 96px; }
/* Jumps (#store, #accounts) stop below the sticky header + the admin bar when logged in (0.6.1: was 84 px, too little
   with the admin bar, so the heading went under the header) */
.jx-sec-store { padding-top: 24px; scroll-margin-top: calc(var(--wp-admin--admin-bar--height, 0px) + 84px); }
.jx-sec-accounts { padding-top: 48px; scroll-margin-top: calc(var(--wp-admin--admin-bar--height, 0px) + 84px); }
.jx-sec-numbers { padding-top: 56px; }
.jx-sec-help { padding-top: 96px; }

/* ---------- Hero: a rounded dark card in both themes (the art is dark) ---------- */
body.joymax-theme .jx-hero {
  --ink: #0A0A0B; --edge: #2A2A30; --paper: #F2F2F2; --ash: #A8A8B0; --gold-text: #EFC31A;
  position: relative; overflow: hidden; margin-top: 0; border-radius: 20px; background: #111418; color: var(--paper);   /* gap above: main.css */
}
.jx-hero picture img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: right center; }
.jx-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10,10,11,.92) 0%, rgba(10,10,11,.6) 38%, rgba(10,10,11,0) 62%); pointer-events: none; }
.jx-hero-in { position: relative; z-index: 1; min-height: clamp(380px, 33vw, 480px); display: flex; flex-direction: column; justify-content: center; padding: 56px; }
/* #content #jx-home: beats the old shop CSS heading colour (ID selector), so the title stays light on the dark card */
body.joymax-theme #content #jx-home .jx-hero h1 { font-size: clamp(var(--t-39), 4.4vw, var(--t-61)); font-weight: 700; letter-spacing: -.015em; line-height: 1.02; max-width: 12ch; color: var(--paper); }
body.joymax-theme .jx-hero .jx-lead { max-width: 40ch; color: var(--ash); font-size: var(--t-20); line-height: 1.5; margin: 20px 0 28px; }
.jx-cta { display: flex; flex-wrap: wrap; gap: 12px; }
body.joymax-theme .jx-home .jx-btn {
  display: inline-flex; align-items: center; justify-content: center; height: 52px; padding: 0 28px;
  font: 600 var(--t-16) var(--body); white-space: nowrap; border-radius: var(--r-btn);
  transition: transform 160ms ease-out, background-color var(--out) ease, box-shadow var(--out) ease;
}
body.joymax-theme .jx-home .jx-btn:active { transform: scale(.97); }
body.joymax-theme .jx-home .jx-btn-gold { background: var(--gold); --jx-link: var(--on-gold); }
body.joymax-theme .jx-home .jx-btn-gold:hover { background: #FFD43A; }
body.joymax-theme .jx-home .jx-btn-plain { --jx-link: var(--paper); background: rgba(10,10,11,.55); box-shadow: inset 0 0 0 1px var(--edge); }
body.joymax-theme #content #jx-home .jx-btn-plain:hover { box-shadow: inset 0 0 0 1px var(--ash); }

/* ---------- Section heads ---------- */
.jx-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
body.joymax-theme .jx-sec-head h2 { font-size: var(--t-31); font-weight: 700; line-height: 1.2; }
body.joymax-theme .jx-sec-head h2 [lang="ar"] { font: 500 var(--t-20) var(--ar); color: var(--ash); margin-inline-start: 12px; }
body.joymax-theme .jx-sec-head a { --jx-link: var(--gold-text); font-weight: 600; white-space: nowrap; }
body.joymax-theme #content #jx-home .jx-sec-head a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Game tiles: 3 per row above 900 px, 2 from 600 to 900 px, 1 below 600 px; tile shape as the demo (768 × 345).
   Gold = available, blue = coming soon (the live rule) ---------- */
.jx-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
/* (0.6.16) Computers: a lone tile in the last row sits in the middle column, as live. 2 / 1 per row below 900 px unchanged. */
@media (min-width: 901px) {
  .jx-tiles > .jx-tile:last-child:nth-child(3n+1) { grid-column: 2; }
}
.jx-tile {
  --accent: var(--gold);
  --tint: hue-rotate(190deg) saturate(1.3) brightness(1.12);  /* same colour filter as live; "Original colours" = none */
  position: relative; display: block; aspect-ratio: 768 / 345; border: 1px solid var(--edge); border-radius: var(--r-card); overflow: hidden; background: var(--plate);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}
.jx-tile.jx-orig { --tint: none; }
.jx-tile.jx-soon { --accent: #3D8BFF; cursor: not-allowed; }
/* The pictures (~1920 × 817) are a little wider than the tile: keep the right side (game logos) whole and trim only the
   left side (~5%); the hover zoom also grows from the right edge so logos never slide out. */
body.joymax-theme .jx-tile img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 100% 50%; transform-origin: 100% 50%;
  filter: var(--tint); transition: transform 200ms ease, filter 200ms ease; }
/* (0.6.14) Tiles added from a new category: its picture whole on a blurred copy, or (no picture) the name in big letters
   with the gold chevron. Dark in both themes, like the other tiles. */
.jx-tile-fit { position: absolute; inset: 0; display: block; overflow: hidden; background: #0A0A0B; }
.jx-tile-fit::before { content: ""; position: absolute; inset: -20px; background: var(--jx-tile) center / cover no-repeat; filter: blur(16px) brightness(.5); }
body.joymax-theme .jx-tile .jx-tile-fit img { position: relative; object-fit: contain; object-position: 50% 50%; transform-origin: 50% 50%; filter: none; }
.jx-tile-name {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: .35em; padding: 0 24px;
  background: radial-gradient(120% 120% at 100% 0%, rgba(239,195,26,.16), transparent 60%), #111418;
  color: #F2F2F2; font: 700 clamp(22px, 2.6vw, 34px)/1.1 var(--head); letter-spacing: .02em; text-transform: uppercase; text-align: center;
}
.jx-tile-name::after { content: ""; width: .7em; height: .7em; flex: none; border: solid #EFC31A; border-width: .16em .16em 0 0; transform: rotate(45deg); }
.jx-pill {
  position: absolute; left: 10px; bottom: 10px; padding: 4px 10px; border-radius: 999px;
  background: rgba(10,10,11,.82); border: 1px solid rgba(255,255,255,.12); color: #F2F2F2;
  font: 700 11px/1.3 var(--body); letter-spacing: .04em; text-transform: uppercase; pointer-events: none;
}
/* (0.6.16) No "Coming soon" badge any more: the coming-soon pictures say it themselves (as live). */

@media (hover: hover) and (pointer: fine) {
  a.jx-tile:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 12px 28px rgba(0,0,0,.28), 0 0 0 1px var(--accent), 0 0 22px color-mix(in srgb, var(--accent) 35%, transparent); }
  body.joymax-theme a.jx-tile:hover img { transform: scale(1.05); }
  .jx-tile.jx-soon:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 20px color-mix(in srgb, var(--accent) 35%, transparent); }
  body.joymax-theme .jx-tile.jx-soon:hover img { filter: var(--tint) brightness(.85); }
}
body.joymax-theme a.jx-tile:focus-visible { outline: none; transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 12px 28px rgba(0,0,0,.28), 0 0 0 2px var(--accent), 0 0 22px color-mix(in srgb, var(--accent) 35%, transparent); }
body.joymax-theme a.jx-tile:focus-visible img { transform: scale(1.05); }

/* ---------- Latest accounts: slides slowly on computers; ‹ › and swipe everywhere ---------- */
.jx-head-actions { display: flex; align-items: center; gap: 8px; }
.jx-head-actions a { margin-inline-start: 12px; }
body.joymax-theme .jx-home .jx-ctrl {
  width: 44px; height: 44px; display: grid; place-items: center; padding: 0; margin: 0; background: var(--plate); border: 0;
  border-radius: var(--r-btn); box-shadow: inset 0 0 0 1px var(--edge); color: var(--ash); cursor: pointer;
  font: 500 var(--t-14) var(--body); transition: transform 160ms ease-out, color var(--out) ease, box-shadow var(--out) ease;
}
body.joymax-theme .jx-home .jx-ctrl:hover { color: var(--paper); background: var(--plate); box-shadow: inset 0 0 0 1px var(--ash); }
body.joymax-theme .jx-home .jx-ctrl:active { transform: scale(.97); }
.jx-ctrl svg { width: 18px; height: 18px; }
body.joymax-theme .jx-home .jx-ctrl.jx-pause { width: auto; padding: 0 16px; }

.jx-viewport { overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent); }
.jx-viewport::-webkit-scrollbar { display: none; }
body.joymax-theme .jx-track { display: flex; gap: 16px; width: max-content; margin: 0; padding: 12px 0 16px; list-style: none; }
.jx-track > li { display: flex; margin: 0; }
body.joymax-theme .jx-home .jx-acc {
  position: relative; width: 256px; flex: none; display: flex; flex-direction: column;
  border: 1px solid var(--edge); border-radius: var(--r-card); overflow: hidden; background: var(--plate); --jx-link: var(--paper);
  transition: border-color var(--out) var(--ease-out);
}
.jx-acc-img { position: relative; display: block; aspect-ratio: 1; overflow: hidden; background: var(--chip-bg); }
body.joymax-theme .jx-acc-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* (0.6.15 speed) Grey until hover: a filter on the card's one picture (was a second, grey copy of every picture, fading
   out on hover; twice the pictures to decode). Same grey, same timing. Placeholder pictures (.jx-ph) stay as they are. */
body.joymax-theme .jx-acc-img img:not(.jx-ph) { filter: grayscale(1) brightness(.78); transition: filter var(--out) var(--ease-out); }
.jx-acc-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.jx-acc-name { font: 600 var(--t-16)/1.3 var(--head); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.jx-acc-row { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.jx-price { font: 700 var(--t-25) var(--head); font-variant-numeric: tabular-nums; transition: color var(--out) var(--ease-out); }
.jx-price small { font: 500 var(--t-12) var(--body); color: var(--dim); margin-inline-start: 4px; }
.jx-price small.jx-from { margin: 0 4px 0 0; }
.jx-left { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-12); color: var(--dim); white-space: nowrap; }
.jx-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); }
@media (hover: hover) and (pointer: fine) {
  body.joymax-theme .jx-home .jx-acc:hover { border-color: var(--gold); transition-duration: var(--in); }
  body.joymax-theme .jx-acc:hover .jx-acc-img img { filter: grayscale(0) brightness(1); transition-duration: var(--in); }
  .jx-acc:hover .jx-price { color: var(--gold-text); transition-duration: var(--in); }
}
body.joymax-theme .jx-home .jx-acc:focus-visible { border-color: var(--gold); outline: none; }
body.joymax-theme .jx-acc:focus-visible .jx-acc-img img { filter: grayscale(0) brightness(1); }

/* ---------- Numbers strip ---------- */
.jx-stats { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--plate); border: 1px solid var(--edge); border-radius: var(--r-card); overflow: hidden; }
.jx-stat { padding: 28px 28px 24px; }
.jx-stat + .jx-stat { border-left: 1px solid var(--edge); }
.jx-stat b { display: block; font: 700 var(--t-39)/1 var(--head); color: var(--gold-text); font-variant-numeric: tabular-nums; letter-spacing: -.01em;
  /* (0.6.15 speed) A fixed-size box of its own (one line tall, full width): while the count-up changes the text, only
     this box is redrawn; the rest of the page is not re-laid out on each step. Same size and look as before. */
  height: 1em; contain: size layout paint; white-space: nowrap; }
.jx-stat span { display: block; margin-top: 8px; font-weight: 600; }
body.joymax-theme .jx-stat p { margin: 2px 0 0; color: var(--dim); font-size: var(--t-14); }

/* ---------- Help: plain blocks; the heading is the link, the whole block clickable ---------- */
.jx-help { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--edge); }
.jx-help > div { position: relative; padding: 24px 24px 24px 0; }
.jx-help > div + div { padding-left: 24px; border-left: 1px solid var(--edge); }
body.joymax-theme .jx-help h3 { font-size: var(--t-20); margin-bottom: 4px; }
body.joymax-theme .jx-help h3 a { transition: color var(--out) ease; }
.jx-help h3 a::after { content: ""; position: absolute; inset: 0; }
body.joymax-theme .jx-help h3 a { --jx-link: var(--paper); }
body.joymax-theme .jx-help h3 a:hover { --jx-link: var(--gold-text); }
body.joymax-theme .jx-help p { color: var(--ash); max-width: 36ch; }

/* ---------- Tablet / phone ---------- */
@media (max-width: 900px) {
  body.joymax-theme .jx-hero { margin-top: 0; background: var(--ink); }
  .jx-hero picture img { position: static; display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-position: 76% 30%; }
  .jx-hero::after { display: none; }
  .jx-hero-in { min-height: 0; padding: 24px 20px 40px; }
  body.joymax-theme .jx-hero h1 { max-width: none; }
  body.joymax-theme .jx-hero .jx-lead { font-size: var(--t-16); margin: 16px 0 24px; }
  body.joymax-theme .jx-home .jx-btn { flex: 1 1 auto; }
  .jx-tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }   /* 2 per row from 600 to 900 px */
  .jx-sec-store { padding-top: 16px; }
  .jx-pill { font-size: 10px; padding: 3px 8px; left: 8px; bottom: 8px; }
  .jx-sec-accounts, .jx-sec-numbers { padding-top: 40px; }
  .jx-sec-help { padding-top: 64px; }
  .jx-home { padding-bottom: 64px; }
  .jx-sec-head { flex-wrap: wrap; }
  body.joymax-theme .jx-sec-head h2 { font-size: var(--t-25); }
  body.joymax-theme .jx-sec-head h2 [lang="ar"] { display: block; margin: 4px 0 0; font-size: var(--t-16); }
  .jx-stats { grid-template-columns: 1fr; }
  .jx-stat { padding: 20px; }
  .jx-stat + .jx-stat { border-left: 0; border-top: 1px solid var(--edge); }
  .jx-stat b { font-size: var(--t-31); }
  .jx-help { grid-template-columns: 1fr; }
  .jx-help > div, .jx-help > div + div { padding: 20px 0; border-left: 0; border-bottom: 1px solid var(--edge); }
}
@media (max-width: 599px) {
  .jx-tiles { grid-template-columns: 1fr; }   /* one tile per row on phones, as live */
}
@media (max-width: 900px), (hover: none) {
  .jx-viewport { scroll-snap-type: x mandatory; mask-image: none; }
  body.joymax-theme .jx-track { gap: 12px; }
  .jx-track [aria-hidden="true"] { display: none; }
  body.joymax-theme .jx-home .jx-acc { width: 72vw; max-width: 256px; scroll-snap-align: start; }
  body.joymax-theme .jx-acc-img img:not(.jx-ph) { filter: none; }   /* colour on touch screens */
  .jx-acc .jx-price { color: var(--gold-text); }
  body.joymax-theme .jx-home .jx-ctrl.jx-pause { display: none; }   /* no auto-slide on touch */
}

/* ---------- Reduce motion: keep colour, drop movement ---------- */
@media (prefers-reduced-motion: reduce) {
  body.joymax-theme a.jx-tile:hover, body.joymax-theme a.jx-tile:focus-visible { transform: none; }
  body.joymax-theme a.jx-tile:hover img, body.joymax-theme a.jx-tile:focus-visible img { transform: none; }
  .jx-track [aria-hidden="true"] { display: none; }
  body.joymax-theme .jx-home .jx-ctrl.jx-pause { display: none; }
  body.joymax-theme .jx-home .jx-btn:active, body.joymax-theme .jx-home .jx-ctrl:active { transform: none; }
}
