:root {
  color-scheme: dark;
  --bg: #0b0b0e;
  --bone: #eae5da;
  --gold: #c8a96e;
  --ink-55: rgba(234, 229, 218, 0.55);
  --ink-35: rgba(234, 229, 218, 0.35);
  --font-display: "Melodrama", "Playfair Display", Georgia, "Times New Roman", serif;
  --font-micro: "Space Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

html, body {
  overflow-x: hidden;
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  background: var(--bg);
  color: var(--bone);
  font-family: var(--font-micro);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--gold); color: var(--bg); }

/* ---------- atmosphere ---------- */

.aurora,
.horizon,
.sky,
.vignette,
.cursor-glow,
.grain {
  position: fixed;
  pointer-events: none;
}

.aurora { inset: 0; z-index: 0; overflow: hidden; }

.aurora::before,
.aurora::after { content: ""; position: absolute; inset: -30%; }

.aurora::before {
  background:
    radial-gradient(44% 40% at 30% 28%, rgba(92, 80, 156, 0.24), transparent 70%),
    radial-gradient(52% 46% at 74% 70%, rgba(30, 76, 96, 0.22), transparent 72%);
  animation: drift 28s ease-in-out infinite alternate;
}

.aurora::after {
  background: radial-gradient(40% 34% at 50% 52%, rgba(200, 169, 110, 0.10), transparent 72%);
  animation: drift 36s ease-in-out infinite alternate-reverse;
}

@keyframes drift {
  from { transform: translate3d(-2%, -1.5%, 0) scale(1); }
  to { transform: translate3d(2%, 1.5%, 0) scale(1.07); }
}

.horizon {
  inset: auto 0 0 0;
  height: 45vh;
  z-index: 0;
  background: radial-gradient(80% 100% at 50% 100%, rgba(200, 169, 110, 0.055), transparent 70%);
}

.sky {
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 3s ease 0.5s;
}

.is-ready .sky { opacity: 1; }

.vignette {
  inset: 0;
  z-index: 1;
  background: radial-gradient(118% 92% at 50% 42%, transparent 44%, rgba(0, 0, 0, 0.54) 100%);
}

.cursor-glow {
  top: 0;
  left: 0;
  z-index: 1;
  width: 46rem;
  height: 46rem;
  border-radius: 50%;
  background: radial-gradient(circle closest-side, rgba(200, 169, 110, 0.11), rgba(200, 169, 110, 0.035) 42%, transparent 72%);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 1.6s ease 0.4s;
  will-change: transform;
}

.is-ready .cursor-glow { opacity: 1; }

.grain {
  inset: 0;
  z-index: 4;
  opacity: 0.055;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 240px 240px;
  animation: grain 8s steps(1) infinite;
}

@keyframes grain {
  0%, 100% { background-position: 0 0; }
  12.5% { background-position: -60px -30px; }
  25% { background-position: 30px -70px; }
  37.5% { background-position: -90px 40px; }
  50% { background-position: 70px 60px; }
  62.5% { background-position: -40px 90px; }
  75% { background-position: 90px -50px; }
  87.5% { background-position: -70px -90px; }
}

/* ---------- custom cursor ---------- */

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 8;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.cursor.is-visible { opacity: 1; }
.cursor.is-hidden { opacity: 0; }

.cursor-dot,
.cursor-ring {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 50%;
  will-change: translate;
}

.cursor-dot {
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  background: var(--gold);
  transition: transform 0.35s var(--ease-out);
}

.cursor-ring {
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border: 1px solid rgba(234, 229, 218, 0.32);
  transition: transform 0.45s var(--ease-out), border-color 0.45s ease;
}

.cursor.is-hover .cursor-ring { transform: scale(2.1); border-color: rgba(200, 169, 110, 0.65); }
.cursor.is-hover .cursor-dot { transform: scale(0.5); }
.cursor.is-down .cursor-ring { transform: scale(0.78); }

@media (hover: none), (pointer: coarse) { .cursor { display: none; } }

@media (hover: hover) and (pointer: fine) {
  .has-cursor,
  .has-cursor * { cursor: none !important; }
}

/* ---------- layout ---------- */

main {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(5rem + env(safe-area-inset-top, 0px)) 1.5rem calc(7rem + env(safe-area-inset-bottom, 0px));
}

.orbit {
  position: absolute;
  inset: 0;
  margin: auto;
  width: min(94vmin, 1200px);
  height: min(94vmin, 1200px);
  overflow: visible;
  opacity: 0;
  transition: opacity 2.8s ease 0.35s;
  will-change: transform;
}

.is-ready .orbit { opacity: 1; }

.orbit-spin,
.ring-text-spin {
  transform-box: view-box;
  transform-origin: 50% 50%;
}

.orbit-spin { animation: spin 80s linear infinite; }
.orbit-spin--reverse { animation: spin 150s linear infinite reverse; }
.ring-text-spin { animation: spin 160s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

.ring-text {
  font-family: var(--font-micro);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 19.5px;
}

.stack {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* ---------- reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(0.9rem);
  transition: opacity 1.1s ease var(--d, 0s), transform 1.1s var(--ease-out) var(--d, 0s);
}

.reveal.rise-slow {
  transform: translateY(1.6rem);
  transition: opacity 2s ease var(--d, 0s), transform 2s var(--ease-out) var(--d, 0s);
}

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

/* ---------- moon ---------- */

.moon-wrap { margin-bottom: clamp(1.5rem, 3.4vh, 2.6rem); }

.moon-sigil {
  display: block;
  width: clamp(40px, 6.2vmin, 56px);
  height: auto;
}

.moon-crescent { filter: drop-shadow(0 0 16px rgba(200, 169, 110, 0.35)); }

.moon-halo {
  transform-box: view-box;
  transform-origin: 50% 50%;
  animation: halo 7s ease-in-out infinite;
}

@keyframes halo {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.06); }
}

/* ---------- wordmark ---------- */

.wordmark {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: min(14.5vmin, 10.5rem);
  line-height: 0.92;
  letter-spacing: 0.035em;
  margin-right: -0.035em;
  text-transform: uppercase;
  white-space: nowrap;
  font-kerning: normal;
  -webkit-user-select: none;
  user-select: none;
}

.is-ready .wordmark {
  animation: tighten 1.8s var(--ease-out) 0.15s both;
}

@keyframes tighten {
  from { letter-spacing: 0.09em; margin-right: -0.09em; }
  to { letter-spacing: 0.035em; margin-right: -0.035em; }
}

.wordmark span {
  display: inline-block;
  opacity: 0;
  transition: color 0.5s ease, translate 0.55s var(--ease-out);
  transition-delay: calc(var(--i) * 26ms);
}

.is-ready .wordmark span {
  animation: rise 1.2s var(--ease-out) both;
  animation-delay: calc(140ms + var(--i) * 80ms);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(0.5em) scale(0.97); filter: blur(14px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.wordmark .q { color: var(--gold); }

.wordmark:hover span,
.wordmark.is-poked span { color: var(--gold); translate: 0 -0.05em; }

.wordmark:hover .q,
.wordmark.is-poked .q { text-shadow: 0 0 30px rgba(200, 169, 110, 0.4); }

/* ---------- rule, tagline, whisper ---------- */

.rule {
  width: clamp(64px, 8vw, 112px);
  height: 1px;
  margin: clamp(1.7rem, 3.8vh, 2.9rem) 0 clamp(1.3rem, 3vh, 2.1rem);
  background: linear-gradient(90deg, transparent, rgba(200, 169, 110, 0.75), transparent);
}

.tagline {
  font-size: clamp(0.64rem, 1vw, 0.76rem);
  letter-spacing: 0.5em;
  margin-right: -0.5em;
  text-transform: uppercase;
  color: var(--ink-55);
}

.tagline span {
  display: inline-block;
  white-space: nowrap;
}

.whisper {
  position: absolute;
  top: calc(100% + 1.6rem);
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  letter-spacing: 0.26em;
  text-transform: lowercase;
  color: var(--gold);
  opacity: 0;
  transition: opacity 1s ease 0.2s;
  pointer-events: none;
  white-space: nowrap;
}

.wordmark:hover ~ .whisper,
.whisper.is-shown { opacity: 0.85; }

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

.footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.8rem 2.1rem calc(1.8rem + env(safe-area-inset-bottom, 0px));
  font-size: 0.6rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--ink-35);
}

.footer .mark {
  font-size: 0.7rem;
  letter-spacing: 0;
  color: var(--gold);
  opacity: 0.7;
}

.clock {
  margin-left: 0.9em;
  color: var(--gold);
  opacity: 0.85;
  letter-spacing: 0.18em;
  font-variant-numeric: tabular-nums;
}

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

@media (max-width: 700px) {
  .cursor-glow { width: 30rem; height: 30rem; }
}

@media (max-width: 640px) {
  .wordmark { font-size: min(13vmin, 10.5rem); }
  .ring-text { font-size: 24px; letter-spacing: 11px; }
  .tagline { letter-spacing: 0.36em; margin-right: -0.36em; }
  .footer {
    padding: 1.4rem 1.3rem calc(1.4rem + env(safe-area-inset-bottom, 0px));
    letter-spacing: 0.24em;
    font-size: 0.55rem;
  }
  .whisper { letter-spacing: 0.2em; }
}

@media (max-width: 400px) {
  .footer { font-size: 0.5rem; letter-spacing: 0.16em; }
  .footer .mark { display: none; }
}

/* ---------- motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .reveal,
  .wordmark span,
  .orbit {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }

  .cursor-glow { display: none; }
}
