/* ============================================================
   Zapludo — shared site styles.
   Brand system: Cyan primary, Magenta highlight, Lime accent,
   Midnight neutrals. All colors trace to /design.md.
   Space Grotesk headings, Inter body text. Scroll reveal animations.
   ============================================================ */

/* ===== SKIP LINK (keyboard a11y) ===== */
.skip-link {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -150%);
  z-index: 100;
  padding: 0.6rem 1.1rem;
  border-radius: 0 0 0.6rem 0.6rem;
  background: #0891b2;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  transition: transform 0.18s ease-out;
}
.skip-link:focus {
  transform: translate(-50%, 0);
}

/* ===== FOCUS VISIBILITY =====
   One consistent brand ring for every keyboard-focusable control. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid #06b6d4;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ===== REDUCED MOTION =====
   Honour the OS setting: keep layout, drop the movement. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  [data-scroll-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ===== TYPOGRAPHY ===== */
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.font-heading {
  font-family: 'Space Grotesk', system-ui, sans-serif;
}

/* Font loading guard: hide content until fonts load */
.font-loading body {
  visibility: hidden;
}

/* ===== STICKY HEADER ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(247, 248, 255, 0.85);
  border-bottom: 1px solid rgba(220, 222, 245, 0.5);
  transition: box-shadow 0.3s;
}
.dark .site-header {
  background: rgba(11, 14, 36, 0.85);
  border-bottom-color: rgba(58, 64, 98, 0.5);
}
.site-header.scrolled {
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ===== HERO GRADIENT ===== */
@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.hero-gradient {
  background: linear-gradient(-45deg, #ecfeff, #f0fdff, #cffafe, #ecfeff);
  background-size: 400% 400%;
  animation: gradient-shift 12s ease infinite;
}
.dark .hero-gradient {
  background: linear-gradient(-45deg, #070a1c, #0b0e24, #06202b, #0b0e24);
  background-size: 400% 400%;
  animation: gradient-shift 12s ease infinite;
}

/* ===== HEADINGS ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
}

/* ===== HOMEPAGE HERO SHOWCASE =====
   The featured-game card under the hero doubles as a link, so it lifts on
   hover like the game cards. The cover crossfades as the showcase rotates. */
.hero-shot {
  transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s ease;
}
.hero-shot:hover {
  transform: translateY(-4px);
}
.hero-shot #heroCarouselCover {
  transition: opacity .6s ease, transform .5s cubic-bezier(.2, .8, .2, 1);
}
.hero-shot:hover #heroCarouselCover {
  transform: scale(1.04);
}
@media (hover: none) {
  .hero-shot:hover { transform: none; }
  .hero-shot:hover #heroCarouselCover { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-shot,
  .hero-shot #heroCarouselCover { transition: none; }
  .hero-shot:hover { transform: none; }
  .hero-shot:hover #heroCarouselCover { transform: none; }
}

/* ===== GAME CARDS ===== */
.game-card {
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s;
}
.game-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(6, 182, 212, .14);
}

/* ===== PLAY BUTTON OVERLAY ===== */
.play-overlay {
  transition: opacity .2s, transform .2s;
  opacity: 0;
  transform: scale(0.85);
}
.game-thumb:hover .play-overlay {
  opacity: 1;
  transform: scale(1);
}

/* ===== CATEGORY PILLS ===== */
.cat-pill {
  transition: all .2s;
  border-width: 1.5px;
}
.cat-pill.active {
  background: #06b6d4;
  color: white;
  border-color: #06b6d4;
}
.cat-pill:hover:not(.active) {
  border-color: #67e8f9;
  transform: scale(1.03);
}

/* ===== SCROLL REVEAL ANIMATIONS =====
   Gated on html.js so the content stays visible when JavaScript is blocked;
   the class is added by the early script in head.njk. */
html.js [data-scroll-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
html.js [data-scroll-reveal].visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== FEATURED CARD SHIMMER ===== */
.featured-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.08) 50%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
}
.featured-card:hover::after {
  opacity: 1;
}
.dark .featured-card::after {
  background: linear-gradient(135deg, transparent 40%, rgba(16,185,129,0.10) 50%, transparent 60%);
}

/* ===== SCROLL TO TOP BUTTON ===== */
.scroll-top-btn {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}
.scroll-top-btn.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ===== SEARCH FOCUS RING ===== */
.search-wrap:focus-within {
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.25);
  border-color: #06b6d4;
}

/* ===== HIDDEN GAME CARDS ===== */
.game-card-hidden { display: none !important; }

/* ===== NO RESULTS ANIMATION ===== */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fade-in 0.3s ease-out; }

/* ===== SCROLLBAR HIDE (utility) ===== */
.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

/* ===== CARD HOVER (utility for about/contact pages) ===== */
.card-hover {
  transition: transform .22s cubic-bezier(.2, .8, .2, 1), box-shadow .22s;
}
.card-hover:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 30px rgba(16, 24, 40, .12);
}

/* ===== FEATURE CARDS ("Why play on Zapludo?") =====
   These get their own surface + hover treatment. The entrance animation
   lives on the outer wrapper (.feature-reveal) while the hover lift lives
   on .feature-card, so the two transforms never fight each other. */
.feature-reveal {
  height: 100%;
}

.feature-card {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.75rem 1.25rem;
  border-radius: 1rem;
  background: #ffffff;
  border: 1px solid #dcdef5;
  /* resting elevation so the card reads clearly against the white section band */
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 20px -14px rgba(15, 23, 42, 0.22);
  overflow: hidden;
  transition:
    transform .25s cubic-bezier(.2, .8, .2, 1),
    box-shadow .25s ease,
    border-color .25s ease,
    background-color .25s ease;
}

/* thin brand accent that grows on hover */
.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, #22d3ee, #06b6d4);
  transform: translateX(-50%);
  transition: width .3s cubic-bezier(.2, .8, .2, 1);
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(6, 182, 212, 0.45);
  box-shadow: 0 14px 30px -12px rgba(6, 182, 212, 0.45), 0 4px 12px -6px rgba(15, 23, 42, 0.12);
}

.feature-card:hover::before {
  width: 56%;
}

/* keep a visible focus ring for keyboard users */
.feature-card:focus-within {
  border-color: #06b6d4;
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.25);
}

.feature-icon {
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), background-color .25s ease, box-shadow .25s ease;
}
.feature-card:hover .feature-icon {
  transform: scale(1.08);
  background-color: #cffafe;          /* brand-100 */
  box-shadow: 0 6px 16px -10px rgba(6, 182, 212, 0.75);
}
.dark .feature-card:hover .feature-icon {
  background-color: rgba(6, 182, 212, 0.2);
}

.dark .feature-card {
  /* slightly lighter than the slate-800 section band so the card separates */
  background: #1f2444;
  border-color: #343b63;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 24px -16px rgba(0, 0, 0, 0.7);
}
.dark .feature-card:hover {
  border-color: rgba(6, 182, 212, 0.5);
  box-shadow: 0 16px 34px -14px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(6, 182, 212, 0.25);
}

/* Touch devices: hover states stick after a tap, so only lift on pointer devices */
@media (hover: none) {
  .feature-card:hover { transform: none; }
  .feature-card:hover::before { width: 0; }
  .feature-card:hover .feature-icon {
    transform: none;
    background-color: #ecfeff;          /* brand-50 */
    box-shadow: none;
  }
  .dark .feature-card:hover .feature-icon { background-color: rgba(6, 182, 212, 0.1); }
}

@media (prefers-reduced-motion: reduce) {
  .feature-card:hover { transform: none; }
  .feature-card:hover::before { width: 0; }
  .feature-card:hover .feature-icon { transform: none; }
}

/* ===== CLOSING CTA PANEL ("Ready to play?") =====
   The last push on the homepage. The headline now promises playing and the
   primary button actually goes to the catalogue, instead of asking for
   feedback under a headline about games. */
.cta-panel {
  background: linear-gradient(135deg, #0891b2 0%, #0e7490 45%, #164e63 100%);
  box-shadow: 0 24px 56px -24px rgba(14, 116, 144, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  isolation: isolate;
}

/* soft depth blobs — purely decorative */
.cta-glow { pointer-events: none; z-index: 0; }
.cta-glow-a {
  top: -4rem; right: -4rem;
  width: 14rem; height: 14rem;
  background: rgba(255, 255, 255, 0.16);
}
.cta-glow-b {
  bottom: -5rem; left: -4rem;
  width: 16rem; height: 16rem;
  background: rgba(0, 0, 0, 0.22);
}

/* --- primary: white on cyan, the strongest element in the panel --- */
.cta-primary {
  background: #ffffff;
  color: #0e7490;
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.5);
  transition: transform .2s cubic-bezier(.2, .8, .2, 1), box-shadow .2s ease, background-color .2s ease;
}
.cta-primary:hover {
  background: #ecfeff;                     /* brand-50 */
  transform: translateY(-2px);
  box-shadow: 0 16px 32px -14px rgba(0, 0, 0, 0.55);
}
.cta-primary:active { transform: translateY(0); }
.cta-primary svg { transition: transform .2s cubic-bezier(.2, .8, .2, 1); }
.cta-primary:hover svg { transform: translateX(3px); }

/* --- secondary: "Surprise Me" --- */
.cta-ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  transition: transform .2s cubic-bezier(.2, .8, .2, 1), box-shadow .2s ease, background-color .2s ease, border-color .2s ease;
}
.cta-ghost:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.7);
  transform: translateY(-2px);
  box-shadow: 0 14px 28px -16px rgba(0, 0, 0, 0.5);
}
.cta-ghost:active { transform: translateY(0); }
/* the shuffle glyph spins once on hover, hinting "random" */
.cta-ghost svg { transition: transform .45s cubic-bezier(.3, .8, .3, 1); }
.cta-ghost:hover svg { transform: rotate(180deg); }

/* keyboard focus must stay obvious on both buttons */
.cta-primary:focus-visible,
.cta-ghost:focus-visible,
.cta-chip:focus-visible,
.cta-inline-link:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}

/* --- genre chips --- */
.cta-chip {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  transition: transform .18s cubic-bezier(.2, .8, .2, 1), background-color .18s ease, border-color .18s ease;
}
.cta-chip:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.45);
  transform: translateY(-2px);
}

.cta-inline-link {
  color: #ffffff;
  font-weight: 600;
  transition: color .18s ease, text-decoration-color .18s ease;
}
.cta-inline-link:hover {
  color: #ecfeff;
  text-decoration-color: #ffffff;
}

/* Touch devices: hover sticks after a tap, so drop the lift */
@media (hover: none) {
  .cta-primary:hover,
  .cta-ghost:hover,
  .cta-chip:hover { transform: none; }
  .cta-primary:hover svg { transform: none; }
  .cta-ghost:hover svg { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cta-primary:hover,
  .cta-ghost:hover,
  .cta-chip:hover { transform: none; }
  .cta-primary:hover svg,
  .cta-ghost:hover svg { transform: none; }
  .cta-primary,
  .cta-ghost,
  .cta-chip { transition: none; }
}

/* ===== GAMES HUB: STICKY FILTER TOOLBAR =====
   --toolbar-top is measured from the sticky site header at runtime, because
   the header is taller at the mobile breakpoint and a hard-coded offset
   would leave the toolbar tucked underneath it. */
.games-toolbar {
  position: sticky;
  top: var(--toolbar-top, 0px);
  z-index: 30;
  background: rgba(247, 248, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(220, 222, 245, 0.7);
  border-bottom: 1px solid rgba(220, 222, 245, 0.7);
}
.dark .games-toolbar {
  background: rgba(11, 14, 36, 0.92);
  border-color: rgba(58, 64, 98, 0.7);
}

/* Tailwind emits .flex before .hidden, so toggling both would leave the row
   hidden. Make "visible" explicit instead of fighting the utility order. */
#filterStatus:not(.hidden) { display: flex; }

/* ===== GAMES HUB: SURPRISE ME ===== */
.games-random {
  background: #0891b2;
  color: #ffffff;
  box-shadow: 0 8px 20px -10px rgba(8, 145, 178, 0.75);
  transition: transform .2s cubic-bezier(.2, .8, .2, 1), box-shadow .2s ease, background-color .2s ease;
}
.games-random:hover {
  background: #0e7490;
  transform: translateY(-2px);
  box-shadow: 0 14px 26px -12px rgba(8, 145, 178, 0.8);
}
.games-random:active { transform: translateY(0); }
.games-random svg { transition: transform .45s cubic-bezier(.3, .8, .3, 1); }
.games-random:hover svg { transform: rotate(180deg); }
.games-random:focus-visible,
.games-toolbar select:focus-visible,
.game-card:focus-visible {
  outline: 2px solid #06b6d4;
  outline-offset: 2px;
}

/* Touch devices never fire :hover, so the play overlay would be invisible. */
@media (hover: none) {
  .play-overlay { opacity: 1; transform: scale(1); }
  .games-random:hover { transform: none; }
  .games-random:hover svg { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .games-random,
  .games-random svg,
  .game-card,
  .play-overlay { transition: none; }
  .games-random:hover { transform: none; }
  .games-random:hover svg { transform: none; }
  .game-card:hover { transform: none; }
}


/* ============================================================
   GAME SHOWCASE — richer cards, shelves (carousels), spotlight.
   Neon-midnight styling; all colors trace to /design.md.
   ============================================================ */

/* ===== GAME CARD (enhanced) =====
   Keeps the existing lift from the base .game-card rule and adds a cover
   zoom, a brand-tinted border and a cyan glow on hover. */
.game-cover {
  transition: transform .45s cubic-bezier(.2, .8, .2, 1);
  will-change: transform;
}
.game-card:hover .game-cover {
  transform: scale(1.06);
}
.game-card:hover {
  border-color: rgba(6, 182, 212, 0.45);
  box-shadow: 0 18px 34px -16px rgba(6, 182, 212, 0.5), 0 6px 14px -8px rgba(11, 14, 36, 0.35);
}
.game-card:focus-visible {
  outline: 2px solid #06b6d4;
  outline-offset: 2px;
}

/* Reveal the play affordance on the whole card (the old rule keyed off
   .game-thumb, which the redesigned cards no longer use). */
.game-card:hover .play-overlay {
  opacity: 1;
  transform: scale(1);
}

/* ===== SHELVES (horizontal carousels) ===== */
.shelf-track {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* room for the card lift + glow so hover shadows are not clipped */
  padding: 0.5rem 0.25rem 1rem;
  margin: -0.5rem -0.25rem -1rem;
}
.shelf-track::-webkit-scrollbar { display: none; }

.shelf-btn {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid #dcdef5;
  color: #4b527a;
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease, background-color .18s ease, transform .18s ease;
}
.dark .shelf-btn {
  background: #1b1f3d;
  border-color: #3a4062;
  color: #b9bde0;
}
.shelf-btn:hover {
  color: #0891b2;
  border-color: rgba(6, 182, 212, 0.55);
  transform: translateY(-1px);
}
.shelf-btn:disabled {
  opacity: 0.35;
  cursor: default;
  transform: none;
}
/* When a shelf fits without scrolling, the arrows are just noise. */
.game-shelf.shelf-empty .shelf-btn { display: none; }
@media (hover: none) {
  .shelf-btn { display: none; }
  .game-shelf.shelf-empty .shelf-btn { display: none; }
}

/* ===== SPOTLIGHT (featured game) ===== */
.spotlight {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.spotlight-card {
  transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s ease;
}
.spotlight-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 30px 60px -24px rgba(6, 182, 212, 0.55);
}
.spotlight-thumbs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0.25rem;
}
.spotlight-thumbs::-webkit-scrollbar { display: none; }
.spotlight-thumb {
  position: relative;
  /* Grow to fill the strip (so the row reads as a complete "preview box"),
     but cap the size so the strip doesn't balloon on the wide hub spotlight. */
  flex: 1 1 0;
  min-width: 3.25rem;
  max-width: 5rem;
  height: 3.5rem;
  border-radius: 0.65rem;
  overflow: hidden;
  border: 2px solid transparent;
  background: #0b0e24;
  opacity: 0.65;
  cursor: pointer;
  padding: 0;
  transition: opacity .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.spotlight-thumb svg { width: 100%; height: 100%; display: block; }
.spotlight-thumb:hover { opacity: 0.9; transform: translateY(-1px); }
.spotlight-thumb.is-active {
  opacity: 1;
  border-color: #06b6d4;
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.25);
}
.spotlight-thumb:focus-visible {
  outline: 2px solid #06b6d4;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .game-cover,
  .game-card,
  .spotlight-card,
  .spotlight-thumb,
  .shelf-btn { transition: none; }
  .game-card:hover .game-cover { transform: none; }
  .game-card:hover { transform: none; }
  .spotlight-card:hover { transform: none; }
}

/* ===== HUB FEATURED (side list) ===== */
.featured-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  width: 100%;
  padding: .4rem .5rem;
  border-radius: .8rem;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background-color .18s ease, border-color .18s ease;
}
.featured-item:hover { background: rgba(6, 182, 212, .08); }
.featured-item.is-active { border-color: rgba(6, 182, 212, .5); background: rgba(6, 182, 212, .1); }
.featured-item:focus-visible { outline: 2px solid #06b6d4; outline-offset: 2px; }
.featured-item .fi-thumb { width: 3.6rem; height: 2.7rem; border-radius: .55rem; overflow: hidden; flex-shrink: 0; display: block; }
.featured-item .fi-thumb svg { width: 100%; height: 100%; display: block; }
.featured-item .fi-body { min-width: 0; display: flex; flex-direction: column; }
.featured-item .fi-name { font-size: .85rem; font-weight: 600; color: #0b0e24; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dark .featured-item .fi-name { color: #fff; }
.featured-item .fi-cat { font-size: .72rem; color: #8e95c4; }

/* ===== GENRE TABS (games hub) ===== */
.genre-tab {
  padding: .45rem .95rem;
  border-radius: .7rem;
  border: 1px solid #dcdef5;
  background: #ffffff;
  color: #4b527a;
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color .18s ease, background-color .18s ease, border-color .18s ease;
}
.dark .genre-tab { background: #1b1f3d; border-color: #3a4062; color: #b9bde0; }
.genre-tab:hover { border-color: rgba(6, 182, 212, .5); color: #0891b2; }
.genre-tab.active { background: #06b6d4; border-color: #06b6d4; color: #ffffff; }
.genre-tab:focus-visible { outline: 2px solid #06b6d4; outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .featured-item, .genre-tab { transition: none; }
}
