/* ------------------------------------------------------------------------------------------------------------
   Title screen (assets/app/splash.js): the logo over Putrajaya at dusk, bunting, a cheering crowd on the road, a
   loading bar and then the Start button. Uses the brand colours, so another brand gets its own look.
   ------------------------------------------------------------------------------------------------------------ */
html.splash-open, html.splash-open body { overflow: hidden; }
.splash {
  position: fixed; inset: 0; z-index: 2147483000; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; align-items: center; user-select: none; -webkit-user-select: none;
  color: #fff; font-family: var(--g-font, 'Segoe UI', system-ui, sans-serif);
  padding: max(14px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: #2a1846;
  transition: opacity .6s ease, transform .6s ease, filter .6s ease;
}
.splash.is-leaving { opacity: 0; transform: scale(1.06); filter: blur(4px); pointer-events: none; }

/* Sky: the Putrajaya photo under a purple-to-amber dusk, with slow light rays and a full moon. */
.splash-sky { position: absolute; inset: 0; z-index: -2;
  background:
    linear-gradient(180deg, transparent 58%, rgba(30, 12, 40, .6) 100%),
    radial-gradient(ellipse at 50% 112%, rgba(30, 12, 40, .0) 30%, rgba(30, 12, 40, .55) 80%),
    linear-gradient(180deg, rgba(58, 24, 112, .92) 0%, rgba(118, 40, 140, .78) 26%, rgba(236, 118, 74, .55) 52%, rgba(255, 190, 110, .25) 64%, rgba(40, 20, 50, .35) 100%),
    url('../../models/home/putrajaya.jpg') center 58% / cover no-repeat;
}
.splash-rays { position: absolute; left: 50%; top: 40%; width: 220vmax; height: 220vmax; transform: translate(-50%, -50%);
  background: repeating-conic-gradient(from 0deg, rgba(255, 240, 200, .10) 0deg 7deg, transparent 7deg 18deg);
  mask-image: radial-gradient(circle, #000 0, transparent 45%); -webkit-mask-image: radial-gradient(circle, #000 0, transparent 45%);
  animation: splash-spin 70s linear infinite; }
.splash-moon { position: absolute; top: 7%; right: 9%; width: clamp(64px, 13vmin, 130px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 38% 36%, #fffbe9 0, #fbe6b0 46%, #e9c47e 100%);
  box-shadow: 0 0 40px 12px rgba(255, 230, 170, .45), 0 0 120px 40px rgba(255, 200, 120, .25); }

/* Bunting in red, white, blue and yellow across the top. */
.splash-bunting { position: absolute; top: 0; left: -2%; right: -2%; height: 70px; display: flex; justify-content: space-between; z-index: -1;
  border-top: 3px solid rgba(60, 30, 20, .7); border-radius: 0 0 50% 50% / 0 0 40px 40px; pointer-events: none; }
.splash-bunting i { width: calc(100% / 15); height: 34px; margin-top: calc(14px * sin(calc(var(--i) / 13 * 180deg)));
  clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: top center; animation: splash-flap 2.6s ease-in-out infinite;
  animation-delay: calc(var(--i) * -.21s); background: #d62828; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .25)); }
.splash-bunting i:nth-child(4n+2) { background: #fdfdfd; }
.splash-bunting i:nth-child(4n+3) { background: #1d3fa6; }
.splash-bunting i:nth-child(4n) { background: #ffcc1f; }

/* Logo: chunky gold letters with a dark edge, like a game title. */
.splash-title { margin-top: clamp(40px, 9vh, 96px); text-align: center; animation: splash-drop .8s cubic-bezier(.2, 1.4, .4, 1) both; }
.splash-logo { position: relative; margin: 0; line-height: .9; font-weight: 900; letter-spacing: -.02em; font-size: clamp(64px, 17vmin, 168px);
  color: #ffd84a; background: linear-gradient(180deg, #fff6c4 0%, #ffe066 38%, #f5a300 72%, #d97a00 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  -webkit-text-stroke: clamp(4px, 1vmin, 9px) var(--g-purple-edge, #4f0b61); paint-order: stroke fill;
  filter: drop-shadow(0 clamp(4px, .9vmin, 9px) 0 var(--g-purple-edge, #4f0b61)) drop-shadow(0 14px 18px rgba(20, 0, 30, .5));
  transform: rotate(-3deg); }
.splash-logo span { -webkit-text-fill-color: #fff2b0; font-size: .55em; vertical-align: .55em; margin-inline-start: .04em; display: inline-block;
  animation: splash-twinkle 2.2s ease-in-out infinite; }
.splash-tagline { margin-top: 14px; display: inline-block; padding: 6px 18px; border-radius: 99px; font-weight: 900; font-size: clamp(13px, 2.2vmin, 18px);
  letter-spacing: .06em; text-transform: uppercase; color: #fff;
  background: linear-gradient(180deg, var(--g-purple, #b829c9), var(--g-purple-deep, #771491)); border: 3px solid #fff3; box-shadow: 0 4px 0 var(--g-purple-edge, #4f0b61); }

/* The crowd cheers on the road towards the viewer. */
.splash-stage { position: relative; flex: 1; width: min(980px, 100%); display: flex; align-items: flex-end; justify-content: center; min-height: 0; }
.splash-crowd { display: flex; align-items: flex-end; justify-content: center; width: min(760px, 100%); padding-bottom: 2vh; }
.splash-actor { flex: 0 0 23%; margin-inline: -2.2%; max-width: 168px; aspect-ratio: 7 / 11; background-image: var(--sprite); background-repeat: no-repeat; background-size: 1200% 300%;
  background-position: 0 calc(var(--row) * 50%); filter: brightness(1.08) drop-shadow(0 6px 4px rgba(20, 10, 30, .55));
  animation: splash-sprite 1.6s steps(11, end) infinite, splash-rise .7s cubic-bezier(.2, 1.3, .4, 1) var(--d) both; }
.splash-actor:nth-child(3) { flex-basis: 28%; max-width: 205px; z-index: 2; }
.splash-actor:is(:nth-child(2), :nth-child(4)) { z-index: 1; }
.splash-actor:is(:nth-child(1), :nth-child(5)) { transform: translateY(-7%); flex-basis: 20%; }
.splash-float { position: absolute; z-index: 2; font-size: clamp(28px, 6vmin, 58px); filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .25));
  animation: splash-bob 3s ease-in-out infinite; animation-delay: calc(var(--i) * -.6s); }
.splash-float:nth-of-type(1) { left: 6%; bottom: 46%; }
.splash-float:nth-of-type(2) { right: 8%; bottom: 52%; }
.splash-float:nth-of-type(3) { left: 46%; top: 2%; font-size: clamp(34px, 7vmin, 66px); }
.splash-float:nth-of-type(4) { left: 16%; bottom: 14%; }
.splash-float:nth-of-type(5) { right: 15%; bottom: 18%; }

/* Loading tip, the bar and then the Start button. */
.splash-foot { display: grid; justify-items: center; gap: 12px; width: min(560px, 100%); margin-bottom: clamp(10px, 4vh, 44px); }
.splash-tip { margin: 0; font-weight: 900; font-size: clamp(17px, 3.2vmin, 26px); text-align: center; color: #fff;
  -webkit-text-stroke: 5px #2a1238; paint-order: stroke fill; text-shadow: 0 3px 0 #2a1238; min-height: 1.3em; }
.splash-bar { position: relative; width: 100%; height: clamp(30px, 5vmin, 40px); border-radius: 12px; overflow: hidden;
  background: #1b0f2c; border: 4px solid #1b0f2c; box-shadow: 0 4px 0 rgba(0, 0, 0, .35), inset 0 0 0 2px rgba(255, 255, 255, .12); }
.splash-bar i { position: absolute; inset: 0 auto 0 0; width: var(--p, 0%); border-radius: 8px;
  background: linear-gradient(180deg, #8ff3ff 0%, #2cc8f0 45%, #1191d6 100%); box-shadow: inset 0 3px 0 rgba(255, 255, 255, .45); }
.splash-bar i::after { content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, .18) 0 12px, transparent 12px 24px); animation: splash-stripes .8s linear infinite; }
.splash-bar b { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(15px, 2.6vmin, 20px); font-weight: 900; color: #fff;
  -webkit-text-stroke: 4px #10314d; paint-order: stroke fill; }
.splash.is-ready .splash-bar { display: none; }
.splash-start { min-width: min(320px, 78vw); min-height: clamp(64px, 10vmin, 84px); padding: 8px 40px; border-radius: 22px; cursor: pointer;
  font: inherit; font-size: clamp(30px, 6vmin, 44px); font-weight: 900; letter-spacing: .06em; color: #fff;
  -webkit-text-stroke: 5px var(--g-green-edge, #1a6b31); paint-order: stroke fill;
  background: linear-gradient(180deg, #8cf0a6 0%, #4fd27a 30%, var(--g-green, #3cbb60) 55%, var(--g-green-deep, #22893f) 100%);
  border: 4px solid #fff; box-shadow: 0 7px 0 var(--g-green-edge, #1a6b31), 0 14px 26px rgba(0, 0, 0, .35), inset 0 4px 0 rgba(255, 255, 255, .5);
  animation: splash-pop .45s cubic-bezier(.2, 1.6, .4, 1) both, splash-pulse 1.4s ease-in-out .5s infinite; }
.splash-start:focus-visible { outline: 4px solid #ffe066; outline-offset: 4px; }
.splash-start:active, .splash.is-starting .splash-start { transform: translateY(6px) scale(.98); box-shadow: 0 1px 0 var(--g-green-edge, #1a6b31); animation: none; }
.splash-hint { font-size: 13px; font-weight: 800; color: #fff; opacity: .9; -webkit-text-stroke: 3px #2a1238; paint-order: stroke fill; animation: splash-blink 1.4s ease-in-out infinite; }
.splash-legal { position: absolute; bottom: max(6px, env(safe-area-inset-bottom)); right: 12px; margin: 0; font-size: 10px; font-weight: 700; color: rgba(255, 255, 255, .6); }

@keyframes splash-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes splash-flap { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(5deg); } }
@keyframes splash-drop { from { opacity: 0; transform: translateY(-60px) scale(.8); } to { opacity: 1; transform: none; } }
@keyframes splash-twinkle { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.18) rotate(12deg); } }
@keyframes splash-sprite { from { background-position-x: 0%; } to { background-position-x: 100%; } }
@keyframes splash-rise { from { opacity: 0; translate: 0 40px; } to { opacity: 1; translate: 0 0; } }
@keyframes splash-bob { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-14px) rotate(6deg); } }
@keyframes splash-stripes { to { background-position: 48px 0; } }
@keyframes splash-pop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: scale(1); } }
@keyframes splash-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes splash-blink { 0%, 100% { opacity: .95; } 50% { opacity: .45; } }

/* Wide screens: the crowd a little smaller so the logo and the button stay in view. */
@media (min-aspect-ratio: 4/3) {
  .splash-title { margin-top: clamp(30px, 7vh, 80px); }
  .splash-logo { font-size: clamp(64px, 15vmin, 150px); }
  .splash-crowd { width: min(640px, 70vh); }
}
@media (max-height: 520px) {
  .splash-title { margin-top: 26px; }
  .splash-logo { font-size: 54px; }
  .splash-tagline { margin-top: 6px; }
  .splash-foot { gap: 6px; margin-bottom: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .splash *, .splash { animation: none !important; transition: none !important; }
}
/* Tall phones: a bigger crowd fills the space between the logo and the button. */
@media (max-aspect-ratio: 3/4) {
  .splash-actor { flex-basis: 29%; margin-inline: -4%; }
  .splash-actor:nth-child(3) { flex-basis: 34%; }
  .splash-actor:is(:nth-child(1), :nth-child(5)) { flex-basis: 25%; }
}
