/* Mali's Games — neon studio theme.
   body.studio: full theme for the studio pages (home, games catalog, 404).
   body.studio-chrome: a game page that keeps its own palette but uses the studio header, footer
   and breadcrumb. Loaded after site.css; game cards and game pages keep their colours from games.css.
   Colours follow the logo: hot pink → magenta → violet on a deep purple night. */

body.studio, .studio-chrome .site-header, .studio-chrome .site-footer {
  --bg: #0d0618;
  --bg-deep: #08040f;
  --surface: #160a28;
  --ink: #fbf2ff;
  --ink-soft: #ddcdee;
  --muted: #b7a3d0;
  --line: #2a1843;
  --line-strong: #46296c;
  --accent: #ff7ad9;
  --accent-strong: #ffb0ea;
  --accent-tint: #2c1245;
  --focus: #ff7ad9;

  --neon-pink: #ff3fbf;
  --neon-magenta: #d946ef;
  --neon-violet: #8b5cf6;
  --neon: linear-gradient(90deg, var(--neon-pink), var(--neon-magenta) 50%, var(--neon-violet));
  /* Darker stops keep white button text above 4.5:1. */
  --neon-deep: linear-gradient(90deg, #c4127f, #9d1fae 50%, #6b2fd6);
  color-scheme: dark;
}

body.studio {
  background:
    radial-gradient(60rem 40rem at 85% -10%, rgba(139, 92, 246, .22), transparent 60%),
    radial-gradient(50rem 36rem at -10% 10%, rgba(255, 63, 191, .16), transparent 60%),
    var(--bg);
  background-repeat: no-repeat;
  color: var(--ink);
}

.studio ::selection { background: rgba(217, 70, 239, .45); color: #fff; }
.studio .skip-link { background: var(--ink); color: var(--bg); }

/* ---------- Header ---------- */

.studio .site-header, .studio-chrome .site-header {
  background: rgba(13, 6, 24, .78);
  border-bottom-color: var(--line);
  box-shadow: 0 1px 0 rgba(217, 70, 239, .12);
}
/* Over a light game page the translucent bar would turn grey, so it is opaque there. */
.studio-chrome .site-header { background: rgba(13, 6, 24, .97); }
.studio .site-header .container, .studio-chrome .site-header .container { min-height: 72px; }
.brand-wordmark { width: auto; height: 40px; }
@media (max-width: 420px) { .brand-wordmark { height: 32px; } }
.studio .site-nav a, .studio-chrome .site-nav a { color: var(--ink-soft); }
.studio .site-nav a:hover, .studio .site-nav a[aria-current="page"],
.studio-chrome .site-nav a:hover, .studio-chrome .site-nav a[aria-current="page"] { color: #fff; background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--line-strong); }

/* ---------- Type and links ---------- */

.studio .split p a, .studio .section-head p a, .studio .text-link { color: var(--accent); }
.studio .split p a:hover, .studio .section-head p a:hover, .studio .text-link:hover { color: var(--accent-strong); }
.studio .eyebrow, .studio .section-head .eyebrow, .studio .split .eyebrow { color: var(--accent); }
.studio .lede, .studio .section-head p, .studio .split p { color: var(--ink-soft); }
.neon-text {
  background: var(--neon); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--neon-magenta);
}

/* ---------- Buttons ---------- */

.studio .btn-primary {
  background: var(--neon-deep); color: #fff; border: 0;
  box-shadow: 0 0 0 1px rgba(255, 122, 217, .35), 0 10px 30px -10px rgba(217, 70, 239, .7);
  transition: box-shadow .2s ease, filter .2s ease;
}
.studio .btn-primary:hover { color: #fff; filter: brightness(1.12); box-shadow: 0 0 0 1px rgba(255, 122, 217, .6), 0 12px 36px -8px rgba(217, 70, 239, .85); }
.studio .btn-ghost { border-color: var(--line-strong); color: var(--ink); }
.studio .btn-ghost:hover { border-color: var(--accent); color: #fff; background: rgba(217, 70, 239, .1); }

/* ---------- Hero ---------- */

.studio-hero { position: relative; overflow: hidden; }
.studio-hero .hero-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.hero-wordmark { margin: 0 0 .5rem; margin-left: -1.5%; line-height: 0; }
.hero-wordmark img { width: 100%; max-width: 620px; height: auto; }
.studio .hero .tagline { color: var(--ink); }

.hero-logo { position: relative; justify-self: end; width: 100%; max-width: 440px; }
.hero-logo::before {
  content: ""; position: absolute; inset: 8%; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, rgba(217, 70, 239, .35), rgba(139, 92, 246, .12) 55%, transparent 70%);
  filter: blur(24px);
}
.hero-logo img { width: 100%; height: auto; }
@media (prefers-reduced-motion: no-preference) {
  .hero-logo img { animation: neon-hum 6s ease-in-out infinite; }
  @keyframes neon-hum {
    0%, 100% { filter: brightness(1) saturate(1); }
    48% { filter: brightness(1.08) saturate(1.08); }
    50% { filter: brightness(.86); }
    52% { filter: brightness(1.1) saturate(1.1); }
  }
}
@media (max-width: 820px) {
  .studio-hero .hero-grid { grid-template-columns: 1fr; }
  .hero-logo { max-width: 220px; justify-self: start; order: -1; }
}

/* ---------- Sections ---------- */

.studio .section + .section { border-top-color: var(--line); }
.studio .section-head h2, .studio .split h2 { color: var(--ink); }

.studio .values li {
  position: relative; background: var(--surface); border-color: var(--line); overflow: hidden;
  transition: border-color .2s ease, transform .2s ease;
}
.studio .values li::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: var(--neon); opacity: .8; }
.studio .values li:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.studio .values strong { color: var(--ink); }
.studio .values span { color: var(--ink-soft); }

.studio .link-list, .studio .link-list li { border-color: var(--line); }
.studio .link-list a:not(.btn) { color: var(--ink); }
.studio .link-list a:not(.btn):hover { color: var(--accent-strong); }
.studio .link-list a:hover .arrow { color: var(--accent); }
.studio .link-list small { color: var(--muted); }

/* Game cards and the featured game keep their own palette; a soft glow seats them on the dark page. */
.studio .featured, .studio .game-card { box-shadow: 0 24px 60px -30px rgba(139, 92, 246, .55); }

/* ---------- Home: one section per game (generated from games.json) ---------- */

.showcase-list { display: grid; gap: 28px; }
.showcase {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  background: var(--game-bg); color: var(--game-ink);
  border: 1px solid var(--game-line); border-radius: 28px; overflow: hidden;
  box-shadow: 0 24px 60px -30px rgba(139, 92, 246, .55);
}
.showcase:nth-child(even) .showcase-art { order: 2; }
.showcase-art {
  display: grid; place-items: center; padding: clamp(36px, 5vw, 64px); min-height: 360px;
  background:
    radial-gradient(circle at 1px 1px, var(--game-line-strong) 1.2px, transparent 1.6px) 0 0 / 22px 22px,
    var(--game-bg-deep);
}
.showcase-art img { width: min(260px, 70%); border-radius: 22.5%; box-shadow: 0 1px 0 var(--game-line), 0 28px 56px -28px var(--game-shadow); }
.showcase-shots { grid-auto-flow: column; gap: 14px; }
.showcase-shots img { width: auto; max-width: 100%; max-height: 440px; border-radius: 18px; }
.showcase-body { padding: clamp(28px, 5vw, 56px); display: flex; flex-direction: column; justify-content: center; }
.showcase-body h3 { font-size: clamp(2rem, 4.2vw, 3rem); letter-spacing: -0.04em; color: var(--game-ink); margin-bottom: .1em; }
.showcase-body .game-tagline { font-size: 1.25rem; color: var(--game-accent); font-weight: 600; margin-bottom: .9rem; }
.showcase-body p { color: var(--game-ink-soft); }
.highlights { list-style: none; padding: 0; margin: 0 0 1.4rem; display: grid; gap: 6px; }
.highlights li { position: relative; padding-left: 26px; color: var(--game-ink); font-weight: 500; }
.highlights li::before { content: "✓"; position: absolute; left: 0; color: var(--game-accent); font-weight: 700; }
.rule-links p { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--game-muted); margin: 0 0 8px; }
.rule-links ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.rule-links a {
  display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: 0.88rem; font-weight: 500; text-decoration: none;
  color: var(--game-ink); background: var(--game-surface); border: 1px solid var(--game-line-strong);
}
.rule-links a:hover { background: var(--game-tint); color: var(--game-ink); }
.showcase-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 1.6rem; }
.btn-game { background: var(--game-ink); color: var(--game-bg); }
.btn-game:hover { background: var(--game-accent); color: #fff; }
.showcase .btn-store { background: transparent; border: 1px solid var(--game-line-strong); color: var(--game-ink); }
.showcase .btn-store:hover { background: var(--game-tint); }
.store-soon { font-size: 0.92rem; color: var(--game-muted); }
@media (max-width: 820px) {
  .showcase { grid-template-columns: 1fr; }
  .showcase:nth-child(even) .showcase-art { order: 0; }
  .showcase-art { min-height: 0; padding: 32px; }
  .showcase-art img { width: 132px; }
}

/* ---------- Home: support and privacy, one card per game ---------- */

.support-cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.support-cards li {
  display: flex; align-items: center; gap: 16px; padding: 14px 18px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.support-cards img { width: 56px; flex: none; border-radius: 22.5%; }
.support-cards h3 { font-size: 1.1rem; margin: 0 0 2px; color: var(--ink); }
.support-cards p { margin: 0; color: var(--muted); }
.support-cards a { color: var(--accent); font-weight: 500; }
.support-cards a:hover { color: var(--accent-strong); }
.support-more { margin: 18px 0 0; }

/* ---------- How to play: rule cards and rule pages ---------- */

.rule-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 12px; }
.rule-grid a {
  display: block; height: 100%; padding: 18px 20px; text-decoration: none;
  border: 1px solid var(--game-line); border-radius: var(--radius); background: var(--game-surface);
  transition: border-color .2s ease, transform .2s ease;
}
.rule-grid a:hover { border-color: var(--game-line-strong); transform: translateY(-2px); }
.rule-grid strong { display: block; font-size: 1.1rem; color: var(--game-ink); margin-bottom: 4px; }
.rule-grid span { display: block; font-size: 0.93rem; color: var(--game-ink-soft); }
.studio .rule-grid a { background: var(--game-bg); box-shadow: 0 18px 44px -30px rgba(139, 92, 246, .6); }

.rules-header .support-header { margin-bottom: 1.25rem; }
.rules-header .lede { color: var(--game-ink-soft); max-width: 46rem; }
.rules-header .doc-meta { margin-top: 1.25rem; }
.rules-cta { margin-top: 2.6rem; }
.prose .rules-cta h2 { margin-top: 0; }
.rules-cta .hero-actions { align-items: center; }

/* ---------- Footer ---------- */

.studio .site-footer, .studio-chrome .site-footer { border-top-color: var(--line); color: var(--muted); background: var(--bg-deep); }
.studio .footer-brand .brand, .studio-chrome .footer-brand .brand { color: var(--ink); }
.footer-wordmark { width: auto; height: 36px; }
.studio .footer-nav a, .studio-chrome .footer-nav a { color: var(--ink-soft); }
.studio .footer-nav a:hover, .studio-chrome .footer-nav a:hover { color: #fff; }

/* ---------- Breadcrumb on a light game page ---------- */

/* Studio links in the deep neon gradient (every stop is above 5:1 on the light game background). */
.studio-chrome .breadcrumbs a {
  background: linear-gradient(90deg, #c4127f, #9d1fae 55%, #6b2fd6); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: #9d1fae; font-weight: 600;
}
.studio-chrome .breadcrumbs a:hover { text-decoration-color: #9d1fae; }
.studio-chrome .breadcrumbs li + li::before { color: #9d1fae; opacity: .55; }

@media print {
  body.studio { background: #fff; color: #000; }
}

/* Four nav links do not fit beside the wordmark on a phone, so the nav moves to its own row. */
.site-nav a { white-space: nowrap; }
@media (max-width: 600px) {
  html { scroll-padding-top: 116px; }
  .site-header .container, .studio .site-header .container, .studio-chrome .site-header .container {
    flex-wrap: wrap; gap: 2px 16px; min-height: 0; padding-top: 10px; padding-bottom: 6px;
  }
  .site-nav { width: 100%; }
  .site-nav ul { margin-left: -10px; }
}

/* ---------- Language menu (a <details> list, no JavaScript) ---------- */

.site-nav { margin-inline-start: auto; }
.lang-menu { position: relative; flex: none; }
.lang-menu summary {
  display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; cursor: pointer; list-style: none;
  color: #ddcdee; font-size: 0.85rem; font-weight: 600; letter-spacing: 0.04em; box-shadow: inset 0 0 0 1px #46296c;
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover, .lang-menu[open] summary { color: #fff; background: #2c1245; }
.lang-menu ul {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 60; margin: 0; padding: 8px; list-style: none;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; width: min(360px, calc(100vw - 32px));
  background: #160a28; border: 1px solid #46296c; border-radius: 14px; box-shadow: 0 24px 48px -16px rgba(0, 0, 0, .6);
}
.lang-menu a { display: block; padding: 7px 10px; border-radius: 8px; color: #ddcdee; text-decoration: none; font-size: 0.92rem; }
.lang-menu a:hover { background: #2c1245; color: #fff; }
.lang-menu a[aria-current="true"] { color: #fff; background: #2c1245; box-shadow: inset 0 0 0 1px #46296c; }
@media (max-width: 600px) {
  .lang-menu { order: 2; margin-inline-start: auto; }
  .site-nav { order: 3; margin-inline-start: 0; }
}

/* ---------- Right-to-left (Arabic) ---------- */

[dir="rtl"] .highlights li { padding-left: 0; padding-right: 26px; }
[dir="rtl"] .highlights li::before { left: auto; right: 0; }
[dir="rtl"] .toc ol { border-left: 0; border-right: 1px solid var(--game-line, var(--line)); }
[dir="rtl"] .toc a { padding: 5px 14px 5px 0; }
[dir="rtl"] .prose ul, [dir="rtl"] .prose ol { padding-left: 0; padding-right: 1.3em; }
[dir="rtl"] .breadcrumbs li + li::before { margin-right: 0; margin-left: 6px; }
[dir="rtl"] .hero-wordmark { margin-left: 0; margin-right: -1.5%; }
[dir="rtl"] .hero-wordmark img, [dir="rtl"] .brand, [dir="rtl"] .footer-brand .brand { direction: ltr; }
@media (max-width: 600px) { [dir="rtl"] .site-nav ul { margin-left: 0; margin-right: -10px; } }
@media (max-width: 900px) { [dir="rtl"] .toc a { padding-right: 0; } }

/* Letter-spaced, mono labels break joined scripts (Arabic) and conjuncts (Devanagari, Thai). */
html:is([lang="ar"], [lang="hi"], [lang="th"]) :is(.eyebrow, .toc h2, .rule-links p, .facts dt) {
  letter-spacing: 0; font-family: var(--font); text-transform: none;
}

/* Japanese has no spaces; break lines between phrases instead of inside words (Chromium, ignored elsewhere). */
html[lang="ja"] { word-break: auto-phrase; }
