/* The loading screen: the Swing logo draws itself, the charm swings and settles, the name
   rises, and the screen lifts like a curtain with the toran on its edge. The full show plays
   on the first page of a visit; later pages only swing while they load. */
#splash { display: none; }
html.splash-on body { overflow: hidden; }
html.splash-on #splash {
  display: grid; place-items: center; position: fixed; inset: 0; z-index: 1000;
  background: radial-gradient(120% 90% at 50% 30%, #1D2563, #0E1336 70%); color: #F6EEDC; visibility: visible;
}
#splash::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -14px; height: 14px;
  background: linear-gradient(#2F7D4F, #2F7D4F) bottom / 100% 3px no-repeat, repeating-linear-gradient(90deg, #D23A22 0 18px, #F29E18 18px 36px);
}
#splash .sp-inner { display: grid; justify-items: center; gap: 6px; }
#splash svg { width: min(46vw, 210px); height: auto; overflow: visible; }
#splash .sp-word { font-family: 'Rozha One', Georgia, serif; font-size: clamp(42px, 8vw, 64px); line-height: 1; display: flex; }
#splash .sp-word span { display: inline-block; }
#splash .sp-hand { font-family: 'Kalam', 'Segoe Print', cursive; color: #FFB52E; font-size: 18px; }
#splash.out { animation: sp-lift .75s cubic-bezier(.7, 0, .3, 1) forwards; }

/* The full show */
html.splash-full #splash .sp-draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: sp-draw .45s ease-out forwards; }
html.splash-full #splash .sp-ring { animation-delay: .15s; }
html.splash-full #splash .sp-cord { animation-delay: .45s; }
html.splash-full #splash .sp-arc1 { animation-delay: 1.2s; }
html.splash-full #splash .sp-arc2 { animation-delay: 1.35s; }
html.splash-full #splash .sp-pop { transform-box: fill-box; transform-origin: center; transform: scale(0); animation: sp-pop .5s cubic-bezier(.3, 1.7, .5, 1) forwards; }
html.splash-full #splash .sp-c1 { animation-delay: .85s; }
html.splash-full #splash .sp-c2 { animation-delay: 1s; }
html.splash-full #splash .sp-c3 { animation-delay: 1.12s; }
html.splash-full #splash .sp-swing { transform-box: view-box; transform-origin: 92px 30px; animation: sp-swing 1.5s cubic-bezier(.3, .6, .4, 1) .85s both; }
html.splash-full #splash .sp-word span { opacity: 0; transform: translateY(18px); animation: sp-rise .5s cubic-bezier(.2, .9, .3, 1.2) forwards; }
html.splash-full #splash .sp-hand { opacity: 0; animation: sp-fade .6s ease 1.95s forwards; }

/* A later page: the logo is already there and just swings while the page loads. */
html.splash-quick #splash .sp-swing { transform-box: view-box; transform-origin: 92px 30px; animation: sp-swing 1.1s cubic-bezier(.3, .6, .4, 1) both; }

@keyframes sp-draw { to { stroke-dashoffset: 0; } }
@keyframes sp-pop { to { transform: scale(1); } }
@keyframes sp-swing { 0% { transform: rotate(-20deg); } 32% { transform: rotate(13deg); } 56% { transform: rotate(-7deg); } 78% { transform: rotate(3deg); } 100% { transform: rotate(0); } }
@keyframes sp-rise { to { opacity: 1; transform: none; } }
@keyframes sp-fade { to { opacity: .9; } }
@keyframes sp-lift { to { transform: translateY(calc(-100% - 14px)); } }

@media (prefers-reduced-motion: reduce) {
  html.splash-on #splash *, html.splash-on #splash { animation: none !important; transform: none !important; opacity: 1 !important; stroke-dashoffset: 0 !important; }
  #splash.out { opacity: 0 !important; transition: opacity .3s; }
}
