.residents-hero {
  --resident-card-width: clamp(225px, min(25vw, 40vh), 360px);
  --resident-ink: #191e1b;
  display: grid;
  grid-template-areas: "intro" "stage" "controls" "credit";
  grid-template-columns: minmax(0, 1fr);
  padding: clamp(25px, 2.6vw, 47px) 0 16px;
  overflow: clip;
  color: var(--resident-ink);
  background:
    radial-gradient(ellipse at 1% 62%, #afcfc0 0%, transparent 38%),
    radial-gradient(ellipse at 98% 64%, #d5cce8 0%, transparent 35%),
    radial-gradient(ellipse at 55% 100%, #ede3d8 0%, transparent 48%),
    #e9ece9;
}

.residents-intro,
.residents-controls {
  width: min(92%, 1480px);
  margin-inline: auto;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
}

.residents-intro { grid-area: intro; }
.residents-intro h1 {
  margin: 0;
  font-family: Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: clamp(40px, 6vw, 96px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -.045em;
}

.residents-intro h1 span { color: #ed2024; }
.residents-intro p {
  margin: 12px 0 0;
  font-size: clamp(12px, 1.15vw, 16px);
  line-height: 1.6;
  color: #404c44;
}

.residents-archive {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  padding: 10px 0;
  border-bottom: 1px solid #59635c;
  white-space: nowrap;
  font-size: 12px;
}

.residents-archive:hover { border-color: #ed2024; }
.residents-archive span { font-size: 18px; }
.residents-stage { grid-area: stage; }
.residents-track {
  position: relative;
  display: flex;
  align-items: center;
  gap: clamp(18px, 4.3vw, 72px);
  padding: clamp(17px, 1.9vw, 33px) calc((100% - var(--resident-card-width)) / 2);
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  touch-action: manipulation;
  cursor: grab;
  user-select: none;
}

.residents-track.is-dragging {
  scroll-snap-type: none;
  cursor: grabbing;
}

.resident-slide {
  flex: 0 0 var(--resident-card-width);
  min-width: 0;
  scroll-snap-align: center;
}

.resident-card {
  position: relative;
  margin: 0;
  padding: 6px;
  border: 1px solid #ffffffb8;
  border-radius: 21px;
  background: #fafffac2;
  box-shadow: 0 15px 30px #21342b20, inset 0 0 0 1px #ffffffb3;
}

.resident-card::after {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 11px #ffffff6b;
  background: linear-gradient(130deg, #fff4, transparent 24%, transparent 82%, #e4d5f231);
  pointer-events: none;
  content: "";
}

.resident-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  border-radius: 15px;
  background: #c6cec5;
}

.resident-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 37%;
}

.resident-image--sheet img {
  position: absolute;
  left: calc(var(--panel) * -100%);
  width: 300%;
  max-width: none;
}

.resident-card figcaption {
  position: absolute;
  z-index: 1;
  left: 17px;
  bottom: 17px;
  padding: 7px 11px;
  border: 1px solid #ffffff90;
  border-radius: 20px;
  background: #f5f7efec;
  color: #222c25;
  font-size: 11px;
  line-height: 1.3;
}

.residents-controls { grid-area: controls; align-items: center; }
.residents-pager, .residents-transport { display: flex; align-items: center; gap: 5px; }
.residents-pager button, .residents-transport button {
  display: grid;
  place-items: center;
  padding: 0;
  min-width: 44px;
  min-height: 44px;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.residents-pager button { border: 0; background: none; }
.residents-pager button::before {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: #89948b;
  content: "";
}
.residents-pager button[aria-current="true"]::before { width: 24px; background: #23362a; }
.residents-transport button {
  border: 1px solid #859388;
  border-radius: 50%;
  background: #ffffff55;
  font-size: 18px;
}
.residents-transport button:hover:not(:disabled) { background: #fff; }
.residents-transport button:disabled { opacity: .4; cursor: default; }
.residents-play span { font-size: 14px; }
.residents-credit {
  grid-area: credit;
  width: min(92%, 1480px);
  margin: 6px auto 0;
  color: #536058;
  font-size: 10px;
  letter-spacing: .04em;
}
.residents-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.residents-hero :focus-visible { outline: 2px solid #b8181d; outline-offset: 3px; }
.residents-track:focus-visible { outline-offset: -3px; }

@keyframes resident-perspective {
  0%, 24% { transform: perspective(780px) rotateY(41deg) rotateZ(-4deg) scale(.86); }
  50% { transform: perspective(780px) rotateY(var(--card-tilt-y, 0deg)) rotateX(var(--card-tilt-x, 0deg)) scale(1); }
  76%, 100% { transform: perspective(780px) rotateY(-41deg) rotateZ(4deg) scale(.86); }
}

@media (prefers-reduced-motion: no-preference) {
  @supports ((animation-timeline: view()) and (animation-range: entry)) {
    .resident-card {
      animation: resident-perspective auto linear both;
      animation-timeline: view(inline);
      animation-range: cover;
    }
  }

  @supports not ((animation-timeline: view()) and (animation-range: entry)) {
    .resident-card { transition: transform .4s ease; }
    .resident-slide[data-side="before"] .resident-card {
      transform: perspective(780px) rotateY(25deg) rotateZ(-3deg) scale(.88);
    }
    .resident-slide[data-side="after"] .resident-card {
      transform: perspective(780px) rotateY(-25deg) rotateZ(3deg) scale(.88);
    }
  }
}

@media (max-width: 620px) {
  .residents-hero {
    --resident-card-width: clamp(210px, 64vw, 300px);
    padding: 29px 0 19px;
  }
  .residents-intro { flex-direction: column; align-items: start; gap: 7px; }
  .residents-intro h1 { font-size: clamp(36px, 10.4vw, 63px); }
  .residents-intro p { margin-top: 8px; }
  .residents-archive { font-size: 11px; padding: 5px 0; gap: 8px; }
  .residents-track { gap: 12px; padding-block: 22px 17px; }
  .resident-card { padding: 4px; border-radius: 17px; }
  .resident-image { border-radius: 12px; }
  .residents-controls { gap: 8px; }
  .residents-pager, .residents-transport { gap: 2px; }
  .residents-pager button { min-width: clamp(26px, 7.8vw, 44px); }
  .residents-pager button::before { width: 11px; }
  .residents-pager button[aria-current="true"]::before { width: 16px; }
  .residents-transport button { min-width: 36px; min-height: 36px; }
}
