/* Zindagi Trust–style opening splash — white screen, animated book open/close */
.pw-splash {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  background: #ffffff;
  transition: opacity 0.72s ease, visibility 0.72s ease;
}

.pw-splash.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

html.pw-splash-active,
html.pw-splash-active body {
  overflow: hidden;
  height: 100%;
}

.pw-splash__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  text-align: center;
}

/* ===== Animated book (open ↔ close) — high contrast ===== */
.pw-splash__book {
  width: clamp(64px, 13vw, 78px);
  height: clamp(46px, 9vw, 56px);
  perspective: 900px;
  perspective-origin: 50% 50%;
  filter: drop-shadow(0 6px 18px rgba(55, 65, 81, 0.28));
}

.pw-book {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.pw-book__spine {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  margin-left: -1.5px;
  background: #374151;
  z-index: 4;
  border-radius: 1px;
}

.pw-book__leaf {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  transform-style: preserve-3d;
  backface-visibility: hidden;
}

.pw-book__leaf--l {
  left: 0;
  transform-origin: 100% 50%;
  animation: pwBookOpenLeft 1.65s ease-in-out infinite;
}

.pw-book__leaf--r {
  right: 0;
  transform-origin: 0% 50%;
  animation: pwBookOpenRight 1.65s ease-in-out infinite;
}

.pw-book__face {
  position: absolute;
  inset: 0;
  border: 2px solid #374151;
  background: #E5E7EB;
  border-radius: 4px;
  box-sizing: border-box;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.pw-book__leaf--l .pw-book__face {
  border-right: none;
  border-radius: 6px 0 0 6px;
}

.pw-book__leaf--r .pw-book__face {
  border-left: none;
  border-radius: 0 6px 6px 0;
}

.pw-book__lines {
  position: absolute;
  inset: 16% 16%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
}

.pw-book__lines i {
  display: block;
  height: 1.5px;
  background: #4B5563;
  border-radius: 1px;
}

.pw-book__leaf--l .pw-book__lines i:nth-child(1) { width: 75%; }
.pw-book__leaf--l .pw-book__lines i:nth-child(2) { width: 58%; }
.pw-book__leaf--r .pw-book__lines i:nth-child(1) { width: 58%; margin-left: auto; }
.pw-book__leaf--r .pw-book__lines i:nth-child(2) { width: 75%; margin-left: auto; }

@keyframes pwBookOpenLeft {
  0%,
  100% {
    transform: rotateY(0deg);
  }
  50% {
    transform: rotateY(-38deg);
  }
}

@keyframes pwBookOpenRight {
  0%,
  100% {
    transform: rotateY(0deg);
  }
  50% {
    transform: rotateY(38deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pw-book__leaf--l,
  .pw-book__leaf--r {
    animation: none;
  }

  .pw-splash {
    transition-duration: 0.2s;
  }
}
