/* ============================================================================
   title card — the entry overlay

   Dark, quiet, slow. It sets the register for everything after it, so nothing
   here moves faster than it has to.
   ========================================================================= */

.title-card {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding:
    calc(2rem + var(--safe-t))
    calc(1.5rem + var(--safe-r))
    calc(2rem + var(--safe-b))
    calc(1.5rem + var(--safe-l));
  background:
    radial-gradient(78% 58% at 50% 108%, rgba(20, 52, 58, 0.55) 0%, rgba(20, 52, 58, 0) 70%),
    radial-gradient(60% 44% at 50% -8%, rgba(58, 40, 30, 0.4) 0%, rgba(58, 40, 30, 0) 72%),
    #060405;
  transition: opacity 950ms var(--ease-slow), transform 950ms var(--ease-slow);
}

/* ------------------------------------------------------------------ film -- */

.title-card__film {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.title-card__film video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* graded down hard: this is atmosphere behind the wordmark, not a showreel */
  filter: saturate(0.92) brightness(0.84) contrast(1.02);
  opacity: 0;
  transition: opacity 1800ms var(--ease-slow);
}

.title-card__film.is-visible video { opacity: 1; }

/* The grade. Darkest through the middle, where the type sits, and darker
   still into the corners so nothing in the footage pulls the eye off the
   wordmark — including the generator mark in the bottom right. */
.title-card__film::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    /* just enough behind the lockup to hold the type, opening out fast so the
       courtyard, the swing and the dholki all stay readable */
    radial-gradient(58% 50% at 50% 45%,
      rgba(6, 4, 5, 0.72) 0%, rgba(6, 4, 5, 0.5) 58%, rgba(6, 4, 5, 0.1) 100%),
    /* Centred up and left, so the bottom-right corner falls off hardest. The
       footage carries a generator mark there, and a corner vignette buries it
       without touching the courtyard. */
    radial-gradient(118% 98% at 42% 42%,
      rgba(6, 4, 5, 0) 38%, rgba(6, 4, 5, 0.3) 74%, rgba(6, 4, 5, 0.78) 100%),
    linear-gradient(to bottom,
      rgba(6, 4, 5, 0.3) 0%, rgba(6, 4, 5, 0.1) 40%, rgba(6, 4, 5, 0.46) 100%);
}

.title-card::after {
  content: '';
  position: absolute;
  inset: -60px;
  pointer-events: none;
  opacity: 0.42;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='170' height='170'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='170' height='170' filter='url(%23n)' opacity='0.5'/></svg>");
  animation: grain-drift 6s steps(1) infinite;
}

.title-card.is-leaving {
  opacity: 0;
  transform: scale(1.03);
  pointer-events: none;
}

.title-card[hidden] { display: none; }

.title-card__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 34rem;
}

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

.title-card__wordmark {
  color: #F2E7D3;
  margin-bottom: 1.6rem;
}

.wordmark {
  width: clamp(13.5rem, 32vw, 27rem);
  height: auto;
}

.title-card__roman {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.58em;
  text-indent: 0.58em;      /* balance the trailing tracking */
  color: rgba(242, 231, 211, 0.62);
  margin-bottom: 2.4rem;
}

.title-card__tagline {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.08rem, 2.1vw, 1.5rem);
  line-height: 1.42;
  letter-spacing: -0.005em;
  color: #F2E7D3;
  text-wrap: balance;
}

.title-card__context {
  margin-top: 1.15rem;
  max-width: 27rem;
  font-size: 0.88rem;
  line-height: 1.65;
  color: rgba(242, 231, 211, 0.5);
  text-wrap: pretty;
}

/* ----------------------------------------------------------------- enter -- */

.title-card__enter {
  margin-top: 2.6rem;
  min-height: 48px;
  padding: 0 2.4rem;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(242, 231, 211, 0.28);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.76rem;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  text-transform: uppercase;
  color: #F2E7D3;
  transition:
    background-color 320ms var(--ease),
    border-color 320ms var(--ease);
}

.title-card__enter:hover,
.title-card__enter:focus-visible {
  background: rgba(127, 176, 168, 0.16);
  border-color: rgba(242, 231, 211, 0.6);
}

.title-card__sound { margin-top: 0.9rem; }

.title-card__sound-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 0.75rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  color: rgba(242, 231, 211, 0.55);
  transition: color 300ms var(--ease), background-color 300ms var(--ease);
}

.title-card__sound-btn:hover,
.title-card__sound-btn:focus-visible {
  color: rgba(242, 231, 211, 0.92);
  background: rgba(242, 231, 211, 0.07);
}

.title-card__sound-icon svg { width: 15px; height: 15px; fill: currentColor; display: block; }

/* The waves only exist once there is something to hear. */
.title-card__wave { opacity: 0; transition: opacity 420ms var(--ease); }
.title-card__sound-btn[aria-pressed='true'] .title-card__wave { opacity: 1; }
.title-card__sound-btn[aria-pressed='true'] { color: rgba(242, 231, 211, 0.92); }

/* ------------------------------------------------------------- scroll cue -- */

/* The only scroll affordance on the site, and only here. It fades in late and
   fades out for good — and scrolling really does work from this card, so it
   is not decoration. */
.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: calc(-1 * clamp(4.5rem, 11vh, 7rem));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  opacity: 0;
  animation: cue-life 15s var(--ease) 3.4s forwards;
}

.scroll-cue__word {
  font-family: var(--font-body);
  font-size: 0.6rem;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  text-transform: uppercase;
  color: rgba(242, 231, 211, 0.42);
}

.scroll-cue__line {
  position: relative;
  width: 1px;
  height: 2.5rem;
  background: rgba(242, 231, 211, 0.16);
  overflow: hidden;
}

.scroll-cue__line::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom,
    rgba(242, 231, 211, 0), rgba(242, 231, 211, 0.75));
  animation: cue-travel 2.6s var(--ease) infinite;
}

@keyframes cue-life {
  0%   { opacity: 0; }
  12%  { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes cue-travel {
  0%   { transform: translate3d(0, -100%, 0); }
  70%  { transform: translate3d(0, 100%, 0); }
  100% { transform: translate3d(0, 100%, 0); }
}

/* ------------------------------------------------------------- entrance -- */

/* Staged, and slow. Nothing on this card arrives in a hurry. The cue is
   excluded — it owns its own transform, and its own much later timeline. */
.title-card__inner > :not(.scroll-cue) {
  opacity: 0;
  transform: translate3d(0, 10px, 0);
  animation: card-in 1100ms var(--ease-slow) forwards;
}

.title-card__inner > :nth-child(1) { animation-delay: 260ms; animation-duration: 1600ms; }
.title-card__inner > :nth-child(2) { animation-delay: 760ms; }
.title-card__inner > :nth-child(3) { animation-delay: 920ms; }
.title-card__inner > :nth-child(4) { animation-delay: 1080ms; }
.title-card__inner > :nth-child(5) { animation-delay: 1280ms; }
.title-card__inner > :nth-child(6) { animation-delay: 1440ms; }

@keyframes card-in {
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .title-card::after { animation: none; }
  /* The poster shows instead; js/title-card.js never starts playback. */
  .title-card__film video { opacity: 1; transition: none; }
  .title-card__inner > :not(.scroll-cue) { transform: none; animation-duration: 500ms; }
  .scroll-cue__line::after { animation: none; opacity: 0.5; }
  .title-card.is-leaving { transform: none; }
}
