/* ============================================================
   Games landing — "Glass Fluid"
   Frosted-glass UI on top of a WebGL fluid simulation background.
   No other animated decor; the fluid sim is the only moving piece.
   ============================================================ */

.games-page {
  /* Accent palette */
  --bg:        #05040c;
  --bg-deep:   #02020a;
  --ink:       #f3f5ff;
  --muted:     #b3bbe0;
  --pink:      #ff3ea5;
  --cyan:      #29dcff;
  --violet:    #b85bff;
  --amber:     #ffce4d;
  --green:     #6df5b1;

  /* Glass tokens — panels are ~75% see-through (alpha 0.25). */
  --glass-bg:          rgba(255, 255, 255, 0.25);
  --glass-bg-dark:     rgba(10, 8, 28, 0.25);
  --glass-border:      rgba(255, 255, 255, 0.16);
  --glass-border-hot:  rgba(255, 255, 255, 0.3);
  --glass-highlight:   rgba(255, 255, 255, 0.3);
  --glass-shadow:      0 24px 60px -18px rgba(0, 0, 0, 0.5),
                       0 6px 18px -8px rgba(0, 0, 0, 0.3);
  --glass-blur:        blur(18px) saturate(150%);
  --glass-blur-heavy:  blur(24px) saturate(160%);

  position: relative;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
  padding: 110px 0 120px;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

/* WebGL Fluid Simulation canvas — fullscreen background behind all content. */
.games-page .fluid-bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  display: block;
  pointer-events: none;
}

/* Shell */
.games-shell {
  position: relative;
  z-index: 3;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ============================================================
   Unselectable / un-draggable content
   --------------------------------------------------------------
   Clicks on cabinets still navigate — we only disable text
   selection, drag-to-select, the iOS long-press callout, and
   image dragging. Mouse moves still reach the fluid sim because
   its mousemove listener is on `window` (fires regardless of
   what element is under the cursor). Mobile scrolling is
   untouched — the fluid sim's touchmove is passive.
   ============================================================ */
.games-page .games-shell,
.games-page .games-shell * {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.games-page .games-shell img {
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: none;   /* image itself is decorative — click falls to the <a> */
}
.games-page .games-shell a {
  -webkit-user-drag: none;
  user-drag: none;
}

/* ---------- Hero ---------- */
.games-hero {
  text-align: center;
  padding: 1rem 0 3rem;
  position: relative;
}

/* ---------- Artsy editorial title ----------
   "Games & Sandboxes" is not a marquee anymore — it's a two-line
   editorial lockup: a thin italic serif, an oversized ornate gradient
   ampersand that tilts off-axis, a hairline divider, and a letter-
   spaced display-serif caps line. The word spans use mix-blend-mode:
   difference, so as fluid splats drift underneath, the letters
   dynamically invert and re-color against the background — the title
   itself becomes part of the sim. No animation; the fluid does the
   motion. */
.games-marquee {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, auto);
  justify-items: center;
  align-items: center;
  gap: 0;
  margin: 0 auto;
  padding: 0;
  line-height: 0.88;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  max-width: min(92vw, 900px);
}

.games-marquee .m-word {
  display: block;
  font-family: 'Didot', 'Bodoni MT', 'Playfair Display', 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  color: #ffffff;
  mix-blend-mode: difference;   /* re-colors dynamically over fluid splats */
  -webkit-text-fill-color: #ffffff;
  text-shadow: none;
  filter: none;
  padding: 0;
  margin: 0;
}

.games-marquee .m-games {
  font-style: italic;
  font-weight: 300;
  font-size: clamp(3rem, 11vw, 7.6rem);
  letter-spacing: -0.015em;
  transform: translateX(-0.55em);   /* offset left — asymmetric editorial feel */
  line-height: 1;
}

.games-marquee .m-sand {
  font-style: normal;
  font-weight: 400;
  font-size: clamp(1.35rem, 4.2vw, 2.9rem);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  transform: translateX(0.6em);     /* offset right to mirror Games */
  margin-top: 0.35em;
  line-height: 1;
}

.games-marquee .m-amp {
  display: block;
  font-family: 'Didot', 'Bodoni MT', 'Playfair Display', 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(5.2rem, 17vw, 13rem);
  line-height: 0.72;
  background: linear-gradient(120deg,
              #ff3ea5 0%,
              #b85bff 45%,
              #29dcff 100%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter:
    drop-shadow(0 0 22px rgba(255, 62, 165, 0.45))
    drop-shadow(0 0 44px rgba(41, 220, 255, 0.3));
  margin: -0.18em 0 -0.22em;
  transform: rotate(-6deg);
  padding: 0 0.1em;
}

/* Hairline rule under the ampersand — ties the two words into a single lockup. */
.games-marquee .m-rule {
  display: block;
  width: clamp(160px, 28vw, 280px);
  height: 1px;
  margin: 0.25em 0 0.1em;
  background: linear-gradient(90deg,
              transparent 0%,
              rgba(255, 255, 255, 0.55) 50%,
              transparent 100%);
  mix-blend-mode: difference;
}

.games-subtitle {
  margin: 1.6rem auto 0;
  max-width: 56ch;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--muted);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5);
}

/* ---------- Cabinet cards (glass + mist) ---------- */
.games-cabinet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 1.9rem;
  margin-top: 1rem;
}

.games-cabinet {
  position: relative;
  display: block;
  isolation: isolate;
  border-radius: 18px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow:
    var(--glass-shadow),
    inset 0 1px 0 var(--glass-highlight);
  backdrop-filter: var(--glass-blur-heavy);
  -webkit-backdrop-filter: var(--glass-blur-heavy);
  transition:
    transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 0.3s ease,
    border-color 0.3s ease;
  will-change: transform;
}

/* Static misty sheen — no animation, just a frosted highlight across the top. */
.games-cabinet::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(120% 60% at 20% 0%, rgba(255, 255, 255, 0.14), transparent 55%),
    radial-gradient(100% 60% at 80% 0%, rgba(255, 255, 255, 0.08), transparent 55%);
  opacity: 0.9;
}

/* SVG feTurbulence noise gives the "rained on" frosted texture — static. */
.games-cabinet::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.16;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.9 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/></svg>");
  background-size: 160px 160px;
}

.games-cabinet:hover {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--accent, #29dcff) 55%, var(--glass-border-hot));
  box-shadow:
    0 34px 70px -20px rgba(0, 0, 0, 0.65),
    0 0 0 1px color-mix(in srgb, var(--accent, #29dcff) 40%, transparent),
    0 0 34px color-mix(in srgb, var(--accent, #29dcff) 28%, transparent),
    inset 0 1px 0 var(--glass-highlight);
}

.games-cabinet-marquee {
  position: relative;
  z-index: 1;
  padding: 0.75rem 1rem;
  background: var(--glass-bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.games-cabinet-genre {
  position: relative;
  font: 700 0.66rem/1 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent, #29dcff);
  text-shadow: 0 0 8px color-mix(in srgb, var(--accent, #29dcff) 70%, transparent);
}

/* Screen area: image fills it edge-to-edge — no padding, no frame, no scanlines. */
.games-cabinet-screen {
  position: relative;
  z-index: 1;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  display: block;
  background: var(--glass-bg-dark);
}
.games-cabinet-screen img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* Fallback title (for games without a cover image) — static, no twinkle. */
.games-cabinet-title-screen {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex !important; /* override the inline display:none when active */
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 0.85rem;
  color: var(--accent, #29dcff);
  text-shadow: 0 0 10px currentColor;
  text-align: center;
  letter-spacing: 0.05em;
}
/* Keep the inline display:none working until the img onerror flips it. */
.games-cabinet-title-screen[style*="display:none"],
.games-cabinet-title-screen[style*="display: none"] {
  display: none !important;
}

.games-cabinet-body {
  position: relative;
  z-index: 1;
  padding: 1rem 1.15rem 1.2rem;
  background: var(--glass-bg-dark);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.games-cabinet-title {
  font-size: 1.06rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  color: #fff;
  letter-spacing: 0.005em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
}
.games-cabinet-summary {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Accent classes based on genre */
.acc-cyan   { --accent: #29dcff; }
.acc-pink   { --accent: #ff3ea5; }
.acc-amber  { --accent: #ffce4d; }
.acc-green  { --accent: #6df5b1; }
.acc-violet { --accent: #b85bff; }
.acc-coral  { --accent: #ff9b6e; }
.acc-sky    { --accent: #8ea9ff; }
.acc-teal   { --accent: #6ef0d8; }
.acc-rose   { --accent: #ff6e9b; }

/* ============================================================
   dat.GUI glass override — matches the cabinet + heading vibe
   ============================================================ */
.dg.ac {
  position: fixed !important;
  top: 80px !important;
  right: 0 !important;
  left: auto !important;
  z-index: 40 !important;
}
.dg.main {
  position: relative;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif !important;
  /* 75% see-through (alpha 0.25) — matches the cabinet panels. */
  background: rgba(8, 6, 22, 0.25) !important;
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.16)) !important;
  border-radius: 14px !important;
  box-shadow:
    0 24px 60px -18px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 1px 0 rgba(255, 255, 255, 0.28) inset !important;
  backdrop-filter: blur(22px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(22px) saturate(160%) !important;
  overflow: hidden !important;
  margin-right: 14px !important;
  margin-top: 14px !important;
}

/* "Fluid Controls" header bar — injected as a ::before on the panel so
   it shows whether the list is expanded or collapsed. */
.dg.main::before {
  content: "Fluid Controls";
  display: block;
  padding: 12px 14px 11px;
  font: 700 0.72rem/1 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: #ffffff;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

.dg.main.taskbar { display: none !important; }

/* Close-button doubles as the minimize/maximize toggle.
   dat.GUI puts a `closed` class on the inner <ul> when the panel is
   collapsed; we swap the glyph via :has() so the button is labeled
   "Minimize" while expanded and "Maximize" while collapsed. */
.dg.main .close-button {
  background: rgba(255, 255, 255, 0.04) !important;
  color: #c7cdee !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  font-size: 0 !important;                 /* hide default "Close/Open Controls" text */
  letter-spacing: 0 !important;
  text-transform: none !important;
  height: 32px !important;
  line-height: 32px !important;
  position: relative;
  transition: background 0.2s ease, color 0.2s ease !important;
}
.dg.main .close-button::before {
  font: 700 0.72rem/32px 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  content: "— Minimize";   /* expanded state */
  color: inherit;
}
.dg.main:has(ul.closed) .close-button::before {
  content: "+ Maximize";    /* collapsed state */
}
.dg.main .close-button:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
}

.dg .cr {
  background: transparent !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}
.dg .cr.function, .dg .cr.number, .dg .cr.color,
.dg .cr.boolean, .dg .cr.string {
  background: transparent !important;
}
.dg .cr.function:hover, .dg .cr.number:hover,
.dg .cr.boolean:hover, .dg .cr.string:hover {
  background: rgba(255, 255, 255, 0.04) !important;
}

.dg .property-name {
  color: #e7ebff !important;
  font-weight: 500 !important;
  font-size: 12px !important;
  letter-spacing: 0.04em !important;
}

.dg .c .slider {
  background: rgba(255, 255, 255, 0.06) !important;
  border-radius: 999px !important;
  overflow: hidden !important;
}
.dg .c .slider-fg {
  background: linear-gradient(90deg, var(--cyan, #29dcff), var(--violet, #b85bff)) !important;
}
.dg .c .slider:hover .slider-fg, .dg .c .slider-fg:hover {
  background: linear-gradient(90deg, var(--pink, #ff3ea5), var(--cyan, #29dcff)) !important;
}

.dg .c input[type=text], .dg .c select {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 6px !important;
  padding: 2px 6px !important;
  outline: none !important;
}
.dg .c input[type=text]:focus, .dg .c select:focus {
  border-color: rgba(41, 220, 255, 0.6) !important;
  box-shadow: 0 0 0 3px rgba(41, 220, 255, 0.18) !important;
}

.dg .c input[type=checkbox] { accent-color: var(--pink, #ff3ea5) !important; }

.dg .folder > .title {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #fff !important;
  font: 700 0.68rem/1 'JetBrains Mono', ui-monospace, monospace !important;
  letter-spacing: 0.2em !important;
  text-transform: uppercase !important;
  border-top: 1px solid rgba(255, 255, 255, 0.07) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
  padding: 8px 10px 8px 22px !important;
}
.dg .folder > .title:hover { background: rgba(255, 255, 255, 0.08) !important; }

.dg .cr.function .property-name {
  color: var(--cyan, #29dcff) !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.12em !important;
  font-size: 11px !important;
}

/* Hide the upstream demo's promo links (GitHub / Twitter / Discord / mobile app). */
.dg .cr.function.bigFont,
.dg .cr.function.appBigFont { display: none !important; }

/* ---------- Mobile tweaks ---------- */
@media (max-width: 720px) {
  .games-page { padding: 90px 0 80px; }
  .games-shell { padding: 0 1.25rem; }
  .games-section-head { padding: 0.75rem 1rem; }
  .games-cabinet-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.1rem; }
  .games-cabinet {
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
  }
  .dg.main { transform: scale(0.92); transform-origin: top right; }
}

@media (prefers-reduced-motion: reduce) {
  .games-page .fluid-bg { display: none !important; }
}
