/* joyboy.club — the playground */

:root {
  --bg: #0f0d1d;
  --bg-soft: #17142b;
  --ink: #f4f1e8;
  --body: #a49ec2;
  --rule: #2a2740;
  --coral: #ff5d73;
  --sun: #ffc53d;
  --mint: #3ddc97;
  --sky: #4cc9f0;
  --grape: #9d6bff;
  --gum: #ff8fd8;
  --tang: #ff8c42;
  --display: 'Fredoka', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --sans: 'Archivo', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background:
    radial-gradient(120% 90% at 50% 0%, #1a1533 0%, var(--bg) 58%);
  background-color: var(--bg);
  color: var(--body);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

::selection { background: rgba(157, 107, 255, 0.4); color: var(--ink); }

.label {
  font-family: var(--display);
  font-weight: 500;
  font-size: 12.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--body);
}
.label strong { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------- hero */

.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
}

#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
}
.no-webgl #stage { display: none; }

.hero-top {
  position: absolute;
  z-index: 3;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 24px 26px 0;
  pointer-events: none;
}
.hero-top .dotline { display: inline-flex; gap: 6px; align-items: center; }
.hero-top .dotline i {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.hero-top .dotline i:nth-child(1) { background: var(--coral); }
.hero-top .dotline i:nth-child(2) { background: var(--sun); }
.hero-top .dotline i:nth-child(3) { background: var(--mint); }
.hero-top .dotline i:nth-child(4) { background: var(--sky); }
.hero-top .dotline i:nth-child(5) { background: var(--grape); }

/* Static DOM title: paints instantly, fades out once the particle stage is
   live (stays in the accessibility tree), and returns if WebGL is missing. */
.fallback-title {
  display: flex;
  position: absolute;
  inset: 0;
  z-index: 1;
  margin: 0;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(56px, 12vw, 150px);
  line-height: 1.05;
  letter-spacing: 0.02em;
  pointer-events: none;
  transition: opacity 0.7s ease;
}
.fallback-title .w1 { color: var(--coral); }
.fallback-title .w2 { color: var(--sun); }
.fallback-title .w3 { color: var(--sky); }
.staged .fallback-title { opacity: 0; }
.no-webgl .fallback-title { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .fallback-title { transition: none; } }

.hero-foot {
  position: absolute;
  z-index: 3;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 0 26px 26px;
}

/* The tagline: a playground-sign subtitle in the site's rounded display voice,
   with the candy palette flowing through the letters like running lights. */
.tagline {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(27px, 4.2vw, 42px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-wrap: balance;
  color: var(--ink);                    /* fallback where text-clip unsupported */
  background-image: linear-gradient(
    92deg,
    #ff5d73, #ffc53d, #3ddc97, #4cc9f0, #9d6bff, #ff8fd8, #ff8c42,
    #ff5d73, #ffc53d, #3ddc97, #4cc9f0, #9d6bff, #ff8fd8, #ff8c42
  );
  background-size: 200% 100%;
  background-position: 0% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: tagline-flow 8s linear infinite;
  will-change: background-position;
}
@keyframes tagline-flow { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .tagline { animation: none; }
}

.confetti-btn {
  display: none;                     /* JS-only control; .js-armed reveals it */
  font-family: var(--display);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  background: none;
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  padding: 12px 22px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 1s ease 0.3s, border-color 0.25s, transform 0.2s, color 0.25s;
}
.js-armed .confetti-btn { display: inline-block; }
.js-armed .confetti-btn[hidden] { display: none; }
.confetti-btn:hover, .confetti-btn:focus-visible {
  border-color: var(--sun);
  color: var(--sun);
  transform: translateY(-2px);
}
.confetti-btn:focus-visible { outline: 2px solid var(--sun); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .confetti-btn { transition: none; } }

/* boot fade — pre-hidden only once module JS proves alive (.js-armed);
   .confetti-btn keeps its own transition list (includes opacity) above */
.hero-top, .tagline { transition: opacity 1s ease 0.3s; }
.js-armed:not(.booted) .hero-top,
.js-armed:not(.booted) .tagline,
.js-armed:not(.booted) .confetti-btn { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .hero-top, .tagline, .confetti-btn { opacity: 1; transition: none; }
}

/* ------------------------------------------------------------- rides */

.rides {
  max-width: 1180px;
  margin: 0 auto;
  padding: 96px 24px 28px;
}

/* section header */
.rides-head { display: flex; align-items: baseline; gap: 20px; }
.rides-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(22px, 3vw, 32px);
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
}
.rides-line {
  flex: 1;
  height: 3px;
  border-radius: 3px;
  align-self: center;
  background: linear-gradient(90deg,
    var(--coral), var(--sun), var(--mint), var(--sky), var(--grape), var(--gum), var(--coral));
  background-size: 300% 100%;
  animation: rides-line-flow 12s linear infinite;
}
@keyframes rides-line-flow { to { background-position: -300% 0; } }
.rides-count {
  font-family: var(--display);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 13px;
  color: var(--body);
  white-space: nowrap;
}
.rides-count strong { color: var(--mint); font-weight: 700; font-size: 1.5em; }

/* card grid */
.rides-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 26px;
  margin-top: 34px;
}

/* a ride card */
.ride {
  --accent: var(--sun);
  display: flex;
  flex-direction: column;
  background: var(--bg-soft);
  border: 1.5px solid color-mix(in srgb, var(--accent) 24%, var(--rule));
  border-radius: 18px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.ride:hover, .ride:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 24px 60px -28px color-mix(in srgb, var(--accent) 80%, transparent);
}
.ride:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent),
              0 24px 60px -28px color-mix(in srgb, var(--accent) 80%, transparent);
}

/* preview */
.ride-shot {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #0a0816;
}
.ride-shot img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.ride:hover .ride-shot img, .ride:focus-visible .ride-shot img { transform: scale(1.06); }
.ride-shot::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg,
    rgba(10, 8, 22, 0.55) 0%, transparent 26%, transparent 66%, rgba(10, 8, 22, 0.5) 100%);
  pointer-events: none;
}

.ride-num {
  position: absolute; top: 12px; left: 14px; z-index: 2;
  font-family: var(--display); font-weight: 700;
  font-size: 30px; line-height: 1;
  color: var(--accent);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}
.ride-num::before { content: '№'; font-size: 0.55em; vertical-align: 0.55em; margin-right: 2px; opacity: 0.85; }

.ride-status {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--display); font-weight: 500;
  font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink);
  background: rgba(10, 8, 22, 0.6);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 999px;
  padding: 5px 11px 5px 9px;
  backdrop-filter: blur(6px);
}
.ride-status i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--mint) 70%, transparent);
  animation: status-pulse 2.4s ease-out infinite;
}
@keyframes status-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--mint) 65%, transparent); }
  70%, 100% { box-shadow: 0 0 0 7px transparent; }
}

/* card body */
.ride-body {
  display: flex; flex-direction: column;
  gap: 12px;
  padding: 22px 24px 24px;
  flex: 1;
}
.ride-title {
  margin: 0;
  font-family: var(--display); font-weight: 600;
  font-size: clamp(24px, 2.6vw, 30px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--ink);
  transition: color 0.25s ease;
}
.ride:hover .ride-title, .ride:focus-visible .ride-title { color: var(--accent); }
.ride-desc {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--body);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ride-tags {
  margin: 2px 0 0;
  font-family: var(--display); font-weight: 500;
  font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: color-mix(in srgb, var(--accent) 70%, var(--body));
}
.ride-go {
  margin-top: auto;
  font-family: var(--display); font-weight: 600;
  font-size: 14px; letter-spacing: 0.02em;
  color: var(--accent);
  opacity: 0.7;
  transition: opacity 0.25s ease;
}
.ride-go span { display: inline-block; transition: transform 0.25s ease; }
.ride:hover .ride-go, .ride:focus-visible .ride-go { opacity: 1; }
.ride:hover .ride-go span, .ride:focus-visible .ride-go span { transform: translateX(5px); }

/* under-construction card */
.ride--soon { border-style: dashed; }
.ride--soon .ride-title, .ride--soon .ride-desc { color: var(--body); }
.ride-shot--tape {
  background: repeating-linear-gradient(-52deg,
    var(--sun) 0 22px, #1c1832 22px 44px, var(--coral) 44px 66px, #1c1832 66px 88px,
    var(--sky) 88px 110px, #1c1832 110px 132px);
  background-size: 260px 100%;
  animation: tape-roll 16s linear infinite;
  opacity: 0.85;
}
.ride--soon .ride-num {
  color: var(--ink);
  background: rgba(10, 8, 22, 0.62);
  border-radius: 9px;
  padding: 2px 9px;
  backdrop-filter: blur(4px);
  text-shadow: none;
}
.ride-status--soon {
  color: var(--body);
  border-color: var(--rule);
}
@keyframes tape-roll { to { background-position: -260px 0; } }

/* scroll-reveal (armed only when the module confirms it can drive it) */
.reveal-armed .ride {
  opacity: 0;
  transform: translateY(30px);
  transition: border-color 0.3s ease, box-shadow 0.3s ease,
              opacity 0.6s ease var(--d, 0ms),
              transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) var(--d, 0ms);
}
.reveal-armed .ride.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .rides-line, .ride-shot--tape, .ride-status i { animation: none; }
  .ride-shot img { transition: none; }
  .reveal-armed .ride { opacity: 1; transform: none; transition: border-color 0.3s ease, box-shadow 0.3s ease; }
}

@media (max-width: 720px) {
  .rides-grid { grid-template-columns: 1fr; gap: 20px; }
}

/* ------------------------------------------------------------ footer */

footer {
  max-width: 1180px;
  margin: 64px auto 0;
  padding: 26px 24px 36px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
}
footer .made { margin: 0; font-size: 15.5px; }

/* -------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .entry, .standby { grid-template-columns: 96px 1fr; gap: 22px; }
  .scope { grid-column: 2; max-width: 440px; }
  .standby .s-right { grid-column: 2; text-align: left; margin-top: -12px; }
  .standby { row-gap: 6px; }
}

@media (max-width: 880px) {
  .hero-foot { flex-direction: column; align-items: flex-start; gap: 18px; }
}

@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .hero-top { padding: 16px 18px 0; }
  .hero-top .label { font-size: 10.5px; white-space: nowrap; }
  .hero-top .dotline { display: none; }
  .hero-foot { padding: 0 18px 22px; }
  .rides { padding: 64px 18px 12px; }
  .entry { padding: 34px 0; margin-top: 26px; }
  .entry, .standby { grid-template-columns: 1fr; gap: 14px; }
  .scope { grid-column: 1; max-width: none; }
  .e-num { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
  .e-num br { display: none; }
  .standby .s-right { grid-column: 1; margin-top: 0; }
  .standby { padding: 18px 0; }
  footer { flex-direction: column; gap: 6px; margin-top: 44px; }
}
