/* ============================================================
   草灰伏线 · 贾宝玉 — hidden clue, water shadow, boat departure
   ============================================================ */

/* The clue lives on the tilted water plane, between 黛玉 and the
   unlocked Baoyu shadow. Buttons stay clickable; the plane does not. */
.baoyu-clue {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 132vw;
  height: 50vh;
  transform: translate(-50%, -50%) rotateX(64deg);
  transform-origin: center;
  z-index: 7;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 720ms var(--ease),
    visibility 0ms linear 720ms;
}

.baoyu-clue.is-visible {
  opacity: 1;
  visibility: visible;
  transition:
    opacity 720ms var(--ease),
    visibility 0ms;
}

.baoyu-clue__thread {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.baoyu-clue__thread path {
  fill: none;
  stroke: rgba(198, 190, 170, 0.16);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.baoyu-clue__thread path + path {
  stroke-dasharray: 2 10;
  animation: baoyu-thread 16s linear infinite;
}

@keyframes baoyu-thread {
  to {
    stroke-dashoffset: -120;
  }
}

.baoyu-glyph {
  position: absolute;
  left: var(--x, 50%);
  top: var(--y, 50%);
  z-index: 2;
  display: grid;
  place-items: center;
  width: clamp(38px, 5.4vh, 58px);
  height: clamp(38px, 5.4vh, 58px);
  transform: translate(-50%, -50%);
  border: 0;
  background: transparent;
  color: rgba(226, 232, 240, 0.14);
  font-family: "Noto Serif SC", serif;
  font-size: clamp(16px, 2.2vh, 26px);
  line-height: 1;
  text-shadow:
    0 0 0.8vh rgba(226, 232, 240, 0.08),
    0 0 2vh rgba(0, 0, 0, 0.55);
  cursor: pointer;
  pointer-events: auto;
  transition:
    color 300ms ease,
    text-shadow 300ms ease,
    transform 300ms var(--ease);
}

.baoyu-clue:not(.is-visible) .baoyu-glyph {
  pointer-events: none;
}

.baoyu-glyph:hover,
.baoyu-glyph:focus-visible {
  color: rgba(243, 214, 147, 0.9);
  text-shadow:
    0 0 1vh rgba(198, 161, 91, 0.55),
    0 0 2.6vh rgba(198, 161, 91, 0.22);
  outline: none;
  transform: translate(-50%, -50%) scale(1.12);
}

.baoyu-glyph.is-found {
  color: rgba(243, 214, 147, 0.72);
  text-shadow:
    0 0 1vh rgba(198, 161, 91, 0.4),
    0 0 2.4vh rgba(198, 161, 91, 0.16);
}

.baoyu-glyph.is-found::after {
  content: "";
  position: absolute;
  right: 4%;
  top: 8%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--zhusha, #b83b32);
  box-shadow: 0 0 0.8vh rgba(184, 59, 50, 0.55);
}

/* A single quiet line just below the mirror; the clue itself stays visual. */
.baoyu-hint {
  position: absolute;
  left: 50%;
  top: calc(100% + 1.4vh);
  z-index: 9;
  transform: translateX(-50%);
  margin: 0;
  color: rgba(226, 232, 240, 0.34);
  font-size: clamp(8px, 0.95vh, 10px);
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 600ms ease,
    visibility 0ms linear 600ms;
}

.baoyu-hint.is-visible {
  opacity: 1;
  visibility: visible;
  transition:
    opacity 600ms ease,
    visibility 0ms;
}

/* The unlocked figure: a water shadow in the centre of the mirror. */
.baoyu-shadow-wrap {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 8;
  width: clamp(82px, 8vw, 150px);
  transform: translate(-50%, -50%) translateY(3vh);
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 900ms var(--ease),
    transform 900ms var(--ease),
    visibility 0ms linear 900ms;
}

.baoyu-shadow-wrap.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%);
  transition:
    opacity 900ms var(--ease),
    transform 900ms var(--ease),
    visibility 0ms;
  pointer-events: auto;
}

.baoyu-shadow {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  border: 0;
  background: rgba(226, 232, 240, 0.5);
  -webkit-mask-image: url("/assets/silhouettes/jia_baoyu.png");
  mask-image: url("/assets/silhouettes/jia_baoyu.png");
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  filter: url(#filter-ink-wash);
  opacity: 0.52;
  cursor: pointer;
  transition:
    opacity 300ms ease,
    transform 500ms var(--ease);
}

.baoyu-shadow:hover,
.baoyu-shadow:focus-visible {
  opacity: 0.78;
  transform: scale(1.025);
  outline: none;
}

.baoyu-shadow__label {
  display: block;
  margin-top: 0.4vh;
  color: rgba(243, 214, 147, 0.62);
  font-size: clamp(8px, 0.95vh, 10px);
  letter-spacing: 0.22em;
  white-space: nowrap;
  text-shadow: 0 0 1vh rgba(0, 0, 0, 0.65);
}

/* Boat departure overlay */
.baoyu-boat {
  position: fixed;
  inset: 0;
  z-index: 180;
  overflow: hidden;
  background: #070d12;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 900ms var(--ease),
    visibility 0ms linear 900ms;
}

.baoyu-boat[hidden] {
  display: none;
}

.baoyu-boat.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition:
    opacity 900ms var(--ease),
    visibility 0ms;
}

#baoyu-boat-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.baoyu-boat__vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 46%, transparent 24%, rgba(4, 8, 12, 0.55) 78%),
    linear-gradient(180deg, rgba(4, 8, 12, 0.34), transparent 28%, transparent 70%, rgba(4, 8, 12, 0.62));
}

.baoyu-boat__ui {
  position: absolute;
  left: 50%;
  bottom: 5vh;
  z-index: 2;
  transform: translateX(-50%);
  width: min(88vw, 760px);
  text-align: center;
  pointer-events: none;
}

.baoyu-boat__kicker {
  margin: 0;
  color: rgba(198, 161, 91, 0.5);
  font-size: clamp(9px, 1.05vh, 12px);
  letter-spacing: 0.4em;
  text-indent: 0.4em;
}

.baoyu-boat__caption {
  margin: 0.9vh 0 0;
  color: rgba(226, 232, 240, 0.78);
  font-size: clamp(12px, 1.65vh, 18px);
  letter-spacing: 0.26em;
  text-indent: 0.26em;
  text-shadow: 0 0 1.6vh rgba(0, 0, 0, 0.7);
  opacity: 0;
}

.baoyu-boat.is-open .baoyu-boat__caption {
  animation: baoyu-caption 1600ms ease both 1800ms;
}

@keyframes baoyu-caption {
  from {
    opacity: 0;
    transform: translateY(1vh);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.baoyu-boat__close {
  margin-top: 2.4vh;
  padding: 0.7vh 1.2vw;
  border: 1px solid rgba(198, 161, 91, 0.32);
  background: rgba(10, 14, 20, 0.4);
  color: rgba(226, 232, 240, 0.6);
  font-size: clamp(9px, 1.05vh, 12px);
  letter-spacing: 0.22em;
  pointer-events: auto;
  transition:
    color 240ms ease,
    border-color 240ms ease,
    background 240ms ease;
}

.baoyu-boat__close:hover,
.baoyu-boat__close:focus-visible {
  color: #f3d693;
  border-color: rgba(198, 161, 91, 0.62);
  background: rgba(10, 14, 20, 0.62);
}

@media (max-width: 767px) {
  .baoyu-glyph {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .baoyu-hint {
    top: calc(100% + 0.8vh);
    font-size: 8px;
  }

  .baoyu-shadow-wrap {
    width: clamp(96px, 30vw, 168px);
  }

  .baoyu-boat__ui {
    bottom: 3.4vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .baoyu-clue__thread path + path,
  .baoyu-boat.is-open .baoyu-boat__caption {
    animation: none !important;
  }
}
