/* First-visit hints on the case studies (see assets/js/shared/scroll-hint.js).
   Two cards: .sh-scroll at the foot of the screen, a moving cue that says
   "down" beside the message; .sh-rail beside the chapter rail, pointing at
   it. Dark glass by default; .sh-card--light for dark pages. */

.sh-card {
  --sh-bg: rgba(12, 12, 16, 0.92);
  --sh-fg: #fff;
  --sh-soft: rgba(255, 255, 255, 0.76);
  --sh-dim: rgba(255, 255, 255, 0.55);
  --sh-line: rgba(255, 255, 255, 0.12);
  --sh-x: rgba(255, 255, 255, 0.08);
  --sh-x-hover: rgba(255, 255, 255, 0.18);
  --sh-from: translate3d(-50%, 0.8rem, 0);
  --sh-to: translate3d(-50%, 0, 0);
  position: fixed;
  z-index: 60;
  border-radius: 6px;
  background: var(--sh-bg);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35), inset 0 0 0 1px var(--sh-line);
  color: var(--sh-fg);
  font-family: "Manrope", system-ui, sans-serif;
  opacity: 0;
  transform: var(--sh-from);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.sh-card.is-in { opacity: 1; transform: var(--sh-to); pointer-events: auto; }

.sh-card--light {
  --sh-bg: #fff;
  --sh-fg: #0b0b0e;
  --sh-soft: rgba(11, 11, 14, 0.72);
  --sh-dim: rgba(11, 11, 14, 0.5);
  --sh-line: rgba(11, 11, 14, 0.08);
  --sh-x: rgba(11, 11, 14, 0.06);
  --sh-x-hover: rgba(11, 11, 14, 0.14);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5), inset 0 0 0 1px var(--sh-line);
}

.sh-card p { margin: 0; }
.sh-copy { display: grid; gap: 0.35rem; min-width: 0; }
.sh-s { color: var(--sh-soft); }

/* --- Keep scrolling: the main card --- */
.sh-scroll {
  left: 50%;
  bottom: max(1.75rem, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 1.4rem;
  width: min(31rem, calc(100vw - 2rem));
  padding: 1.5rem 3.4rem 1.5rem 1.6rem;
}
.sh-scroll .sh-t { font-size: clamp(1.35rem, 5.6vw, 1.6rem); font-weight: 800; line-height: 1.15; letter-spacing: -0.015em; }
.sh-scroll .sh-s { font-size: 1.02rem; line-height: 1.45; }

/* The cue: a scroll outline whose dot rolls down, over a cascade of
   chevrons. */
.sh-cue {
  position: relative;
  flex: none;
  display: grid;
  justify-items: center;
  align-content: start;
  width: 2.5rem;
  height: 5.6rem;
}
.sh-cue::before {
  content: "";
  width: 1.8rem;
  height: 2.9rem;
  border: 2px solid var(--sh-fg);
  border-radius: 0.9rem;
  box-sizing: border-box;
}
.sh-cue-dot {
  position: absolute;
  top: 0.55rem;
  left: 50%;
  width: 0.36rem;
  height: 0.62rem;
  margin-left: -0.18rem;
  border-radius: 0.2rem;
  background: var(--sh-fg);
  animation: sh-roll 1.6s cubic-bezier(0.45, 0, 0.3, 1) infinite;
}
.sh-cue i {
  display: block;
  width: 0.75rem;
  height: 0.75rem;
  margin-top: -0.24rem;
  border-right: 2px solid var(--sh-fg);
  border-bottom: 2px solid var(--sh-fg);
  transform: rotate(45deg);
  opacity: 0;
  animation: sh-fall 1.6s ease-in-out infinite;
}
.sh-cue i:first-of-type { margin-top: 0.4rem; }
/* Phones: flipped, so the dot and chevrons travel up with the swipe. */
.sh-up .sh-cue { transform: scaleY(-1); }
.sh-cue i:nth-of-type(2) { animation-delay: 0.18s; }
.sh-cue i:nth-of-type(3) { animation-delay: 0.36s; }

@keyframes sh-roll {
  0% { transform: translateY(0); opacity: 0; }
  20% { opacity: 1; }
  70% { transform: translateY(1.05rem); opacity: 0; }
  100% { transform: translateY(1.05rem); opacity: 0; }
}
@keyframes sh-fall {
  0%, 100% { opacity: 0; translate: 0 -0.15rem; }
  40% { opacity: 1; translate: 0 0.12rem; }
  70% { opacity: 0; translate: 0 0.35rem; }
}

/* --- Chapters: beside the rail, pointing at it --- */
.sh-rail {
  --sh-from: translate3d(0.8rem, -50%, 0);
  --sh-to: translate3d(0, -50%, 0);
  top: 50%;
  right: calc(clamp(0.6rem, 1.3vw, 1.4rem) + 1.5rem + 1rem);
  width: min(15.5rem, calc(100vw - 5rem));
  padding: 1rem 2.9rem 1.05rem 1.15rem;
}
.sh-rail .sh-k {
  font: 700 0.68rem/1 "Space Grotesk", system-ui, sans-serif;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--sh-dim);
}
.sh-rail .sh-s { font-size: 0.98rem; line-height: 1.4; color: var(--sh-fg); font-weight: 600; }
.sh-arrow {
  position: absolute;
  top: 50%;
  right: -0.4rem;
  width: 0.8rem;
  height: 0.8rem;
  background: var(--sh-bg);
  box-shadow: 1px -1px 0 var(--sh-line);
  transform: translateY(-50%) rotate(45deg);
}

@media (max-width: 899px) {
  .sh-rail { right: 2.6rem; }
}

.sh-x {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: var(--sh-x);
  color: var(--sh-fg);
  cursor: pointer;
  transition: background 0.2s ease, scale 0.2s ease;
}
.sh-x:hover { background: var(--sh-x-hover); scale: 1.06; }
.sh-x:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.sh-x svg { width: 0.85rem; height: 0.85rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

@media (prefers-reduced-motion: reduce) {
  .sh-card { --sh-from: var(--sh-to); transition: opacity 0.4s ease; }
  .sh-cue-dot { animation: none; transform: translateY(0.45rem); }
  .sh-cue i { animation: none; opacity: 0.6; }
}
