/* Required Notice: Copyright 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
   SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0 */
/* Landing page styles: the house dark theme, one shared background canvas
   (BackgroundSystem) and CSS-only card motion. No infinite ambient
   animation survives here: everything that moves is either an entrance
   transition or a pointer response, so the page stays at frame budget.
   Shared tokens, the sprite contract, focus and the motion gate live in
   css/house.css; only what is the landing's own stays here. */
:root {
  /* Landing particle tint for BackgroundSystem. A user-picked background
     theme from the profile settings still wins over this default. */
  --bg-particle-colors: #60efff, #8a2be2, #ff6b9a;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-main);
  background: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
/* Static corner glows: depth without a running canvas */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 18% 10%, rgba(96, 239, 255, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 84% 90%, rgba(138, 43, 226, 0.07) 0%, transparent 50%);
}
/* The single background canvas, driven by js/background.js */
#bgCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
/* --- HEADER: the house bar, matching the profile page --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px clamp(16px, 4vw, 32px);
  background: rgba(3, 3, 8, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  margin-right: auto;
  border-radius: 10px;
}

.brand-icon {
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 0 10px rgba(96, 239, 255, 0.35));
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 5px;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.site-nav,
.site-tools {
  display: flex;
  gap: 8px;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

.nav-btn .icon {
  font-size: 1rem;
}

@media (hover: hover) {
  .nav-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-subtle);
  }
}
/* The music toggle states through one ARIA attribute */
.nav-btn[aria-pressed="true"] {
  color: var(--accent-cyan);
}
/* --- HERO --- */
main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.hero {
  position: relative;
  text-align: center;
  padding: clamp(40px, 9vh, 84px) 16px clamp(20px, 4vh, 44px);
}

.hero::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(680px, 86vw);
  height: 100%;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    closest-side,
    rgba(96, 239, 255, 0.09),
    rgba(138, 43, 226, 0.05) 55%,
    transparent
  );
  pointer-events: none;
  z-index: -1;
}

.hero-main {
  font-family: var(--font-display);
  font-size: clamp(2.7rem, 7vw, 5rem);
  font-weight: 800;
  letter-spacing: 0.18em;
  padding-left: 0.18em;
  text-transform: uppercase;
  line-height: 1;
  background: linear-gradient(
    180deg,
    #ffffff 15%,
    var(--accent-cyan) 55%,
    var(--accent-purple)
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 24px rgba(96, 239, 255, 0.25));
}

.hero-divider {
  width: 72px;
  height: 2px;
  margin: 22px auto 18px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--accent-cyan),
    var(--accent-purple),
    transparent
  );
  border-radius: 1px;
}

.hero-sub {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.55em;
  padding-left: 0.55em;
  text-transform: uppercase;
  color: var(--text-muted);
}
/* --- GAMES GRID --- */
/* Centred wrapping flex rather than a grid: a grid's last row always hugs
   the left edge, while a centred flex line centres the leftover three
   cards of seven at every container width. The basis is exactly one
   column of a four-track layout, so a full row stays snug like the grid
   it replaced. */
.games-grid {
  --grid-gap: clamp(16px, 2.5vw, 28px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--grid-gap);
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: clamp(
    8px,
    2vh,
    24px
  ) clamp(16px, 4vw, 32px) clamp(48px, 8vh, 96px);
}

.game-card {
  /* Per-game identity colour, overridden by the game classes below.
     The values come from js/game-registry.js, the single source of
     truth for game accents. */
  --card-accent: var(--accent-cyan);
  --card-accent-rgb: 96, 239, 255;
  flex: 0 1 calc((100% - var(--grid-gap) * 3) / 4);
  min-width: 285px;
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-panel);
  overflow: hidden;
  text-decoration: none;
  color: var(--text-main);
  background: linear-gradient(
    170deg,
    rgba(20, 22, 44, 0.92),
    rgba(8, 8, 20, 0.95)
  );
  border: 1px solid var(--border-subtle);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  transition:
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.game-card.galaxie {
  --card-accent: #00bfff;
  --card-accent-rgb: 0, 191, 255;
}

.game-card.invaders {
  --card-accent: #00ff41;
  --card-accent-rgb: 0, 255, 65;
}

.game-card.asteroids {
  --card-accent: #ff6b6b;
  --card-accent-rgb: 255, 107, 107;
}

.game-card.had {
  --card-accent: #00ff87;
  --card-accent-rgb: 0, 255, 135;
}

.game-card.tetromina {
  --card-accent: #d94fd5;
  --card-accent-rgb: 217, 79, 213;
}

.game-card.labyrinth {
  --card-accent: #ffd700;
  --card-accent-rgb: 255, 215, 0;
}

.game-card.dinosaurus {
  --card-accent: #ffaa33;
  --card-accent-rgb: 255, 170, 51;
}
/* Top hairline in the game's own colour */
.game-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(var(--card-accent-rgb), 0.85),
    transparent
  );
  opacity: 0.55;
  transition: opacity 0.3s ease;
}

.card-visual {
  height: 200px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse 70% 60% at 50% 45%, rgba(var(--card-accent-rgb), 0.13), transparent 70%),
    rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.card-icon {
  height: 104px;
  width: auto;
  filter: drop-shadow(0 0 22px rgba(var(--card-accent-rgb), 0.4));
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 22px 22px 24px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.card-desc {
  flex: 1;
  color: var(--text-muted);
  line-height: 1.55;
  font-size: 0.92rem;
  margin-bottom: 20px;
}

.play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-control);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    color 0.25s ease;
}
/* Pointer work lives behind (hover: hover) so a touch tap never sticks
   the card in its raised state. Transform, border and shadow only: the
   compositor handles every frame. */
@media (hover: hover) {
  .game-card:hover {
    transform: translateY(-6px);
    border-color: rgba(var(--card-accent-rgb), 0.4);
    box-shadow:
      0 24px 48px rgba(0, 0, 0, 0.55),
      0 0 36px rgba(var(--card-accent-rgb), 0.12);
  }

  .game-card:hover::before {
    opacity: 1;
  }

  .game-card:hover .card-icon {
    transform: translateY(-4px) scale(1.05);
  }

  .game-card:hover .play-btn {
    background: rgba(var(--card-accent-rgb), 0.12);
    border-color: rgba(var(--card-accent-rgb), 0.5);
    color: var(--card-accent);
  }
}
/* --- FOOTER --- */
footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-subtle);
}

.footer-link {
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}

@media (hover: hover) {
  .footer-link:hover {
    color: var(--text-main);
  }
}
/* --- ENTRANCE MOTION: one-shot, and only where motion is welcome --- */
@media (prefers-reduced-motion: no-preference) {
  .site-header {
    animation: fadeDown 0.5s ease both;
  }

  .hero {
    animation: fadeUp 0.6s ease both 0.05s;
  }

  .game-card {
    animation: fadeUp 0.5s ease both;
  }

  .game-card:nth-child(2) {
    animation-delay: 0.06s;
  }

  .game-card:nth-child(3) {
    animation-delay: 0.12s;
  }

  .game-card:nth-child(4) {
    animation-delay: 0.18s;
  }

  .game-card:nth-child(5) {
    animation-delay: 0.24s;
  }

  .game-card:nth-child(6) {
    animation-delay: 0.3s;
  }

  .game-card:nth-child(7) {
    animation-delay: 0.36s;
  }

  footer {
    animation: fadeUp 0.6s ease both 0.4s;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

@keyframes fadeDown {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
}
/* --- ACHIEVEMENTS PANEL --- */
.modal-content.ach-panel {
  width: min(800px, 100%);
}

.ach-overall-progress {
  margin-bottom: 25px;
}

.ach-progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.ach-progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.ach-progress-fill {
  height: 100%;
  background: var(--gradient-accent);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.ach-game-section {
  margin-bottom: 30px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.ach-game-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

.ach-game-progress {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

.ach-list {
  display: grid;
  gap: 10px;
}

.ach-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ach-item.unlocked {
  border-color: rgba(96, 239, 255, 0.15);
  background: rgba(96, 239, 255, 0.04);
}

.ach-item.locked {
  opacity: 0.45;
}

@media (hover: hover) {
  .ach-item:hover {
    background: rgba(0, 0, 0, 0.3);
  }

  .ach-item.unlocked:hover {
    border-color: rgba(96, 239, 255, 0.3);
    box-shadow: 0 4px 15px rgba(96, 239, 255, 0.1);
  }
}

.ach-item-icon {
  font-size: 1.8rem;
  line-height: 1;
  min-width: 40px;
  text-align: center;
}

.ach-item-icon .ach-svg-icon,
.ach-item-icon .ach-item-svg {
  width: 32px;
  height: 32px;
  vertical-align: middle;
  display: inline-block;
}

.ach-item.locked .ach-item-icon,
.ach-item.locked .ach-item-icon .ach-svg-icon,
.ach-item.locked .ach-item-icon .ach-item-svg {
  filter: grayscale(1);
}

.ach-item-info {
  flex: 1;
}

.ach-item-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 2px;
}

.ach-item-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ach-xp-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(96, 239, 255, 0.12);
  color: var(--accent-cyan);
  vertical-align: middle;
  margin-left: 4px;
}

.ach-item.locked .ach-xp-badge {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.ach-item-check {
  color: var(--accent-cyan);
  font-size: 1.2rem;
}

.ach-item.locked .ach-item-check {
  color: rgba(255, 255, 255, 0.1);
}
/* --- MODALS --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 3, 8, 0.78);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  width: min(680px, 100%);
  max-height: min(720px, 88vh);
  display: flex;
  flex-direction: column;
  background: var(--panel-gradient);
  border: 1px solid rgba(96, 239, 255, 0.18);
  border-radius: var(--radius-panel);
  padding: 28px;
  box-shadow: var(--shadow-panel);
  transform: translateY(14px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active .modal-content {
  transform: none;
}

.modal-header {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 14px;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  letter-spacing: 1px;
}

.close-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  transition:
    color 0.2s ease,
    background 0.2s ease;
}

@media (hover: hover) {
  .close-btn:hover {
    color: var(--accent-red);
    background: rgba(255, 107, 107, 0.08);
  }
}

.modal-body {
  overflow-y: auto;
}

.modal-body > p {
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 18px;
  font-size: 1.05rem;
  font-weight: 300;
}

.modal-body p:last-child {
  margin-bottom: 0;
}
/* About modal layout */
.about-lead {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.about-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent-cyan);
  border: 1px solid rgba(96, 239, 255, 0.25);
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.about-lead p {
  font-size: 1.05rem;
  color: var(--text-main);
  font-weight: 400;
  line-height: 1.55;
  margin: 0;
  opacity: 0.9;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.about-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 22px 18px;
  text-align: center;
}

.about-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(96, 239, 255, 0.06);
  border: 1px solid rgba(96, 239, 255, 0.1);
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
}

.about-icon-wrap .icon {
  font-size: 1.2rem;
  color: var(--accent-cyan);
}

.about-item h3 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--text-main);
  margin: 0 0 8px;
  font-weight: 600;
  letter-spacing: 1px;
}

.about-item p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}

.about-footer {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.about-footer p {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
  opacity: 0.75;
}

/* Build stamp under the about text: deliberately faint, it must not compete */
.about-footer .about-build {
  margin-top: 10px;
  font-size: 0.75rem;
  font-style: normal;
  letter-spacing: 0.05em;
  opacity: 0.55;
}
/* --- LANGUAGE MENU --- */
.lang-menu {
  position: fixed;
  z-index: 60;
  min-width: 110px;
  padding: 6px;
  display: grid;
  gap: 2px;
  background: rgba(10, 10, 26, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
}

.lang-menu[hidden] {
  display: none;
}

.lang-opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 1px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

@media (hover: hover) {
  .lang-opt:hover {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-main);
  }
}

.lang-opt.active {
  color: var(--accent-cyan);
}
/* --- RESPONSIVE --- */
@media (max-width: 768px) {
  .games-grid {
    justify-content: stretch;
  }

  .game-card {
    flex: 1 1 100%;
    min-width: 0;
  }

  .site-header {
    flex-wrap: wrap;
    gap: 6px;
  }

  .brand {
    flex-basis: 100%;
    justify-content: center;
    margin-right: 0;
  }

  .site-nav,
  .site-tools {
    flex: 1;
    justify-content: center;
  }

  .nav-btn {
    padding: 7px 10px;
    font-size: 0.82rem;
  }

  .hero-main {
    letter-spacing: 0.12em;
    padding-left: 0.12em;
  }

  .hero-sub {
    letter-spacing: 0.35em;
    padding-left: 0.35em;
  }
}

@media (max-width: 600px) {
  .about-grid {
    grid-template-columns: 1fr;
  }

  .about-item {
    padding: 16px;
  }
}
