:root {
  color-scheme: dark;
  background: #000000;
  color: #ffffff;
  font-family: 'Segoe UI', sans-serif;
}

body {
  box-sizing: border-box;
  display: grid;
  min-block-size: 100vh;
  min-block-size: 100svh;
  margin: 0;
  padding: 1.5rem;
  padding: clamp(.75rem, 3svh, 1.5rem);
  place-items: center;
}

.title-card {
  display: grid;
  justify-items: center;
  gap: clamp(1rem, 3vh, 1.75rem);
  text-align: center;
}

.insignia {
  display: block;
  inline-size: clamp(6rem, min(78vw, 59vh), 32rem);
  inline-size: clamp(5rem, min(78vw, 59svh), 32rem);
  max-inline-size: 100%;
  block-size: auto;
}

h1 {
  margin: 0;
  font-size: clamp(0.875rem, 2.8vw, 1.25rem);
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 2px;
  text-indent: 2px;
}

.intro-effects, .motion-toggle, .motion-control {
  display: none;
}

.ring-echo {
  opacity: 0;
}

.sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media screen and (prefers-reduced-motion: no-preference) {
  :root {
    --ring-start: 220ms;
    --spin-duration: 6000ms;
    --flash-start: 6150ms;
    --logo-start: 8820ms;
    --title-start: 9740ms;
    --ambient-start: 10550ms;
  }

  .intro-effects {
    display: block;
    position: fixed;
    z-index: 1;
    inset: 0;
    pointer-events: none;
  }

  .intro-ring, .intro-flash {
    position: absolute;
    inset: 0;
    opacity: 0;
  }

  .intro-ring {
    display: grid;
    place-items: center;
    animation: ring-light var(--spin-duration) linear var(--ring-start) both;
  }

  .intro-ring span {
    box-sizing: border-box;
    inline-size: clamp(1.7rem, 5.8vw, 2.4rem);
    aspect-ratio: 1;
    border: 2px solid #604b26;
    border-top-color: #eac876;
    border-right-color: #d4ad57;
    border-radius: 50%;
    animation: spin-up var(--spin-duration) cubic-bezier(.34, .035, .73, .19) var(--ring-start) both;
  }

  .intro-flash {
    background: #fff;
    animation: white-pulse 3450ms linear var(--flash-start) both;
  }

  .insignia {
    animation: logo-reveal 1050ms ease-out var(--logo-start) both,
               focus-drift 7900ms ease-in-out var(--ambient-start) infinite;
  }

  h1 {
    animation: title-reveal 600ms ease-out var(--title-start) both;
  }

  .ring-arc, .ring-echo {
    transform-box: view-box;
    transform-origin: 50px 53px;
  }

  .ring-arc {
    animation: ring-breathe 8900ms ease-in-out var(--ambient-start) infinite;
  }

  .ring-echo {
    animation: ring-ripple 8900ms ease-in-out var(--ambient-start) infinite;
  }

  .motion-toggle, .motion-control {
    position: fixed;
    inset-inline-end: max(1rem, env(safe-area-inset-right));
    inset-block-end: max(1rem, env(safe-area-inset-bottom));
    animation: show-motion-control 180ms ease-out var(--ambient-start) backwards;
  }

  .motion-toggle {
    display: block;
    inline-size: 1px;
    block-size: 1px;
    clip-path: inset(50%);
  }

  .motion-control {
    display: grid;
    z-index: 2;
    inline-size: 2.75rem;
    block-size: 2.75rem;
    place-items: center;
    border-radius: .35rem;
    color: #888;
    cursor: pointer;
  }

  .motion-control::after {
    content: '';
    box-sizing: border-box;
    inline-size: .58rem;
    block-size: .72rem;
    border-inline: 2px solid currentColor;
  }

  .motion-toggle:focus-visible + .motion-control, .motion-control:hover {
    color: #fff;
  }

  .motion-toggle:focus-visible + .motion-control {
    outline: 1px solid currentColor;
  }

  .motion-toggle:checked + .motion-control::after {
    inline-size: 0;
    block-size: 0;
    border: .37rem solid transparent;
    border-inline-start: .57rem solid currentColor;
    border-inline-end: 0;
  }

  .motion-toggle:checked ~ .title-card .insignia { animation-play-state: running, paused; }
  .motion-toggle:checked ~ .title-card :is(.ring-arc, .ring-echo) { animation-play-state: paused; }

  @keyframes ring-light {
    0%, 100% { opacity: 0; }
    5%, 99% { opacity: 1; }
  }

  @keyframes spin-up {
    from { transform: rotate(0turn); }
    to { transform: rotate(9.5turn); }
  }

  @keyframes white-pulse {
    from { opacity: 0; }
    /* 70 ms rise, followed by 2.5 seconds at full white. */
    2.03%, 74.49% { opacity: 1; }
    74.49% { animation-timing-function: ease-in-out; }
    to { opacity: 0; }
  }

  @keyframes logo-reveal {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  @keyframes title-reveal {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  @keyframes focus-drift {
    0%, 100% { filter: blur(0); }
    52% { filter: blur(.9px); }
  }

  @keyframes ring-breathe {
    0%, 74%, 100% { transform: scale(1); }
    41% { transform: scale(1.014, 1.004); }
  }

  @keyframes ring-ripple {
    0%, 15% { opacity: 0; transform: scale(1); }
    37% { opacity: .23; transform: scale(1.028); }
    74%, 100% { opacity: 0; transform: scale(1.075); }
  }

  @keyframes show-motion-control {
    from { visibility: hidden; opacity: 0; }
    to { visibility: visible; opacity: 1; }
  }
}
