:root {
  --ink: #05070f;
  --paper: #f5f3ee;
  --paper-2: rgb(245 243 238 / 0.56);
  --paper-3: rgb(245 243 238 / 0.32);
  --lantern: #fff1d6;
  --lantern-glow: rgb(255 226 170 / 0.75);

  --sans: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mark: "Cinzel", "Trajan Pro", Georgia, serif;
  --arabic: "Amiri", "Noto Naskh Arabic", "Geeza Pro", serif;

  --t-hero: clamp(3.1rem, 8.6vw, 9rem);
  --t-display: clamp(2.5rem, 6vw, 6rem);
  --t-title: clamp(2.2rem, 5.2vw, 5.25rem);
  --t-lead: clamp(1.0625rem, 1.5vw, 1.375rem);

  --gutter: clamp(20px, 4.5vw, 72px);
  --radius: clamp(20px, 2.2vw, 32px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--ink);
  -webkit-text-size-adjust: 100%;
}
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font: 400 1.0625rem/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img { display: block; max-width: 100%; }
h1, h2, h3, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 4px;
  border-radius: 8px;
}

h1, h2, h3 {
  font-weight: 600;
  letter-spacing: -0.045em;
  text-wrap: balance;
}
h2 span:not(.w), .lines span { color: var(--paper-2); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 600 0.9375rem/1 var(--mark);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.brand img { image-rendering: pixelated; }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 54px;
  padding-inline: 26px 28px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 500;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: transform 0.4s var(--ease), background-color 0.3s;
}
.pill svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.pill:hover { transform: scale(1.03); background: #fff; }
.pill:active { transform: scale(0.98); }
.pill--small {
  height: 38px;
  padding-inline: 18px;
  font-size: 0.9375rem;
}

.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) var(--gutter) 18px;
  pointer-events: none;
}
.nav > * { pointer-events: auto; }
.nav .brand { text-shadow: 0 1px 12px rgb(0 0 0 / 0.5); }

.heal {
  --p: 0;
  position: relative;
  height: 460vh;
  height: 460svh;
}
.heal__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
}
.heal__world, .frame, .heal__shade { position: absolute; inset: 0; }
.frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 40% 100%;
}
.frame:not(:first-child) {
  opacity: clamp(0, calc((var(--p) * 3 - var(--i) + 0.5) * 2), 1);
  will-change: opacity;
}
.heal__shade {
  background:
    linear-gradient(180deg, rgb(5 7 15 / 0.55), transparent 38%),
    linear-gradient(0deg, rgb(5 7 15 / 0.6), transparent 42%);
}

.wraith, .angel {
  position: absolute;
  translate: -50% -50%;
}
.wraith {
  left: 67%;
  top: 44%;
  height: min(92svh, 64vw);
  aspect-ratio: 1;
  scale: var(--ws, 1);
  opacity: var(--wo, 1);
}
.wraith__body, .angel__body { position: relative; height: 100%; }
.wraith__body::before {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgb(120 70 190 / 0.38), rgb(90 40 140 / 0.14) 60%, transparent);
}
.wraith img { position: relative; filter: brightness(1.18) saturate(1.1); }
.wraith img, .angel img {
  height: 100%;
  width: auto;
  animation: hover 7s ease-in-out infinite;
}
.burst {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 46%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(closest-side, #fff, rgb(255 236 200 / 0.8) 30%, rgb(255 150 90 / 0.25) 60%, transparent);
  mix-blend-mode: screen;
  opacity: 0;
}
.angel {
  left: 37%;
  top: 53%;
  height: min(34svh, 26vw);
  aspect-ratio: 724 / 811;
  z-index: 1;
  opacity: clamp(0, calc((var(--p) - 0.04) * 14), 1);
}
.angel img { animation-duration: 3.6s; animation-delay: -1.2s; }

@keyframes hover {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -2.4%; }
}

.intro {
  position: absolute;
  left: var(--gutter);
  bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(36px, 9svh, 104px));
  z-index: 2;
  display: grid;
  justify-items: start;
  gap: 20px;
  opacity: clamp(0, calc(1 - var(--p) * 9), 1);
  translate: 0 calc(var(--p) * -320px);
}
.intro h1 {
  font-size: var(--t-hero);
  line-height: 0.9;
  letter-spacing: -0.05em;
}
.intro p {
  font-size: var(--t-lead);
  color: var(--paper-2);
  margin-bottom: 8px;
}

.lines {
  position: absolute;
  left: var(--gutter);
  top: clamp(108px, 20svh, 220px);
  z-index: 2;
  display: grid;
  width: min(46vw, 760px);
}
.lines li {
  grid-area: 1 / 1;
  font-size: var(--t-display);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.045em;
  text-wrap: balance;
  text-shadow: 0 2px 40px rgb(0 0 0 / 0.35);
  opacity: 0;
  translate: 0 28px;
  filter: blur(8px);
  transition: opacity 0.7s var(--ease), translate 0.9s var(--ease), filter 0.7s var(--ease);
}
.lines li.is-on { opacity: 1; translate: 0 0; filter: blur(0); }

.hud {
  position: absolute;
  right: var(--gutter);
  bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(28px, 6svh, 64px));
  z-index: 2;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-variant-numeric: tabular-nums;
  opacity: clamp(0, calc((var(--p) - 0.06) * 12), 1);
}
.hud__n {
  font-size: clamp(2.25rem, 4vw, 3.5rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  min-width: 3ch;
  text-align: right;
}
.hud__of { color: var(--paper-2); font-size: 1rem; }

.realms {
  --rp: 0;
  --dist: 0;
  position: relative;
  height: 300vh;
}
.realms__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(28px, 6svh, 64px);
}
.realms__head {
  display: grid;
  gap: 14px;
  padding-inline: var(--gutter);
}
.realms__head h2, .modes h2 { font-size: var(--t-title); line-height: 0.98; }
.realms__head p { font-size: var(--t-lead); color: var(--paper-2); max-width: 34ch; }
.realms__track {
  display: flex;
  gap: clamp(14px, 1.6vw, 24px);
  width: max-content;
  padding-inline: var(--gutter);
  translate: calc(var(--rp) * var(--dist) * -1px) 0;
  will-change: translate;
}
.realm {
  position: relative;
  width: min(60vw, 60svh * 16 / 9);
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: #11131c;
}
.realm img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: scale 1.2s var(--ease);
}
.realm:hover img { scale: 1.04; }
.realm::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgb(5 7 15 / 0.62), transparent 46%);
  pointer-events: none;
}
.realm p {
  position: absolute;
  left: clamp(18px, 2.2vw, 32px);
  bottom: clamp(16px, 2vw, 28px);
  z-index: 1;
  font-size: clamp(1.125rem, 1.8vw, 1.625rem);
  font-weight: 600;
  letter-spacing: -0.03em;
}
.realm p > span:not(.w) {
  display: block;
  margin-top: 2px;
  font-size: clamp(0.875rem, 1vw, 1rem);
  font-weight: 400;
  letter-spacing: 0;
  color: var(--paper-2);
}

.modes {
  display: grid;
  gap: clamp(32px, 6svh, 64px);
  padding: clamp(96px, 16svh, 200px) var(--gutter);
}
.modes__row {
  display: flex;
  gap: clamp(12px, 1.4vw, 20px);
  height: min(80svh, 820px);
}
.mode {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: #11131c;
  cursor: pointer;
  transition: flex-grow 0.8s var(--ease);
}
.mode.is-open { flex-grow: 2.3; }
.mode img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 36% 50%;
}
.mode--map img { object-position: 72% 50%; }
.mode::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgb(5 7 15 / 0.75), transparent 50%);
}
.mode__text {
  position: absolute;
  left: clamp(20px, 2.4vw, 36px);
  bottom: clamp(20px, 2.4vw, 36px);
  width: min(24rem, 40vw);
  z-index: 1;
  display: grid;
  gap: 10px;
}
.mode h3 { font-size: clamp(1.75rem, 2.6vw, 2.75rem); line-height: 1; }
.mode p {
  color: var(--paper-2);
  font-size: var(--t-lead);
  line-height: 1.4;
  opacity: 0;
  translate: 0 12px;
  transition: opacity 0.5s var(--ease), translate 0.6s var(--ease);
}
.mode.is-open p { opacity: 1; translate: 0 0; transition-delay: 0.25s; }

.today {
  position: relative;
  isolation: isolate;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: clamp(120px, 22svh, 260px) var(--gutter) clamp(40px, 8svh, 96px);
  text-align: center;
}
.today__label { color: var(--paper-2); font-size: var(--t-lead); }
.today__label span:not(.w) { color: var(--paper); }
.today__arabic {
  position: relative;
  font: 400 clamp(3.25rem, 10.5vw, 10rem)/1.6 var(--arabic);
  color: var(--paper);
  text-wrap: balance;
  text-shadow: 0 0 0.35em rgb(255 214 150 / 0.28);
}
.today__arabic::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 55%;
  z-index: -1;
  width: max(150%, 70vw);
  aspect-ratio: 2.2;
  translate: -50% -50%;
  border-radius: 50%;
  background:
    radial-gradient(closest-side, rgb(255 222 168 / 0.28), rgb(255 190 120 / 0.13) 40%, rgb(140 90 180 / 0.07) 66%, transparent);
  animation: breathe 9s ease-in-out infinite;
  transition: opacity 2.4s var(--ease);
  pointer-events: none;
}
.kindle .today__arabic:not(.is-lit)::before { opacity: 0; }
@keyframes breathe {
  0%, 100% { scale: 0.92; }
  50% { scale: 1.05; }
}
.today__motes {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 2.4s var(--ease);
  mask-image: linear-gradient(180deg, transparent, #000 25%, #000 75%, transparent);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 25%, #000 75%, transparent);
}
.today__motes.is-on { opacity: 1; }

.rule {
  display: grid;
  justify-items: center;
  gap: clamp(36px, 7svh, 72px);
  padding: clamp(40px, 8svh, 96px) var(--gutter) clamp(120px, 22svh, 260px);
  text-align: center;
}
.rule h2 { font-size: var(--t-title); line-height: 0.98; }
.lanterns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(10px, 1.6vw, 22px);
  max-width: 100%;
}
.lanterns li {
  width: clamp(10px, 1.1vw, 16px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--lantern);
  box-shadow: 0 0 18px 2px var(--lantern-glow);
  transition: background-color 0.9s var(--ease), box-shadow 0.9s var(--ease);
}
.rule.is-skipped .lanterns li:nth-last-child(-n + 3) {
  background: rgb(245 243 238 / 0.14);
  box-shadow: 0 0 0 0 transparent;
}
.rule.is-skipped .lanterns li:nth-last-child(3) { transition-delay: 1s; }
.rule.is-skipped .lanterns li:nth-last-child(2) { transition-delay: 0.6s; }
.rule.is-skipped .lanterns li:nth-last-child(1) { transition-delay: 0.2s; }

.begin {
  position: relative;
  min-height: min(100svh, 62vw);
  display: grid;
  overflow: hidden;
  isolation: isolate;
}
.begin__world, .begin__shade {
  position: absolute;
  inset: 0;
  z-index: -1;
}
.begin__world img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 40% 100%;
}
.begin__shade { background: linear-gradient(180deg, var(--ink), transparent 22%); }
.begin__copy {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 28px;
  padding: clamp(120px, 20svh, 220px) var(--gutter) 0;
  text-align: center;
  color: var(--ink);
}
.begin h2 { font-size: var(--t-display); line-height: 0.95; }
.begin .pill { background: var(--ink); color: var(--paper); }
.begin__price {
  margin-top: -12px;
  font-size: var(--t-lead);
  color: rgb(5 7 15 / 0.7);
}
.begin .pill:hover { background: #000; }

.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 28px var(--gutter) calc(env(safe-area-inset-bottom, 0px) + 28px);
  color: var(--paper-3);
  font-size: 0.875rem;
}
.footer .brand { color: var(--paper-2); font-size: 0.8125rem; }

.kindle .w {
  display: inline-block;
  opacity: 0;
}
.kindle .is-lit .w {
  animation: kindle 1.4s var(--ease) both;
  animation-delay: calc(var(--d, 0s) + var(--i) * 70ms);
}
@keyframes kindle {
  0% {
    opacity: 0;
    translate: 0 0.32em;
    filter: blur(12px);
    color: var(--lantern);
    text-shadow: 0 0 0 transparent;
  }
  38% {
    opacity: 1;
    translate: 0 0;
    filter: blur(0);
    color: var(--lantern);
    text-shadow: 0 0 22px var(--lantern-glow), 0 0 4px var(--lantern-glow);
  }
  100% {
    opacity: 1;
    translate: 0 0;
    filter: blur(0);
  }
}
.kindle [data-kindle="block"] {
  opacity: 0;
  translate: 0 18px;
  filter: blur(8px);
  transition: opacity 0.9s var(--ease), translate 1s var(--ease), filter 0.9s var(--ease), transform 0.4s var(--ease), background-color 0.3s;
  transition-delay: var(--d, 0s), var(--d, 0s), var(--d, 0s), 0s, 0s;
}
.kindle [data-kindle="block"].is-lit { opacity: 1; translate: 0 0; filter: blur(0); }

@media (orientation: portrait) {
  .wraith { left: 70%; top: 36%; height: min(58svh, 96vw); }
  .angel { left: 36%; top: 57%; height: min(26svh, 44vw); }
  .begin { min-height: 100svh; }
  .realm { aspect-ratio: 5 / 4; }
  .realm img { object-position: 30% 100%; }
  .lines { width: auto; right: var(--gutter); top: clamp(96px, 14svh, 160px); }
  .today__arabic::before { width: max(170%, 120vw); aspect-ratio: 1.25; }
}

@media (max-width: 760px) {
  .pill { height: 50px; padding-inline: 22px 24px; font-size: 1rem; }
  .pill--small { height: 36px; padding-inline: 16px; font-size: 0.875rem; }
  .realm { width: 84vw; }
  .modes { padding-inline: 0; }
  .modes h2 { padding-inline: var(--gutter); }
  .modes__row {
    height: auto;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter);
    padding-inline: var(--gutter);
    scrollbar-width: none;
  }
  .modes__row::-webkit-scrollbar { display: none; }
  .mode {
    flex: 0 0 80vw;
    height: min(72svh, 600px);
    scroll-snap-align: start;
    cursor: default;
  }
  .mode p { opacity: 1; translate: 0 0; }
  .mode__text { width: auto; right: clamp(20px, 2.4vw, 36px); }
}

@media (prefers-reduced-motion: reduce) {
  .wraith img, .angel img, .today__arabic::before { animation: none; }
  .lines li { transition: opacity 0.2s linear; translate: 0 0; filter: none; }
  .mode, .mode p, .realm img, .lanterns li { transition: none; }
}
