/* =============================================================================
   BASE — reset, root typography, and small utilities
   Depends on tokens.css (link it before this file).
   ============================================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  /* auto — smooth fights ScrollTrigger pin release and feels like a second snap */
  scroll-behavior: auto;
  scroll-padding-top: calc(var(--header-height) + var(--space-4));
}

body {
  min-height: 100dvh;
  background-color: var(--color-bg-base);
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  font-weight: var(--weight-regular);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Deter casual image/video saving (not DRM — determined users can still grab assets) */
img,
video,
.gaming__bg-layer,
.gaming__frame,
.hero__bg,
.pay-card {
  -webkit-user-drag: none;
  user-select: none;
  -webkit-touch-callout: none;
}

img {
  pointer-events: none;
}

a img,
button img,
.brand__mark img,
.support img,
.lang-gate img {
  pointer-events: auto;
}

/* Ambient page backdrop: faint vignette + top accent bloom, layered under all
   content. Static (no animation) so it never competes with the hero. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(46, 232, 199, 0.07), transparent 60%),
    radial-gradient(90% 60% at 100% 100%, rgba(14, 165, 233, 0.05), transparent 55%);
}

/* Film-grain overlay: keeps large dark surfaces from reading as flat/cheap.
   Static SVG noise, very low opacity, sits above content but ignores input. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: none;
  border: none;
}

ul,
ol {
  list-style: none;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  color: var(--color-text-primary);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  font-weight: var(--weight-bold);
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

::selection {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

/* ---- Utilities ---------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.section {
  padding-block: var(--section-padding-y);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-accent);
}

.eyebrow::before {
  content: "";
  width: 1.5rem;
  height: 1px;
  background: var(--color-accent);
}

.section-head {
  max-width: 46rem;
  margin-bottom: var(--space-12);
}

.section-head h2 {
  font-size: var(--text-3xl);
  margin-block: var(--space-4) var(--space-4);
}

.section-head p {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
}

.text-accent {
  color: var(--color-accent);
}

/* Screen-reader-only content */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link — visible only on focus */
.skip-link {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  z-index: var(--z-skip);
  padding: var(--space-3) var(--space-5);
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  border-radius: var(--radius-sm);
  font-weight: var(--weight-semibold);
  transform: translateY(-150%);
  transition: transform var(--duration-base) var(--ease-out);
}

.skip-link:focus {
  transform: translateY(0);
}

/* Lock body scroll when a full-screen overlay (mobile drawer) is open */
body.is-locked {
  overflow: hidden;
}

/* RTL: mirror the whole page layout for FA / AR / CKB…
   …but keep header, footer, and language gate LTR. */
[data-header],
.site-footer,
.lang-gate {
  direction: ltr !important;
}

html.is-rtl main {
  direction: rtl;
}

/* Physical left/right layout flips inside mirrored main */
html.is-rtl .hero__support::before {
  order: 1;
}

html.is-rtl .chapter-discord .discord-panel,
html.is-rtl .chapter-payments .payments-card-stage {
  right: auto;
  left: 0;
}

html.is-rtl .is-pin-active .pin-stage--payments .beat--text {
  left: auto;
  right: 0;
}

html.is-rtl .gaming__cinema {
  right: auto;
  left: clamp(1.25rem, 5vw, 4.5rem);
}

html.is-rtl .gaming__scrim {
  background:
    linear-gradient(270deg, rgba(3, 4, 6, 0.88) 0%, rgba(3, 4, 6, 0.55) 45%, rgba(3, 4, 6, 0.2) 100%),
    linear-gradient(180deg, rgba(3, 4, 6, 0.6) 0%, transparent 25%, transparent 60%, rgba(3, 4, 6, 0.92) 100%);
}

html.is-rtl .about-pillars li {
  border-left: 0;
  border-right: 2px solid var(--color-accent);
  background: linear-gradient(270deg, rgba(46, 232, 199, 0.06), transparent 70%);
}

/* Phone: stack chapters, larger tap targets, no pin dependency */
@media (max-width: 767px) {
  .hero__title {
    font-size: clamp(2rem, 9vw, 2.75rem);
  }

  .hero__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero__actions .btn {
    width: 100%;
    justify-content: center;
  }

  .game-tile__art {
    width: 4.75rem;
    height: 4.75rem;
  }

  .chapter-payments .payments-card-stage {
    position: relative;
    top: auto;
    right: auto;
    transform: none;
    width: min(100%, 20rem);
    margin-inline: auto;
    padding-block: var(--space-6);
  }

  .chapter-payments .beat--text {
    width: 100%;
    max-width: none;
  }

  .about-pillars li {
    padding-inline: var(--space-4);
  }
}
