/* Password gate — styled as the book's paper world. Two paper "cover" halves
 * slide apart like opening a hard cover once the passphrase is accepted. */

#gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  overflow: hidden;
}

#gate::before,
#gate::after {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50.5%;
  content: "";
  background:
    radial-gradient(circle at 50% 12%, rgb(255 255 255 / 40%), transparent 30rem),
    linear-gradient(145deg, #e7e1d3, #d9d2c2);
  transition: transform 1.1s cubic-bezier(0.65, 0, 0.35, 1) 0.15s;
}

#gate::before {
  left: 0;
  box-shadow: inset -18px 0 30px rgb(31 28 22 / 14%);
}

#gate::after {
  right: 0;
  box-shadow: inset 18px 0 30px rgb(31 28 22 / 14%);
}

.gate--open::before {
  transform: translateX(-102%);
}

.gate--open::after {
  transform: translateX(102%);
}

.gate-card {
  position: relative;
  z-index: 2;
  width: min(88vw, 420px);
  padding: 44px 36px 38px;
  text-align: center;
  background: #f2eee4;
  border: 1px solid rgb(92 86 74 / 22%);
  box-shadow:
    0 24px 48px rgb(31 28 22 / 22%),
    inset 0 0 0 1px rgb(255 255 255 / 45%);
  transition: opacity 0.5s ease, transform 0.9s cubic-bezier(0.65, 0, 0.35, 1);
}

.gate--open .gate-card {
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
}

.gate-card--shake {
  animation: gate-shake 0.45s ease;
}

@keyframes gate-shake {
  20% {
    transform: translateX(-9px);
  }

  45% {
    transform: translateX(7px);
  }

  70% {
    transform: translateX(-4px);
  }

  90% {
    transform: translateX(2px);
  }
}

.gate-kicker {
  margin: 0;
  color: #847c6b;
  font: 600 10px/1.4 Georgia, "Times New Roman", serif;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.gate-title {
  margin: 14px 0 0;
  color: #26251f;
  font-family: KaiTi, "楷体", STKaiti, Georgia, serif;
  font-size: 64px;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-indent: 0.18em;
}

.gate-rule {
  width: 56px;
  height: 1px;
  margin: 20px auto 18px;
  background: rgb(92 86 74 / 55%);
}

.gate-lead {
  margin: 0 0 26px;
  color: #5c564a;
  font: 13px/1.7 KaiTi, "楷体", STKaiti, serif;
  letter-spacing: 0.12em;
}

#gate-form {
  display: flex;
  gap: 12px;
  align-items: stretch;
  justify-content: center;
}

#gate-input {
  flex: 1;
  min-width: 0;
  padding: 8px 2px;
  color: #26251f;
  font: 16px/1.4 KaiTi, "楷体", STKaiti, serif;
  letter-spacing: 0.1em;
  text-align: center;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgb(92 86 74 / 55%);
  border-radius: 0;
  outline: none;
  transition: border-color 0.25s ease;
}

#gate-input:focus {
  border-bottom-color: #26251f;
}

#gate-input::placeholder {
  color: rgb(92 86 74 / 42%);
  letter-spacing: 0.2em;
}

#gate-submit {
  flex: 0 0 auto;
  width: 40px;
  color: #f2eee4;
  cursor: pointer;
  background: #5c564a;
  border: 0;
  border-radius: 50%;
  font-size: 17px;
  line-height: 1;
  transition: background 0.25s ease, transform 0.25s ease;
}

#gate-submit:hover {
  background: #26251f;
  transform: translateX(2px);
}

#gate-note {
  min-height: 20px;
  margin: 18px 0 0;
  color: #847c6b;
  font: 12px/1.5 KaiTi, "楷体", STKaiti, serif;
  letter-spacing: 0.14em;
}

.gate-note--error {
  color: #a4543f;
}

@media (prefers-reduced-motion: reduce) {
  #gate::before,
  #gate::after,
  .gate-card {
    transition-duration: 0.01s;
  }
}
