/* tpl_gaming — light by default, [data-theme="dark"] set by the inline head script / toggle. */
@font-face {
  font-family: "Lilita One";
  src: url("../fonts/lilita-one-latin.woff2") format("woff2");
  font-display: swap;
}

:root {
  --font-display: "Lilita One", "Arial Rounded MT Bold", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bg: #f6f5fc;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --text: #17142b;
  --text-muted: #57536e;
  --line: #e3e0f0;
  --link: #5b21b6;
  --pop: #ff4d8d;          /* second accent: badges, sparkles */
  --sun: #ffc53d;          /* third accent: highlights */
  --danger: #b42318;
  --ok: #067647;
  --radius: 12px;
  --radius-lg: 22px;
  --shadow: 0 1px 2px rgb(23 20 43 / .06), 0 8px 24px rgb(23 20 43 / .06);
  --wrap: 1200px;
  --gutter: clamp(16px, 4vw, 32px);
  /* --accent / --on-accent come from the template style (inline) */
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f0d1e;
  --surface: #17142b;
  --surface-raised: #1e1a37;
  --text: #f2f0ff;
  --text-muted: #aaa5c9;
  --line: #2f2a52;
  --link: #c4b5fd;
  --danger: #ff8a80;
  --ok: #6ee7b7;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 30px rgb(0 0 0 / .35);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 1rem/1.6 var(--font-body);
}
img, svg, video, iframe { max-width: 100%; }
img { height: auto; }
a { color: var(--link); text-underline-offset: .15em; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 400; line-height: 1.1; letter-spacing: .01em; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.35rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.visually-hidden, .sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 100;
  background: var(--accent); color: var(--on-accent); padding: .6rem 1rem; border-radius: var(--radius); font-weight: 700;
}
.skip-link:focus { top: 1rem; }

/* ---------- buttons (also Joomla's .btn-primary etc.) ---------- */
.btn, button.btn, .btn-primary, .btn-secondary, input[type="submit"] {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .55rem 1.2rem; border-radius: 999px;
  font: 1.05rem/1.2 var(--font-display); letter-spacing: .02em; text-decoration: none; cursor: pointer;
  border: 2px solid transparent; transition: transform .1s ease, box-shadow .1s ease;
}
.btn--accent, .btn-primary, input[type="submit"] {
  background: var(--accent); color: var(--on-accent);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 60%, #000);
}
.btn--accent:hover, .btn-primary:hover { transform: translateY(-1px); }
.btn--accent:active, .btn-primary:active { transform: translateY(2px); box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 60%, #000); }
.btn--ghost, .btn-secondary { background: transparent; color: var(--text); border-color: var(--line); }
.btn--ghost:hover, .btn-secondary:hover { border-color: var(--text-muted); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner { display: flex; align-items: center; gap: 1rem; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--text); text-decoration: none; margin-right: auto; }
.brand__mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  background: var(--accent); color: var(--on-accent); font-size: 1rem;
  box-shadow: 3px 3px 0 var(--pop);
  transform: rotate(-6deg);
}
.brand__logo { max-height: 40px; width: auto; }
.brand__name { font: 1.5rem/1 var(--font-display); }

.site-nav { display: flex; align-items: center; gap: 1.25rem; }
.site-nav__menu ul { list-style: none; margin: 0; padding: 0; display: flex; gap: .25rem; }
.site-nav__menu a {
  display: block; padding: .5rem .8rem; border-radius: 999px;
  color: var(--text); text-decoration: none; font-weight: 600;
}
.site-nav__menu a:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.site-nav__menu .current > a, .site-nav__menu .active > a { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--link); }
.account { display: flex; align-items: center; gap: .5rem; }
.account__link { color: var(--text); font-weight: 600; text-decoration: none; padding: .5rem .6rem; }
.account__link:hover { color: var(--link); }
.account__logout { margin: 0; }
.account .btn { min-height: 40px; padding-block: .4rem; font-size: 1rem; }

.theme-toggle {
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  display: grid; place-items: center;
}
.theme-toggle__icon::before { content: "☾"; font-size: 1.15rem; line-height: 1; }
[data-theme="dark"] .theme-toggle__icon::before { content: "☀"; }

.nav-toggle {
  display: none; width: 44px; height: 44px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after {
  display: block; width: 20px; height: 2px; background: currentColor; border-radius: 2px; margin: auto; position: relative; content: "";
}
.nav-toggle__bars::before { position: absolute; top: -6px; }
.nav-toggle__bars::after { position: absolute; top: 6px; }

@media (max-width: 799px) {
  .nav-toggle { display: grid; place-items: center; }
  .site-nav {
    display: none; position: absolute; inset: 100% 0 auto 0;
    flex-direction: column; align-items: stretch; gap: .75rem;
    padding: 1rem var(--gutter) 1.25rem; background: var(--surface);
    border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
  }
  .site-nav.is-open { display: flex; }
  .site-nav__menu ul { flex-direction: column; }
  .account { flex-wrap: wrap; }
}

/* ---------- layout ---------- */
.site-hero { padding-block: clamp(1.5rem, 5vw, 3rem) 0; }
.site-main { flex: 1; padding-block: clamp(1.5rem, 4vw, 3rem); }
.site-main:focus { outline: none; }
.site-footer { border-top: 1px solid var(--line); color: var(--text-muted); font-size: .9rem; }
.site-footer__inner { padding-block: 1.5rem; display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; }
.site-footer__text { margin: 0; }

/* ---------- immersive game page: the game owns the viewport ---------- */
body.is-immersive { height: 100dvh; overflow: hidden; background: #000; }
body.is-immersive .site-main { padding: 0; display: flex; flex-direction: column; min-height: 0; }
body.is-immersive .game-stage { flex: 1; height: auto; min-height: 0; }
body.is-immersive #system-message-container:empty { display: none; }

/* ---------- catalogue (com_games) ---------- */
.games__head { position: relative; margin-bottom: clamp(1.5rem, 4vw, 2.5rem); }
.games__title { font-size: clamp(2.2rem, 6vw, 3.6rem); }
.games__title::after {
  content: ""; display: block; width: 72px; height: 8px; margin-top: .4rem; border-radius: 8px;
  background: linear-gradient(90deg, var(--accent) 0 50%, var(--pop) 50% 75%, var(--sun) 75%);
}
.games__intro { font-size: 1.15rem; }
.game-card__link { border-radius: var(--radius-lg); box-shadow: var(--shadow); border-color: var(--line); background: var(--surface-raised); }
.game-card__link:hover { box-shadow: 0 6px 0 var(--accent), var(--shadow); }
.game-card__cover { position: relative; overflow: hidden; }
.game-card__cover img { transition: transform .3s ease; }
.game-card__link:hover .game-card__cover img { transform: scale(1.04); }
.games__login-hint {
  margin-top: 2rem; padding: 1rem 1.25rem; border-radius: var(--radius);
  background: color-mix(in srgb, var(--sun) 22%, var(--surface)); color: var(--text);
}

/* ---------- forms (com_users login / registration / profile) ---------- */
.com-users-login, .com-users-registration, .com-users-reset, .com-users-remind, .com-users-profile {
  max-width: 480px; margin-inline: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 4vw, 2rem); box-shadow: var(--shadow);
}
fieldset { border: 0; padding: 0; margin: 0 0 1rem; min-width: 0; }
legend { font: 1.4rem/1.2 var(--font-display); margin-bottom: .75rem; }
label, .form-label, .control-label { display: block; font-weight: 600; margin-bottom: .3rem; }
.control-group, .mb-3 { margin-bottom: 1rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="url"], input[type="tel"],
input[type="number"], select, textarea, .form-control, .form-select {
  width: 100%; min-height: 44px; padding: .6rem .8rem;
  font: inherit; color: var(--text); background: var(--bg);
  border: 2px solid var(--line); border-radius: var(--radius);
}
input:focus, select:focus, textarea:focus, .form-control:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.input-group { display: flex; gap: .5rem; }
.input-group .btn, .input-password-toggle { flex: 0 0 auto; border-radius: var(--radius); background: var(--surface); border: 2px solid var(--line); color: var(--text); font-family: var(--font-body); font-size: .9rem; }
.form-check { display: flex; gap: .5rem; align-items: center; }
.form-check label { margin: 0; font-weight: 400; }
.com-users-login__options, .list-group { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .25rem; }
.list-group-item { display: block; padding: .3rem 0; }
.star { color: var(--danger); }
.invalid, .form-control-danger { border-color: var(--danger) !important; }
.form-control-feedback { color: var(--danger); font-size: .9rem; }

/* ---------- Joomla messages ---------- */
#system-message-container { max-width: var(--wrap); margin-inline: auto; }
joomla-alert, .alert {
  display: block; margin: 0 0 1.25rem; padding: .9rem 1.1rem; border-radius: var(--radius);
  border: 1px solid var(--line); border-left-width: 6px; background: var(--surface); color: var(--text);
}
joomla-alert[type="success"], .alert-success { border-left-color: var(--ok); }
joomla-alert[type="info"], .alert-info { border-left-color: var(--accent); }
joomla-alert[type="warning"], .alert-warning { border-left-color: var(--sun); }
joomla-alert[type="danger"], joomla-alert[type="error"], .alert-danger { border-left-color: var(--danger); }
joomla-alert .alert-heading { font-weight: 700; }
joomla-alert .joomla-alert--close { float: right; background: none; border: 0; color: inherit; font-size: 1.4rem; cursor: pointer; }

/* ---------- pagination ---------- */
.pagination { display: flex; flex-wrap: wrap; gap: .3rem; list-style: none; padding: 0; margin: 1.5rem 0 0; }
.pagination .page-link { display: block; min-width: 40px; padding: .4rem .7rem; text-align: center; border-radius: 10px; border: 1px solid var(--line); text-decoration: none; color: var(--text); }
.pagination .active .page-link { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.pagination .disabled .page-link { opacity: .45; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- header profile link ---------- */
.account__profile { display: inline-flex; align-items: center; gap: .5rem; color: var(--text); font-weight: 600; text-decoration: none; padding: .2rem .6rem .2rem .2rem; border-radius: 999px; }
.account__profile:hover { color: var(--link); background: var(--surface-raised); }
.account__avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--surface); }
.account__name { max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
