/* Inscriptional capitals: Cinzel (SIL Open Font License, see assets/Cinzel-OFL.txt), Latin capitals only. */
@font-face {
  font-family: "Cinzel";
  src: url("assets/cinzel-caps.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0020, U+0041-005A, U+003F;
}

:root {
  color-scheme: dark;
  --void: #04060f;
  --gold: #ffd27a;
  --gold-emit: #ffb559;
  --pale: #fff1d0;
  --dim: #8b9198;
  --caps: "Cinzel", "Trajan Pro 3", "Trajan Pro", "Optima", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --edge: clamp(1rem, 3vw, 2.75rem);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --type-s: 11px;
  --type-m: clamp(1.25rem, 1.74vw, 1.92rem);   /* 60% of the title */
  --type-l: clamp(1.6rem, 2.9vw, 3.2rem);
  background: var(--void);
  color: var(--pale);
  font-family: var(--caps);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--void); overscroll-behavior-y: none; }
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 1px solid var(--gold); outline-offset: 6px; border-radius: 2px; }
::selection { color: var(--void); background: var(--gold); }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

.journey { position: relative; }

.stage {
  position: fixed; inset: 0;
  height: 100vh; height: 100dvh;
  overflow: hidden; isolation: isolate;
  background: var(--void);
}

/* The poster is the first screen. The scene dissolves in over it, at the same place. */
.poster, .poster img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
}
.poster img { object-fit: cover; object-position: 56% 50%; }
@media (max-aspect-ratio: 4/5) {
  .poster img { object-position: 50% 62%; }
}

#world {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 1.1s ease-out;
}
.is-live #world { opacity: 1; }

.title {
  position: absolute; z-index: 2;
  top: max(calc(var(--edge) * .9), env(safe-area-inset-top));
  left: calc(50% - var(--shrink, 0) * (50% - var(--edge)));
  width: max-content; max-width: calc(100% - 2 * var(--edge));
  margin: 0;
  text-align: center;
  font-weight: 400;
  font-size: var(--type-l);
  line-height: 1.22;
  letter-spacing: .2em;
  text-indent: .2em;
  text-transform: uppercase;
  color: var(--pale);
  text-shadow: 0 0 28px rgba(4, 6, 15, .9), 0 1px 2px rgba(4, 6, 15, .8);
  transform-origin: 0 0;
  /* large and centred at first; once the walk begins it draws up into a small heading at the left */
  transform: translate3d(calc(-50% * (1 - var(--shrink, 0))), calc((1 - var(--shrink, 0)) * 7.5vh), 0) scale(calc(1 - var(--shrink, 0) * (1 - var(--small, .36))));
  pointer-events: none;
}
.title span { display: inline-block; }

.vault {
  position: absolute; z-index: 3;
  top: max(calc(var(--edge) * .9), env(safe-area-inset-top));
  right: max(var(--edge), env(safe-area-inset-right));
  padding: .6rem 0;
  font-size: var(--type-s);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--pale);
  opacity: var(--vault, 0);
  transition: opacity .6s ease, color .25s ease;
}
.vault:focus-visible { opacity: 1; }
@media (hover: hover) { .vault:hover { color: var(--gold); } }

.universe {
  position: absolute; z-index: 2;
  left: 0; right: 0; top: 46%;
  margin: 0; padding: 0 var(--edge);
  text-align: center;
  font-size: var(--type-m);
  letter-spacing: .2em;
  text-indent: .2em;
  text-transform: uppercase;
  color: var(--pale);
  text-shadow: 0 0 24px rgba(4, 6, 15, .85);
  opacity: 0;
  pointer-events: none;
}
.universe.is-shown { animation: universe 3.8s linear both; }
@keyframes universe {
  0% { opacity: 0; }
  21% { opacity: 1; }      /* 0.8 s to appear */
  100% { opacity: 0; }     /* 3 s to go */
}

.question {
  position: absolute; z-index: 2;
  left: 0; top: 0;
  margin: 0;
  font-size: 7vh;
  line-height: 1;
  color: var(--pale);
  text-shadow: 0 0 5px rgba(255, 210, 122, .55);
  opacity: var(--question, 0);
  transform: translate3d(calc(var(--qx, 50vw) - 50%), calc(var(--qy, 40vh) - 50%), 0);
  pointer-events: none;
}

.rail {
  position: absolute; z-index: 3;
  left: 0; right: 0;
  bottom: max(calc(var(--edge) * .75), env(safe-area-inset-bottom));
  padding: 0 var(--edge);
  font-size: var(--type-s);
  letter-spacing: .2em;
  text-transform: uppercase;
}
.rail ol {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 0 .75em;
  margin: 0; padding: 0; list-style: none;
  transition: opacity .5s ease;
}
.rail li { display: flex; align-items: center; gap: .75em; white-space: nowrap; }
.rail li + li::before { content: "→"; color: var(--dim); opacity: .7; letter-spacing: 0; }
.rail a {
  padding: .8rem .1rem;
  color: var(--dim);
  transition: color .5s ease, text-shadow .5s ease;
}
.rail a.is-past { color: #b9a987; }
.rail a.is-here { color: var(--gold); text-shadow: 0 0 14px rgba(255, 181, 89, .6); }
.rail a[data-layer="4"] { font-size: 1.3em; letter-spacing: 0; line-height: 1; }
@media (hover: hover) { .rail a:hover { color: var(--gold); } }
.hint {
  position: absolute; left: 0; right: 0; top: 50%;
  margin: 0; text-align: center;
  font-size: 12px;
  color: var(--dim);
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity .5s ease;
  pointer-events: none;
}
.is-hinting .rail ol { opacity: 0; }
.is-hinting .hint { opacity: 1; }

.track { position: relative; height: 2950vh; pointer-events: none; }
.track span { position: absolute; left: 0; width: 1px; height: 1px; }

@media (max-width: 640px) {
  :root { --type-l: 5.2vw; --type-m: 3.2vw; --small: .58; }
  .title span { display: block; }
  .rail { letter-spacing: .14em; }
  .rail ol { gap: 0 .55em; }
  .rail li { gap: .55em; }
  .rail a { padding: .5rem .1rem; }
}

/* Measuring and review: ?notext=1 hides every letter. */
.no-text .title, .no-text .vault, .no-text .universe, .no-text .question, .no-text .rail { visibility: hidden; }

/* Tier 0: no flight. The poster stands for the scene. */
.tier-0 #world { display: none; }
.tier-0 .track { height: 0; }

@media (prefers-reduced-motion: reduce) {
  #world { transition-duration: .3s; }
  .universe.is-shown { animation: none; opacity: 0; }
}
