@font-face {
  font-family: 'Instrument Serif';
  src: url('/fonts/InstrumentSerif-Regular.ttf') format('truetype');
  font-display: swap;
}

:root {
  color-scheme: dark;
  background: #000;
  color: #fff;
  font-family: 'Instrument Serif', Georgia, serif;
  --brand-move-ms: 550ms;
  --logo-pulse-ms: 2200ms;
  --indicator-ms: 1800ms;
  --text-delay-ms: 200ms;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

body { position: relative; }
button { font: inherit; }
[hidden] { display: none !important; }

#scene-root,
.scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.scene { background: transparent; }
.scene-visual, .ink-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene-media { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: var(--media-fit, cover); }
.ink-canvas { z-index: 1; pointer-events: none; }
@font-face { font-family: 'League Gothic'; src: url('/fonts/LeagueGothic-Regular.ttf') format('truetype'); font-weight: 400; font-display: block; }
.story-text { position: absolute; z-index: 3; pointer-events: none; font-family: 'League Gothic', sans-serif; font-weight: 400; line-height: 0.77; letter-spacing: -0.021em; }
.chapter-text { left: 5%; right: 5%; top: 50%; transform: translateY(-50%); text-align: center; font-size: clamp(48px, 8.333vw, 160px); }
.chapter-text.grow-title { left: 50%; right: auto; width: max-content; max-width: 90%; transform: translate(-50%, -50%); text-align: right; }
.text-line { white-space: nowrap; }
.text-line + .text-line { margin-top: 0; }
.text-line span { display: inline-block; }
.chapter-text.is-bursting .text-line span {
  will-change: transform, opacity;
  backface-visibility: hidden;
  transform-origin: 50% 50%;
}
.dice { top: 34.16%; left: 9.1%; width: max-content; font-size: clamp(40px, 11vw, 211.2px); }
.dice .small { font-size: 58.3333%; letter-spacing: -0.031em; word-spacing: 0.025em; padding-right: 0.15625vw; text-align: right; }
.dice .large + .small { margin-top: 0.075em; }

.brand {
  position: fixed;
  z-index: 110;
  top: 50%;
  left: 50%;
  width: clamp(140px, 13vw, 245px);
  transform: translate(-50%, -54%);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: top var(--brand-move-ms) ease, left var(--brand-move-ms) ease,
    width var(--brand-move-ms) ease, transform var(--brand-move-ms) ease;
}

.brand.is-visible { opacity: 1; }
.brand-mark { position: relative; width: 100%; aspect-ratio: 1; }
.brand-mark img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.brand-mark-white { opacity: 0; transition: opacity var(--brand-move-ms) ease; }
.brand-mark-dark { opacity: 1; transition: opacity var(--brand-move-ms) ease; }
.brand-name {
  margin-top: -0.11em;
  white-space: nowrap;
  font-size: clamp(24px, 2.45vw, 46px);
  line-height: 1;
  transition: opacity var(--brand-move-ms) ease, transform var(--brand-move-ms) ease;
}

.is-loading .brand-mark { animation: logo-pulse var(--logo-pulse-ms) ease-in-out infinite alternate; }
.is-loading .brand-name { animation: name-arrive var(--brand-move-ms) ease-out var(--text-delay-ms) both; }
.is-ready .brand-mark-white { opacity: 1; }
.is-ready .brand-mark-dark { opacity: 0; }
.is-ready:not(.is-loading) .brand:not(.is-corner) .brand-name { animation: name-arrive var(--brand-move-ms) ease-out both; }

.brand.is-corner {
  top: clamp(13px, 1.8vw, 30px);
  left: clamp(13px, 1.8vw, 30px);
  width: clamp(42px, 3.2vw, 66px);
  transform: none;
}

.brand.is-corner .brand-name { opacity: 0; transform: translateY(-10px); animation: none; }

.transition-veil { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.media-notice {
  position: fixed;
  z-index: 120;
  left: 50%;
  bottom: 5.2rem;
  width: min(90vw, 420px);
  margin: 0;
  padding: 0.65rem 0.9rem;
  transform: translateX(-50%);
  border-radius: 3px;
  background: rgb(20 20 20 / 88%);
  color: #fff;
  font: 12px/1.4 Arial, Helvetica, sans-serif;
  text-align: center;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

@keyframes logo-pulse { from { opacity: 0.68; } to { opacity: 1; } }
@keyframes name-arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 700px), (orientation: portrait) {
  .brand { width: clamp(128px, 33vw, 210px); }
  .brand-name { font-size: clamp(24px, 7vw, 40px); }
  .brand.is-corner { top: 16px; left: 16px; width: 48px; }
  .chapter-text { font-size: clamp(42px, 15vw, 100px); }
  .chapter-text.grow-title { font-size: clamp(38px, 14.5vw, 100px); }
  .dice { top: 18%; left: 7%; width: max-content; font-size: clamp(44px, 22.222vw, 160px); }
}

@media (prefers-reduced-motion: reduce) {
  .brand,
  .brand-mark img,
  .brand-name { transition-duration: 0ms; }
  .is-loading .brand-mark,
  .is-loading .brand-name { animation: none; }
}
