:root {
  --wc-splash-navy-deep: #f5f5f7;
  --wc-splash-navy: #ffffff;
  --wc-splash-navy-mid: #eef4f8;
  --wc-splash-ivory: #515154;
  --wc-splash-fade-ms: 80ms;
}

body.startup-pending {
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--wc-splash-navy-deep);
}

body.startup-revealing {
  overflow: hidden;
  overscroll-behavior: none;
}

/*
 * The secure-access surface remains the owner of signed-out and failure states.
 * Keep it out of the visual tree only while the startup coordinator owns the
 * viewport, then let its existing styles resume unchanged.
 */
body.startup-pending > .private-access-gate,
body.startup-pending > .topbar,
body.startup-pending > main,
body.startup-pending > .bottom-nav {
  visibility: hidden;
}

#startupSplash {
  position: fixed;
  inset: 0;
  z-index: 20000;
  isolation: isolate;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 88% 58% at 50% 48%, rgba(23, 105, 170, .10) 0%, rgba(23, 105, 170, .04) 48%, rgba(245, 245, 247, 0) 78%),
    linear-gradient(180deg, var(--wc-splash-navy) 0%, var(--wc-splash-navy-deep) 55%, var(--wc-splash-navy-mid) 100%);
  color: #1d1d1f;
  opacity: 1;
  pointer-events: auto;
  transition: opacity var(--wc-splash-fade-ms) cubic-bezier(.2, .7, .2, 1);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#startupSplash[hidden] {
  display: none !important;
}

#startupSplash.is-leaving {
  opacity: 0;
}

.startup-splash-artwork {
  position: absolute;
  inset: 0;
  z-index: -2;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

.startup-splash-artwork[hidden] {
  display: none;
}

#startupSplashPicture {
  display: block;
  width: 100%;
  height: 100%;
}

#startupSplashPicture[hidden] {
  display: none;
}

#startupSplashImage {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: 50% 50%;
  color: transparent;
  font-size: 0;
}

/* A restrained treatment keeps the live branding first without burying the temple. */
#startupSplash::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 72% 36% at 50% 24%, rgba(255, 255, 255, .92) 0%, rgba(255, 255, 255, 0) 72%),
    linear-gradient(180deg, rgba(255, 255, 255, .20) 0%, rgba(238, 244, 248, .28) 100%);
}

/*
 * Keep the first paint light while the photo decodes, then restore the ward's
 * branded temple composition as soon as ward-branding confirms the image.
 */
#startupSplash.has-splash-image::after {
  background:
    radial-gradient(ellipse 72% 36% at 50% 24%, rgba(11, 39, 76, .08) 0%, rgba(3, 14, 34, 0) 72%),
    linear-gradient(180deg, rgba(3, 14, 34, .24) 0%, rgba(3, 14, 34, .08) 48%, rgba(3, 14, 34, .18) 100%);
}

#startupSplash.has-splash-image .startup-splash-copy {
  text-shadow: 0 2px 14px rgba(3, 14, 34, .48);
}

#startupSplash.has-splash-image #startupSplashTitle {
  color: #fff;
}

#startupSplash.has-splash-image .startup-splash-tagline {
  color: #f7f2e9;
}

.startup-splash-copy {
  position: absolute;
  inset-block-start: max(
    calc(env(safe-area-inset-top, 0px) + 68px),
    clamp(116px, 18vh, 196px)
  );
  inset-block-start: max(
    calc(env(safe-area-inset-top, 0px) + 68px),
    clamp(116px, 18svh, 196px)
  );
  inset-inline: 0;
  z-index: 1;
  width: min(100%, 560px);
  min-width: 0;
  margin-inline: auto;
  padding-inline: clamp(22px, 6vw, 48px);
  text-align: center;
  text-shadow: none;
}

#startupSplashTitle {
  max-width: 100%;
  margin: 0;
  padding-inline-start: .13em;
  color: #1d1d1f;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(1.72rem, 8.5vw, 2.75rem);
  font-weight: 770;
  line-height: 1.04;
  letter-spacing: .13em;
  white-space: nowrap;
}

.startup-splash-tagline {
  display: grid;
  gap: .08em;
  margin: clamp(20px, 3.1vh, 28px) 0 0;
  margin: clamp(20px, 3.1svh, 28px) 0 0;
  color: var(--wc-splash-ivory);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(1.05rem, 5.1vw, 1.45rem);
  font-weight: 430;
  line-height: 1.34;
  letter-spacing: -.012em;
}

#startupSplashTaglineLine1,
#startupSplashTaglineLine2 {
  display: block;
}

/* The portrait artwork becomes a deliberate canvas on wider viewports. */
@media (min-width: 720px) {
  .startup-splash-artwork {
    left: 50%;
    right: auto;
    width: min(560px, 100%);
    transform: translateX(-50%);
    box-shadow: 0 0 110px rgba(19, 53, 99, .22);
  }

  #startupSplashImage {
    object-position: 50% 36%;
  }
}

@media (min-width: 1000px) {
  .startup-splash-artwork {
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 5%, #000 95%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0%, #000 5%, #000 95%, transparent 100%);
  }
}

/* Keep the tower below the words when a short phone must crop the portrait. */
@media (max-height: 650px) {
  .startup-splash-copy {
    inset-block-start: max(calc(env(safe-area-inset-top, 0px) + 54px), 15vh);
    inset-block-start: max(calc(env(safe-area-inset-top, 0px) + 54px), 15svh);
  }

  #startupSplashImage {
    object-position: 50% 18%;
  }

  .startup-splash-tagline {
    margin-top: 18px;
  }
}

@media (max-width: 340px) {
  .startup-splash-copy {
    padding-inline: 18px;
  }

  #startupSplashTitle {
    padding-inline-start: .11em;
    font-size: clamp(1.6rem, 8.5vw, 1.8rem);
    letter-spacing: .11em;
  }

  .startup-splash-tagline {
    font-size: clamp(1rem, 5.1vw, 1.12rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  #startupSplash {
    transition-duration: 1ms;
  }
}
