/* THE NEXUS OF ENTROPY. The meeting place between the Clockspire (midnight blue, violet, cyan) and the
   Gilded Abyss (obsidian, burgundy, antique gold). One clock in the middle: the shared engine.
   Motion is restrained and stops for prefers-reduced-motion. */
:root {
  color-scheme: dark;
  --ink: #ece4cf; --muted: #a99f86; --gold: #d9b467; --gold-hi: #fff0c2; --cyan: #7fe9ff; --violet: #9d7bff;
  --wine: #5e1426; --serif: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Palatino, Georgia, serif;
  background: #05060b;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { min-height: 100vh; overflow-x: hidden; font-family: var(--serif); color: var(--ink); background: transparent; } /* the sky layers sit behind; the page colour lives on :root */
a { color: inherit; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 4px; }

/* ── the sky: the Observatory dome, the Clockspire's blue on the left, the Abyss's gold on the right ── */
.nx-sky { position: fixed; inset: 0; z-index: -3; pointer-events: none;
  background:
    radial-gradient(ellipse 45% 70% at 0% 60%, rgba(70, 60, 200, 0.28), transparent 70%),
    radial-gradient(ellipse 45% 70% at 100% 60%, rgba(150, 70, 20, 0.3), transparent 70%),
    radial-gradient(ellipse 60% 55% at 50% 42%, rgba(5, 6, 11, 0.05), rgba(5, 6, 11, 0.6) 85%),
    url('/observatory.webp') center 30% / cover no-repeat;
  background-color: #05060b;
  animation: nx-sky 40s ease-in-out infinite alternate; }
@keyframes nx-sky { to { background-position: 0 0, 0 0, 0 0, center 34%; } }
.nx-vignette { position: absolute; inset: 0; background: radial-gradient(ellipse 80% 70% at 50% 45%, transparent 50%, rgba(3, 3, 7, 0.7)); }
.nx-dust { position: fixed; inset: 0; z-index: -2; width: 100%; height: 100%; pointer-events: none; }
.nx-streams { position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.nx-streams path { fill: none; }

/* ── title ── */
.nx-title { text-align: center; padding: clamp(1.4rem, 4vh, 2.6rem) 1rem 0; }
.nx-brand { display: inline-block; text-decoration: none; }
.nx-brand-word { display: block; font-size: clamp(2.4rem, 6.5vw, 4.8rem); letter-spacing: 0.42em; margin-right: -0.42em; font-weight: 600;
  color: transparent; background: linear-gradient(180deg, #fff6d8 0%, #e9c675 45%, #9a6d1c 100%); -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(0 0 22px rgba(233, 198, 117, 0.28)) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.8)); }
.nx-sub { margin: 0.4rem 0 0; font-style: italic; font-size: clamp(0.95rem, 1.5vw, 1.15rem); color: #e0d4b4; letter-spacing: 0.06em; text-shadow: 0 1px 3px #000, 0 0 14px rgba(0, 0, 0, 0.9); }
.nx-sub span { color: var(--gold); margin: 0 0.4em; font-style: normal; }

/* ── the stage: gateway · clock · gateway ── */
.nx-stage { width: min(92rem, 100%); margin: 0 auto; padding: clamp(0.5rem, 2vh, 1.5rem) clamp(0.8rem, 3vw, 3rem) 0; }
.nx-gates { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1fr); align-items: center; gap: clamp(0.5rem, 2vw, 2.5rem); }

/* the gateways */
.nx-gate { position: relative; display: grid; justify-items: center; gap: 0.9rem; text-decoration: none; padding-top: 1.5rem; }
.nx-arch { position: relative; display: block; width: min(100%, 21rem); aspect-ratio: 0.62; border-radius: 50% 50% 0.6rem 0.6rem / 32% 32% 0.6rem 0.6rem;
  overflow: hidden; isolation: isolate; transition: transform 0.7s cubic-bezier(.2, .7, .2, 1), box-shadow 0.7s ease; }
.nx-arch-view { position: absolute; inset: -4%; background-size: cover; background-position: center; filter: brightness(0.62) saturate(0.95);
  transition: transform 1.2s cubic-bezier(.2, .7, .2, 1), filter 0.8s ease; }
.nx-spire .nx-arch-view { background-position: 50% 40%; }
.nx-abyss .nx-arch-view { background-position: 58% 50%; }
.nx-arch-light { position: absolute; inset: 0; z-index: 1; opacity: 0.55; transition: opacity 0.8s ease; mix-blend-mode: screen; }
.nx-spire .nx-arch-light { background: radial-gradient(ellipse 60% 45% at 50% 62%, rgba(127, 233, 255, 0.55), rgba(120, 90, 255, 0.18) 55%, transparent 75%); }
.nx-abyss .nx-arch-light { background: radial-gradient(ellipse 60% 45% at 50% 62%, rgba(255, 196, 110, 0.6), rgba(160, 40, 50, 0.2) 55%, transparent 75%); }
.nx-arch-rim { position: absolute; inset: 0; z-index: 2; border-radius: inherit; pointer-events: none; }
.nx-spire .nx-arch-rim { box-shadow: inset 0 0 0 2px rgba(127, 233, 255, 0.55), inset 0 0 0 7px rgba(5, 6, 11, 0.6), inset 0 0 0 8px rgba(217, 180, 103, 0.55), inset 0 0 40px rgba(127, 233, 255, 0.25); }
.nx-abyss .nx-arch-rim { box-shadow: inset 0 0 0 2px rgba(255, 210, 130, 0.7), inset 0 0 0 7px rgba(5, 6, 11, 0.6), inset 0 0 0 8px rgba(150, 30, 45, 0.7), inset 0 0 40px rgba(255, 180, 90, 0.28); }
/* a slow breath of light in each doorway */
.nx-arch-light { animation: nx-breathe 7s ease-in-out infinite alternate; }
.nx-abyss .nx-arch-light { animation-delay: -3.5s; }
@keyframes nx-breathe { from { opacity: 0.4; } to { opacity: 0.75; } }
.nx-spire .nx-arch { box-shadow: 0 0 60px rgba(100, 140, 255, 0.22), 0 30px 60px rgba(0, 0, 0, 0.6); }
.nx-abyss .nx-arch { box-shadow: 0 0 60px rgba(255, 170, 80, 0.22), 0 30px 60px rgba(0, 0, 0, 0.6); }
.nx-gate:hover .nx-arch, .nx-gate:focus-visible .nx-arch { transform: translateY(-6px) scale(1.02); }
.nx-gate:hover .nx-arch-view, .nx-gate:focus-visible .nx-arch-view { transform: scale(1.08); filter: brightness(0.9) saturate(1.1); }
.nx-gate:hover .nx-arch-light, .nx-gate:focus-visible .nx-arch-light { opacity: 1; animation-play-state: paused; }
.nx-spire:hover .nx-arch, .nx-spire:focus-visible .nx-arch { box-shadow: 0 0 90px rgba(127, 233, 255, 0.45), 0 30px 60px rgba(0, 0, 0, 0.6); }
.nx-abyss:hover .nx-arch, .nx-abyss:focus-visible .nx-arch { box-shadow: 0 0 90px rgba(255, 190, 100, 0.45), 0 30px 60px rgba(0, 0, 0, 0.6); }
.nx-gate:focus-visible { outline: none; }
.nx-gate:focus-visible .nx-plate { outline: 3px solid var(--cyan); outline-offset: 4px; }

/* the guardians: Tick perched on the Clockspire arch, Morvex standing at the vault */
.nx-guardian { position: absolute; z-index: 3; pointer-events: none; height: auto; transition: transform 0.8s ease, filter 0.8s ease; }
.nx-tick { width: clamp(4.5rem, 7vw, 6.5rem); top: 0.2rem; left: 50%; transform: translateX(-50%); filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 10px rgba(127, 233, 255, 0.25)); }
.nx-spire:hover .nx-tick { transform: translateX(-50%) translateY(-6px) rotate(-4deg); filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 16px rgba(127, 233, 255, 0.6)); }
.nx-morvex { width: clamp(7rem, 10.5vw, 10rem); right: max(-1.5rem, calc(50% - 14.5rem)); bottom: 5.6rem; opacity: 0.92;
  -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent 99%); mask-image: linear-gradient(to bottom, #000 78%, transparent 99%);
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 14px rgba(255, 170, 80, 0.25)); }
.nx-abyss:hover .nx-morvex { transform: translateX(-6px); filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 20px rgba(255, 190, 100, 0.55)); }

/* the name plates */
.nx-plate { display: grid; gap: 0.25rem; justify-items: center; text-align: center; max-width: 19rem; padding: 0.55rem 1.1rem 0.65rem; border-radius: 0.3rem;
  background: linear-gradient(180deg, rgba(12, 10, 16, 0.82), rgba(8, 6, 10, 0.88)); backdrop-filter: blur(4px); }
.nx-spire .nx-plate { box-shadow: inset 0 1px 0 rgba(127, 233, 255, 0.55), 0 0 0 1px rgba(127, 233, 255, 0.25); }
.nx-abyss .nx-plate { box-shadow: inset 0 1px 0 rgba(255, 210, 130, 0.65), 0 0 0 1px rgba(217, 180, 103, 0.3); }
.nx-gate-name { font-size: clamp(1.35rem, 2.2vw, 1.8rem); letter-spacing: 0.08em; }
.nx-spire .nx-gate-name { color: var(--cyan); text-shadow: 0 0 18px rgba(127, 233, 255, 0.45); }
.nx-abyss .nx-gate-name { color: #f1cf86; text-shadow: 0 0 18px rgba(255, 190, 100, 0.4); }
.nx-gate-line { font-size: 0.92rem; color: #c8bfa8; line-height: 1.4; }

/* ── the clock: the shared engine ── */
.nx-clock { position: relative; display: grid; justify-items: center; gap: 0.6rem; text-decoration: none; }
.nx-clock-svg { width: min(100%, 34rem); height: auto; overflow: visible; filter: drop-shadow(0 0 30px rgba(233, 198, 117, 0.16)); transition: filter 0.6s ease, transform 0.8s cubic-bezier(.2, .7, .2, 1); }
.nx-clock:hover .nx-clock-svg, .nx-clock:focus-visible .nx-clock-svg { filter: drop-shadow(0 0 40px rgba(233, 198, 117, 0.42)); transform: scale(1.02); }
.nx-clock:focus-visible { outline: none; }
.nx-clock:focus-visible .nx-clock-label { outline: 3px solid var(--cyan); outline-offset: 4px; }
.nx-clock-label { font-size: 0.8rem; letter-spacing: 0.32em; text-transform: uppercase; color: #cdb98a; padding: 0.3rem 0.8rem; border-radius: 999px;
  background: rgba(8, 7, 12, 0.6); box-shadow: 0 0 0 1px rgba(217, 180, 103, 0.3); transition: color 0.4s, box-shadow 0.4s; }
.nx-clock:hover .nx-clock-label { color: var(--gold-hi); box-shadow: 0 0 0 1px rgba(217, 180, 103, 0.7), 0 0 20px rgba(233, 198, 117, 0.3); }
.nx-clock-svg text { font-family: var(--serif); fill: #e7cf8f; text-anchor: middle; dominant-baseline: central; }
.nx-clock-svg .nx-glyphs text { fill: #b9c8ff; fill-opacity: 0.75; }

/* ── voice, motto, footer ── */
.nx-voice { margin: clamp(1.2rem, 3vh, 2rem) auto 0; max-width: 40rem; text-align: center; }
.nx-voice p { margin: 0; font-style: italic; font-size: clamp(1rem, 1.5vw, 1.15rem); line-height: 1.6; color: #d6cdee; text-shadow: 0 1px 10px rgba(0, 0, 0, 0.9); }
.nx-voice cite { display: block; margin-top: 0.35rem; font-style: normal; font-size: 0.75rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--gold); }
.nx-motto { margin: 1.1rem 0 0; text-align: center; font-size: 0.78rem; letter-spacing: 0.35em; text-transform: uppercase; color: #8f8670; }
.nx-motto span { color: var(--gold); }
.nx-foot { text-align: center; padding: 1.6rem 1rem 2rem; }
.nx-prologue { display: inline-block; padding: 0.6rem 1.3rem; border-radius: 999px; text-decoration: none; letter-spacing: 0.1em; color: #f3dfa6;
  background: rgba(20, 16, 10, 0.55); box-shadow: 0 0 0 1px rgba(217, 180, 103, 0.6); transition: background 0.3s, box-shadow 0.3s; }
.nx-prologue:hover { background: rgba(60, 46, 16, 0.6); box-shadow: 0 0 0 1px var(--gold), 0 0 20px rgba(233, 198, 117, 0.25); }
.nx-note { margin: 0.9rem 0 0; font-size: 0.82rem; color: #847c68; }

/* ── the butterfly ── */
.nx-moth { position: fixed; left: 0; top: 0; z-index: 4; width: 4.2rem; pointer-events: none; will-change: transform;
  filter: drop-shadow(0 0 6px rgba(255, 200, 90, 0.55)); transition: transform 3.2s cubic-bezier(0.45, 0.05, 0.4, 1); }
.nx-moth svg { display: block; width: 100%; overflow: visible; }
.nx-moth .nxm-w { transform-box: view-box; transform-origin: 0 0; animation: nxm-rest 3.6s ease-in-out infinite; }
.nx-moth .nxm-back { animation-name: nxm-rest-back; }
.nx-moth.flying .nxm-w { animation: nxm-flap 0.17s ease-in-out infinite alternate; }
@keyframes nxm-rest { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(0.55); } }
@keyframes nxm-rest-back { 0%, 100% { transform: scaleX(0.9); } 50% { transform: scaleX(0.5); } }
@keyframes nxm-flap { from { transform: scaleX(1); } to { transform: scaleX(0.14); } }

/* ── entering a world: the camera moves toward the chosen door, then the veil closes ── */
.nx-veil { position: fixed; inset: 0; z-index: 10; pointer-events: none; opacity: 0; background: #05060b; transition: opacity 0.55s ease 0.25s; }
body.entering .nx-veil { opacity: 1; }
body.entering .nx-stage, body.entering .nx-title { transition: transform 0.85s cubic-bezier(.6, 0, .4, 1), filter 0.85s ease; filter: blur(1.5px); }
body.enter-spire .nx-veil { background: radial-gradient(circle at 18% 50%, #0d1a3a, #05060b 70%); }
body.enter-abyss .nx-veil { background: radial-gradient(circle at 82% 50%, #2a0d0a, #05060b 70%); }
body.enter-clock .nx-veil { background: radial-gradient(circle at 50% 45%, #1c1630, #05060b 70%); }

/* ── smaller screens ── */
@media (max-width: 64rem) {
  .nx-gates { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .nx-clock { grid-column: 1 / -1; grid-row: 1; }
  .nx-clock-svg { width: min(78vw, 26rem); }
  .nx-arch { width: min(100%, 17rem); }
  .nx-morvex { right: -0.4rem; bottom: 6rem; }
}
@media (max-width: 34rem) {
  .nx-brand-word { letter-spacing: 0.28em; margin-right: -0.28em; }
  .nx-gate-line { font-size: 0.8rem; }
  .nx-plate { padding: 0.45rem 0.6rem 0.5rem; }
  .nx-morvex { width: 4.6rem; bottom: 6.4rem; }
  .nx-tick { width: 3.6rem; }
  .nx-moth { width: 3rem; }
  .nx-clock-label { font-size: 0.66rem; letter-spacing: 0.22em; }
}

@media (prefers-reduced-motion: reduce) {
  .nx-sky, .nx-arch-light, .nx-moth .nxm-w { animation: none !important; }
  .nx-arch, .nx-arch-view, .nx-guardian, .nx-clock-svg, .nx-moth { transition: none !important; }
  .nx-gate:hover .nx-arch, .nx-clock:hover .nx-clock-svg { transform: none; }
}

/* copied from packages/entropy-ui/src/worldnav.css so the Nexus crosses the same way as the worlds */
/* Crossing between the worlds: the Turning. No white flash. The night of the world you are going to
   closes in softly, a thin gold clockwork ring (/portal-ring.svg) draws itself and turns; on the other
   side the same ring widens and fades as the new world appears (WorldNav reads the hand-off). */
.world-portal { position: fixed; inset: 0; z-index: 130; pointer-events: none; display: grid; place-items: center; overflow: hidden;
  animation: portal-close 0.78s cubic-bezier(0.45, 0, 0.25, 1) forwards; }
.world-portal.to-spire { background: radial-gradient(ellipse 70% 60% at 50% 48%, #141a44 0%, #0b0d26 45%, #04050d 100%); }
.world-portal.to-abyss { background: radial-gradient(ellipse 70% 60% at 50% 52%, #3a1410 0%, #1d0a0b 45%, #060304 100%); }
.world-portal.to-threshold { background: radial-gradient(ellipse 70% 60% at 50% 48%, #1d1638 0%, #0d0a1c 45%, #05060b 100%); }
.world-portal .wp-ring { width: min(72vmin, 34rem); height: auto; opacity: 0; filter: drop-shadow(0 0 18px rgba(233, 198, 117, 0.35));
  animation: ring-in 0.78s cubic-bezier(0.3, 0, 0.2, 1) forwards, ring-turn 14s linear infinite; }
.world-portal.to-spire .wp-ring { filter: drop-shadow(0 0 18px rgba(127, 233, 255, 0.35)); }
@keyframes portal-close { from { opacity: 0; } to { opacity: 0.9; } }
/* never a full blackout; the ring keeps turning and breathing while the next world loads */
.world-portal .wp-ring { animation-duration: 0.78s, 6s; }
.world-portal::after { content: ''; position: absolute; width: min(80vmin, 38rem); aspect-ratio: 1; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 220, 150, 0.14), transparent 65%); animation: wp-breathe 1.6s ease-in-out infinite alternate; }
.world-portal.to-spire::after { background: radial-gradient(circle, rgba(127, 233, 255, 0.14), transparent 65%); }
@keyframes wp-breathe { from { opacity: 0.4; scale: 0.92; } to { opacity: 1; scale: 1.04; } }
@keyframes ring-in { from { opacity: 0; scale: 1.35; } 60% { opacity: 1; } to { opacity: 1; scale: 1; } }
@keyframes ring-turn { from { rotate: 0deg; } to { rotate: 360deg; } }
/* arriving: the veil starts closed and opens, the ring widens past the edges of the screen */
.world-portal.arrive { animation: portal-open 1.3s cubic-bezier(0.33, 0, 0.15, 1) 0.15s both; }
.world-portal.arrive .wp-ring { opacity: 1; animation: ring-out 1.35s cubic-bezier(0.33, 0, 0.15, 1) 0.05s both, ring-turn 14s linear infinite; }
/* Crossing from or to a realm: the veiled page melts into the next one instead of a hard cut. */
/* Owner (2026-12-04, lag): no cross-page view transition. The browser had to photograph both heavy pages and hold the old one while the new one loaded; the crossing veil and the arrival light already cover the change. */
@keyframes portal-open { from { opacity: 0.9; } to { opacity: 0; } }
.world-portal.arrive .wp-ring { animation-duration: 1.35s, 6s; }
.world-portal.arrive { animation-duration: 1.1s; animation-delay: 0.05s; }
@keyframes ring-out { from { opacity: 1; scale: 1; } to { opacity: 0; scale: 1.9; } }

@media (prefers-reduced-motion: reduce) { .world-portal, .world-portal .wp-ring, .world-portal::after { animation: none !important; } }


/* Owner 2026-12-04 + directive section 4: the Nexus fills the window. The gateways are enormous entrances, the clock the focus. */
.nx-stage { width: 100%; box-sizing: border-box; padding-inline: clamp(1rem, 3vw, 4rem); }
.nx-gates { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(1rem, 3vw, 4rem); }
.nx-arch { width: min(100%, 27rem); }
.nx-plate { max-width: 24rem; }
.nx-voice { max-width: 52rem; }
@media (max-width: 64rem) { .nx-gates { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .nx-arch { width: min(100%, 22rem); } }
