/* =========================================================
   KEKWHAT - main stylesheet
   ========================================================= */

/* ===== Reset ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

/* ===== Variables ===== */
:root {
  --bg: #0f0a1f;
  --bg-raise: #161033;
  --line: rgba(196, 181, 253, 0.16);
  --text: #efeafd;
  --muted: #a99fd0;
  --accent: #7c3aed;
  --accent-soft: #a78bfa;
  --accent-ink: #c4b5fd;
  --radius: 18px;
  --dock-space: 7rem;           /* room kept free for the dock at the bottom */
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

/* ===== Base ===== */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 1rem;
  background: var(--bg);
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--dock-space) + env(safe-area-inset-bottom));
  overflow-x: clip;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--accent-ink);
  text-underline-offset: 3px;
}

.muted {
  color: var(--muted);
}

/* ===== Hero ===== */
.hero {
  container-type: inline-size; /* makes the "cqi" unit in js/script.js work */
  position: relative;
  isolation: isolate;
  min-height: min(88vh, 46rem);
  min-height: min(88svh, 46rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--bg);
  color: var(--accent-ink);
  padding: max(4.5rem, calc(env(safe-area-inset-top) + 3rem)) 1rem 3.5rem;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
  overflow: hidden;
}

/* everything in the hero (title, buttons, text) always sits above the video */
.hero > :not(.hero__media) {
  position: relative;
  z-index: 2;
}

/* background video layer */
.hero__media {
  position: absolute;
  inset: 0;
  z-index: -3;
  overflow: hidden;
  pointer-events: none;
}

.hero__media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1s ease;
}

.hero.has-video .hero__media video {
  opacity: 0.6;
}

/* purple glow behind the title */
.hero::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto;
  height: 95%;
  z-index: -2;
  background: radial-gradient(60% 60% at 50% 38%, rgba(124, 58, 237, 0.4), transparent 70%);
}

/* with a video: dark patch behind the title, darker top, bottom fades into the page */
.hero.has-video::before {
  inset: 0;
  height: auto;
  background:
    radial-gradient(70% 45% at 50% 45%, rgba(15, 10, 31, 0.65), transparent 75%),
    linear-gradient(180deg, rgba(15, 10, 31, 0.6) 0%, rgba(11, 31, 10, 0.45) 45%, var(--bg) 100%),
    radial-gradient(60% 60% at 50% 38%, rgba(124, 58, 237, 0.3), transparent 70%);
}


.hero__title {
  margin: 1.4rem 0 1.5rem;
  padding: 0.1em 0;
  line-height: 1;
}

/* plain-text fallback, only visible until (or if) the 3D build runs */
.hero__title #kekwhat:not(.depth-text) {
  display: inline-block;
  color: #fff;
  font-weight: 900;
  font-size: clamp(2.2rem, 12cqi, 7rem);
  text-shadow: 0 0.06em 0.12em rgba(124, 58, 237, 0.7);
}

.hero__lede {
  font-size: clamp(1.05rem, 3.8vw, 1.35rem);
  font-weight: 500;
  color: var(--text);
  max-width: 24ch;
  margin-bottom: 1.8rem;
  text-shadow: 0 1px 14px rgba(15, 10, 31, 0.8);
}

.hero__hint {
  margin-top: 1.4rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.hint--mouse { display: none; }

@media (hover: hover) and (pointer: fine) {
  .hint--touch { display: none; }
  .hint--mouse { display: inline; }
}

/* ===== Chip ===== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.12);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.chip__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent-soft);
  box-shadow: 0 0 0 0 rgba(167, 139, 250, 0.6);
  animation: ping 2s infinite;
}

@keyframes ping {
  70%, 100% { box-shadow: 0 0 0 0.6rem rgba(167, 139, 250, 0); }
}

/* ===== Buttons ===== */
.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 30rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 50px;
  padding: 0 1.5rem;
  border: 1px solid transparent;
  border-radius: 14px;
  font: 700 1rem/1 var(--font);
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.btn:active {
  transform: translateY(1px) scale(0.98);
}

.btn:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 3px;
}

.btn--primary {
  color: #fff;
  background: linear-gradient(180deg, #8b5cf6, #6d28d9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 8px 24px -8px rgba(124, 58, 237, 0.8);
}

.btn--ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
}

.btn.is-done {
  background: linear-gradient(180deg, #34d399, #059669);
  border-color: transparent;
  color: #04130d;
}

@media (hover: hover) {
  .btn--primary:hover {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 10px 30px -6px rgba(124, 58, 237, 0.95);
    transform: translateY(-1px);
  }
  .btn--ghost:hover {
    border-color: rgba(196, 181, 253, 0.4);
    background: rgba(255, 255, 255, 0.08);
  }
}

/* ===== Page content ===== */
.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 4rem 1.25rem 1rem;
  padding-left: max(1.25rem, env(safe-area-inset-left));
  padding-right: max(1.25rem, env(safe-area-inset-right));
  flex: 1;
}

.block + .block {
  margin-top: 4.5rem;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-soft);
  margin-bottom: 0.5rem;
}

.container h2 {
  font-size: clamp(1.7rem, 6.2vw, 2.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1.6rem;
}

/* ===== Announcements ===== */
.news {
  display: grid;
  gap: 0.9rem;
}

.news-item {
  display: grid;
  gap: 0.45rem;
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
}

.news-item--pinned {
  border-color: rgba(167, 139, 250, 0.45);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(124, 58, 237, 0.26), rgba(124, 58, 237, 0.03) 60%),
    var(--bg-raise);
}

.news-item__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.news-item__top time {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.news-item h3 {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.25;
}

.news-item p {
  color: var(--muted);
  font-size: 0.97rem;
}

.tag,
.pin {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.4;
}

.pin {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.tag--event   { color: #fbbf24; }
.tag--update  { color: var(--accent-ink); }
.tag--recruit { color: #34d399; }

.news__more {
  width: 100%;
  margin-top: 1rem;
}

/* ===== Gameplay preview ===== */
.player {
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  background: var(--bg-raise);
}

.player__stage {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0a0716;
}

.player__stage > * {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.player__stage video {
  object-fit: contain;
  background: #000;
}

.stage__poster {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background:
    radial-gradient(70% 90% at 30% 20%, rgba(124, 58, 237, 0.55), transparent 70%),
    #120c2b;
  cursor: pointer;
  touch-action: manipulation;
}

.stage__poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stage__poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 10, 31, 0) 40%, rgba(15, 10, 31, 0.65));
}

.stage__play {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 4.6rem;
  height: 4.6rem;
  border-radius: 50%;
  background: rgba(124, 58, 237, 0.92);
  box-shadow: 0 0 0 0.5rem rgba(124, 58, 237, 0.25), 0 12px 32px -8px rgba(0, 0, 0, 0.6);
  transition: transform 0.2s ease;
}

.stage__play svg {
  width: 1.8rem;
  height: 1.8rem;
  margin-left: 0.2rem;
  fill: #fff;
}

.stage__poster:active .stage__play {
  transform: scale(0.94);
}

.stage__poster:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: -4px;
}

@media (hover: hover) {
  .stage__poster:hover .stage__play {
    transform: scale(1.06);
  }
}

.stage__soon {
  display: grid;
  place-content: center;
  gap: 0.2rem;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  background:
    radial-gradient(70% 90% at 30% 20%, rgba(124, 58, 237, 0.3), transparent 70%),
    #120c2b;
}

.player__info {
  padding: 1rem 1.25rem 1.15rem;
}

.player__info h3 {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
}

.player__info p {
  margin-top: 0.15rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

/* swipeable clip strip */
.reel {
  position: relative;
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  margin: 1rem -1.25rem 0;
  padding: 0.25rem 1.25rem 0.6rem;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 1.25rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.reel::-webkit-scrollbar {
  display: none;
}

.thumb {
  flex: 0 0 58%;
  scroll-snap-align: start;
  overflow: hidden;
  padding: 0;
  text-align: left;
  color: inherit;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-raise);
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.thumb__img {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background:
    radial-gradient(80% 100% at 20% 0%, rgba(124, 58, 237, 0.5), transparent 70%),
    #120c2b;
}

.thumb__img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb__n {
  position: absolute;
  left: 0.5rem;
  bottom: 0.4rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}

.thumb__label {
  display: block;
  padding: 0.6rem 0.75rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
}

.thumb[aria-current="true"] {
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.thumb:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 2px;
}

/* ===== Cards ===== */
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.card {
  padding: 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.12), rgba(124, 58, 237, 0.03));
}

.card__num {
  display: block;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent-soft);
  margin-bottom: 0.9rem;
}

.card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.card p {
  color: var(--muted);
  font-size: 0.97rem;
}

/* ===== Join ===== */
.join {
  display: grid;
  gap: 1.6rem;
  margin-top: 4.5rem;
  padding: 1.5rem;
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 22px;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(124, 58, 237, 0.28), rgba(124, 58, 237, 0.04) 60%),
    var(--bg-raise);
}

.join__copy .muted {
  margin-bottom: 1.4rem;
}

.join .btn {
  width: 100%;
}

.steps {
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: 0.7rem;
  align-content: center;
}

.steps li {
  counter-increment: step;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(15, 10, 31, 0.55);
  font-weight: 500;
}

.steps li::before {
  content: counter(step);
  flex: none;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 800;
}

/* ===== Footer ===== */
.footer {
  max-width: 960px;
  width: 100%;
  margin: 3rem auto 0;
  padding: 1.8rem 1.25rem 1rem;
  border-top: 1px solid var(--line);
  text-align: center;
}

.footer__line {
  margin-bottom: 0.4rem;
}

.footer__small {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + var(--dock-space));
  z-index: 50;
  max-width: calc(100% - 2rem);
  padding: 0.7rem 1.1rem;
  border: 1px solid rgba(167, 139, 250, 0.4);
  border-radius: 12px;
  background: #1d1545;
  color: var(--text);
  font-size: 0.92rem;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ===== Motion: load + scroll reveal ===== */
.rise {
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: var(--d, 0s);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* .js is added by script.js, so content never stays hidden if JS fails */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: var(--d, 0s);
}

.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

/* ===== DepthText (3D layered text) ===== */
.depth-text {
  display: inline-block;
  perspective: var(--depth-text-perspective, 900px);
  font-size: var(--depth-text-font-size, clamp(3rem, 12vw, 7rem));
  font-weight: var(--depth-text-font-weight, 900);
  line-height: 1;
  color: var(--depth-text-face-color, currentColor);
  touch-action: pan-y;               /* vertical scroll still works, horizontal drag tilts */
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.depth-text__stage {
  position: relative;
  display: inline-block;
  transform-style: preserve-3d;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.depth-text__layer {
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.depth-text__layer--back {
  text-shadow: var(--depth-text-shadow, none);
}

.depth-text__face {
  position: relative;
  display: block;
  white-space: nowrap;
  color: var(--depth-text-face-color, currentColor);
  text-shadow: var(--depth-text-face-shadow, none);
}

/* outline mode */
.depth-text--outline .depth-text__face,
.depth-text--outline .depth-text__layer {
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 0.025em currentColor;
}

/* ===== Responsive ===== */
@media (min-width: 720px) {
  .cards {
    grid-template-columns: repeat(3, 1fr);
  }
  .container {
    padding-top: 5.5rem;
  }
  .news {
    grid-template-columns: 1fr 1fr;
  }
  .news-item--pinned {
    grid-column: 1 / -1;
  }
  .news__more {
    width: auto;
  }
  .reel {
    margin-inline: 0;
    padding-inline: 0;
    scroll-padding-inline: 0;
  }
  .thumb {
    flex-basis: calc((100% - 2.25rem) / 4);
  }
  .join {
    grid-template-columns: 1.1fr 1fr;
    align-items: center;
    gap: 2.4rem;
    padding: 2.4rem;
  }
  .join .btn {
    width: auto;
  }
}

@media (max-width: 600px) {
  .hero {
    padding-bottom: 3rem;
  }
  .actions {
    flex-direction: column;
  }
  .actions .btn {
    width: 100%;
  }
  .stage__play {
    width: 4rem;
    height: 4rem;
  }
  .footer {
    padding-bottom: 0.5rem;
  }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .rise,
  .chip__dot {
    animation: none;
  }
  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .toast,
  .stage__play,
  .hero__media video {
    transition: none;
  }
  .depth-text__stage {
    will-change: auto;
  }
}