/* ------------------------------------------------------------------ home
   Landing page for 页间课堂. Everything here is light paper: the site never
   enters a dark mode. The page has two jobs: the hero says what an interactive
   video course is, and the shelf opens the first series. The signature object
   is still the slide stack: a pile of course slides that fans out on hover and
   cycles on its own until the pointer arrives. No framework, no CDN. */

body.page-home {
  overflow-x: clip;
}

body.page-home::before {
  background:
    radial-gradient(1100px 620px at 84% -8%, rgba(184, 69, 43, 0.08), transparent 62%),
    radial-gradient(900px 520px at -12% 26%, rgba(47, 111, 94, 0.05), transparent 64%),
    repeating-linear-gradient(
      0deg,
      rgba(22, 20, 15, 0.012) 0,
      rgba(22, 20, 15, 0.012) 1px,
      transparent 1px,
      transparent 4px
    );
}

/* ------------------------------------------------------------------ hero */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  align-items: center;
  gap: clamp(32px, 5vw, 72px);
  padding-block: clamp(44px, 6vw, 88px) clamp(36px, 2.8vw, 44px);
}

.hero__copy {
  max-width: 34em;
}

.hero__title {
  margin: 0 0 26px;
  font-size: clamp(42px, 5.7vw, 78px);
  line-height: 1.06;
  letter-spacing: -0.045em;
  font-weight: 700;
  text-wrap: balance;
}

.hero__title-accent {
  position: relative;
  color: var(--accent);
  white-space: nowrap;
}

.hero__title-accent::after {
  content: "";
  position: absolute;
  left: 2%;
  right: 0;
  bottom: 0.06em;
  height: 0.07em;
  background: currentColor;
  opacity: 0.24;
}

.hero__lede {
  max-width: 33em;
  font-size: clamp(16px, 1.55vw, 19px);
  line-height: 1.8;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 34px;
}

/* ------------------------------------------------------- the slide stack */

.hero__deck {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(400px, 40vw, 540px);
  perspective: 1300px;
}

.deck-stack {
  position: relative;
  width: min(100%, 470px);
  height: clamp(370px, 36vw, 470px);
  transform: rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  transition: transform 260ms ease-out;
  transform-style: preserve-3d;
}

.deck-stack::before {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 2%;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(22, 20, 15, 0.22), transparent 72%);
  filter: blur(6px);
  z-index: 0;
}

.deck-slide {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(100%, 432px);
  aspect-ratio: 16 / 10.6;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: clamp(14px, 1.5vw, 20px);
  background: var(--paper-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-stage);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.75) inset,
    0 26px 54px -38px rgba(22, 20, 15, 0.55);
  transform: translate(-50%, -50%) translate(var(--x, 0), var(--y, 0)) rotate(var(--r, 0deg))
    scale(var(--s, 1));
  transition:
    transform 620ms cubic-bezier(0.22, 0.61, 0.36, 1),
    box-shadow 620ms var(--ease),
    opacity 420ms var(--ease);
}

.deck-slide[data-slot="0"] {
  --x: 0px;
  --y: 0px;
  --r: -1.4deg;
  --s: 1;
  z-index: 5;
  opacity: 1;
}

.deck-slide[data-slot="1"] {
  --x: 28px;
  --y: 20px;
  --r: 3.4deg;
  --s: 0.985;
  z-index: 4;
  opacity: 0.94;
}

.deck-slide[data-slot="2"] {
  --x: -30px;
  --y: 34px;
  --r: -5.4deg;
  --s: 0.97;
  z-index: 3;
  opacity: 0.88;
}

.deck-slide[data-slot="3"] {
  --x: 10px;
  --y: 46px;
  --r: 7.6deg;
  --s: 0.955;
  z-index: 2;
  opacity: 0.82;
}

/* Hovering the deck spreads the pile. */
.hero__deck:hover .deck-slide[data-slot="0"] {
  --s: 1.015;
}

.hero__deck:hover .deck-slide[data-slot="1"] {
  --x: 88px;
  --y: 6px;
  --r: 7deg;
}

.hero__deck:hover .deck-slide[data-slot="2"] {
  --x: -84px;
  --y: 20px;
  --r: -9.5deg;
}

.hero__deck:hover .deck-slide[data-slot="3"] {
  --x: 12px;
  --y: 66px;
  --r: 12deg;
}

.deck-slide__top,
.deck-slide__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

.deck-slide__top {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.deck-slide__counter {
  color: var(--ink-soft);
}

.deck-slide__tag {
  color: var(--accent-text);
}

.deck-slide__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.deck-slide__body--center {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.deck-slide__kicker {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-transform: uppercase;
}

.deck-slide__headline {
  font-size: clamp(21px, 2.1vw, 28px);
  line-height: 1.24;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.deck-slide__headline--center {
  font-size: clamp(19px, 1.9vw, 25px);
}

.deck-slide__sub {
  font-size: 12px;
  color: var(--ink-soft);
}

.deck-slide__flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: auto;
}

.deck-slide__node {
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--paper);
  font-size: 11px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.deck-slide__node--accent {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--paper));
  color: color-mix(in srgb, var(--accent) 72%, var(--ink));
}

.deck-slide__arrow {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
}

.deck-slide__lines {
  display: grid;
  gap: 7px;
  margin-top: auto;
}

.deck-slide__line {
  height: 7px;
  border-radius: 4px;
  background: var(--paper-deep);
}

.deck-slide__line--short {
  width: 62%;
}

.deck-slide__line--mid {
  width: 82%;
}

.deck-slide__pause-mark {
  display: flex;
  gap: 7px;
  margin-bottom: 12px;
}

.deck-slide__pause-mark i {
  display: block;
  width: 9px;
  height: 28px;
  border-radius: 2px;
  background: var(--ink);
}

.deck-slide__keys {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
}

.deck-slide__key {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 28px;
  padding-inline: 7px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-inline);
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
}

.deck-slide__key--wide {
  min-width: 52px;
}

.deck-slide__bar {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  letter-spacing: 0.02em;
  text-transform: none;
}

.deck-slide__play {
  padding: 3px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: var(--radius-pill);
  color: color-mix(in srgb, var(--accent) 78%, var(--ink));
  background: color-mix(in srgb, var(--accent) 8%, var(--paper-raised));
}

.deck-stamp {
  position: absolute;
  right: -6%;
  bottom: 1%;
  z-index: 6;
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  padding: 10px;
  border: 1.5px solid color-mix(in srgb, var(--accent) 62%, var(--line));
  border-radius: 50%;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  color: color-mix(in srgb, var(--accent) 82%, var(--ink));
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.55;
  letter-spacing: 0.1em;
  text-align: center;
  transform: rotate(-11deg);
}

/* --------------------------------------------------------------- the shelf */

.shelf {
  padding-block: clamp(48px, 5vw, 72px) clamp(56px, 7vw, 96px);
  border-top: 1px solid var(--line);
}

.section-head__note {
  max-width: 30em;
  margin-top: 8px;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--ink-soft);
}

.shelf-feature {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: clamp(32px, 5.4vw, 84px);
}

.shelf-feature__poster {
  position: relative;
  display: block;
  padding: 10px 14px 34px 0;
  text-decoration: none;
}

.shelf-feature__poster::before,
.shelf-feature__poster::after {
  content: "";
  position: absolute;
  z-index: 0;
  border-radius: var(--radius-poster);
  border: 1px solid var(--line);
  transition: transform 380ms var(--ease);
}

.shelf-feature__poster::before {
  inset: 20px 2px 26px 20px;
  background: var(--paper-raised);
  transform: rotate(-2.4deg);
}

.shelf-feature__poster::after {
  inset: 30px 20px 16px 6px;
  background: color-mix(in srgb, var(--course-accent) 7%, var(--paper-raised));
  transform: rotate(1.8deg);
}

.shelf-feature__poster:hover::before {
  transform: rotate(-4deg) translateY(-2px);
}

.shelf-feature__poster:hover::after {
  transform: rotate(3.2deg) translateY(2px);
}

.poster {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  min-height: clamp(400px, 42vw, 486px);
  padding: clamp(22px, 2.6vw, 32px);
  overflow: hidden;
  background: var(--paper-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-poster);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 36px 70px -48px rgba(22, 20, 15, 0.6);
  transition:
    transform 320ms var(--ease),
    box-shadow 320ms var(--ease);
}

.shelf-feature__poster:hover .poster {
  transform: translateY(-4px) rotate(-0.5deg);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 44px 80px -46px rgba(22, 20, 15, 0.62);
}

.shelf-feature__poster:active .poster {
  transform: translateY(-1px) scale(0.995);
}

.shelf-feature__poster:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--course-accent) 70%, var(--ink));
  outline-offset: 8px;
  border-radius: 24px;
}

.poster__art {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.poster__ghost {
  position: absolute;
  right: 5%;
  top: 12%;
  font-family: var(--font-sans);
  font-size: clamp(110px, 13vw, 172px);
  font-weight: 800;
  line-height: 0.8;
  letter-spacing: -0.08em;
  color: transparent;
  -webkit-text-stroke: 1.5px color-mix(in srgb, var(--course-accent) 44%, transparent);
  opacity: 0.9;
}

.poster__ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--course-accent) 34%, transparent);
}

.poster__ring--one {
  width: 210px;
  height: 210px;
  right: -52px;
  bottom: 2%;
}

.poster__ring--two {
  width: 320px;
  height: 320px;
  right: -108px;
  bottom: -14%;
  border-color: color-mix(in srgb, var(--course-accent) 20%, transparent);
}

.poster__dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 46%;
  background-image: radial-gradient(
    color-mix(in srgb, var(--course-accent) 30%, transparent) 1px,
    transparent 1px
  );
  background-size: 17px 17px;
  mask-image: linear-gradient(180deg, transparent, #000 72%);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 72%);
  opacity: 0.8;
}

.poster__top,
.poster__meta {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

.poster__index {
  color: color-mix(in srgb, var(--course-accent) 74%, var(--ink));
  font-weight: 600;
}

.poster__level {
  margin-left: auto;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--paper) 70%, transparent);
  color: var(--ink-soft);
}

.poster__title {
  position: relative;
  z-index: 1;
  margin-top: auto;
}

.poster__subtitle {
  margin-bottom: 12px;
  max-width: 20em;
  font-size: 13.5px;
  line-height: 1.6;
  color: color-mix(in srgb, var(--course-accent) 64%, var(--ink));
}

.poster__title h3 {
  max-width: 9em;
  font-size: clamp(30px, 3.4vw, 46px);
  line-height: 1.1;
  letter-spacing: -0.035em;
  font-weight: 700;
  color: var(--ink);
  text-wrap: balance;
}

.poster__meta {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  text-transform: none;
  letter-spacing: 0.04em;
}

.poster__open {
  margin-left: auto;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 1px;
}

.shelf-feature__info {
  max-width: 34em;
}

.shelf-feature__title {
  margin: 16px 0 14px;
  font-size: clamp(27px, 3.1vw, 40px);
  line-height: 1.16;
  letter-spacing: -0.03em;
}

.shelf-feature__summary {
  font-size: 16.5px;
  line-height: 1.75;
  color: var(--ink-soft);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.tag-list li {
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--paper-raised);
  font-size: 12px;
  color: var(--ink-soft);
}

.shelf-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 40px;
  margin: 26px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.shelf-facts dt {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.shelf-facts dd {
  margin: 3px 0 0;
  font-size: 14.5px;
  font-weight: 600;
}

.shelf-feature__hint {
  margin-top: 22px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-faint);
}

.shelf-rest {
  margin-top: clamp(44px, 6vw, 72px);
}

.shelf-rest__title {
  margin-bottom: 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* --------------------------------------------------------------- responsive */

@media (max-width: 1060px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 20px;
    padding-block: clamp(36px, 5vw, 56px) clamp(40px, 6vw, 64px);
  }

  .hero__copy {
    max-width: 40em;
  }

  .hero__deck {
    min-height: 410px;
    margin-top: 10px;
  }

  .deck-stack {
    width: min(100%, 460px);
    height: 400px;
  }

  .shelf-feature {
    grid-template-columns: 1fr;
    gap: 34px;
  }

  .shelf-feature__poster {
    max-width: 520px;
    margin-inline: auto;
    width: 100%;
  }

  .shelf-feature__info {
    max-width: 42em;
  }
}

@media (max-width: 680px) {
  .hero {
    padding-top: 30px;
  }

  .hero__title {
    font-size: clamp(36px, 10.4vw, 46px);
    margin: 0 0 20px;
  }

  .hero__lede {
    font-size: 15.5px;
    line-height: 1.78;
  }

  .hero__actions {
    margin-top: 26px;
  }

  .hero__actions .button {
    flex: 1 1 auto;
  }

  .hero__deck {
    min-height: 340px;
  }

  .deck-stack {
    width: min(100%, 340px);
    height: 330px;
  }

  .deck-slide {
    width: min(100%, 312px);
  }

  .deck-slide__headline {
    font-size: 19px;
  }

  .deck-slide__node {
    font-size: 10px;
    padding: 3px 7px;
  }

  .hero__deck:hover .deck-slide[data-slot="1"] {
    --x: 52px;
    --y: 8px;
  }

  .hero__deck:hover .deck-slide[data-slot="2"] {
    --x: -48px;
    --y: 16px;
  }

  .hero__deck:hover .deck-slide[data-slot="3"] {
    --x: 6px;
    --y: 54px;
  }

  .deck-stamp {
    right: -2%;
    bottom: -2%;
    width: 84px;
    height: 84px;
    font-size: 9px;
  }

  .shelf {
    padding-block: 44px;
  }

  .section-head__note {
    font-size: 14px;
  }

  .poster {
    min-height: 380px;
  }

  .poster__title h3 {
    font-size: 30px;
  }

  .poster__ghost {
    font-size: 130px;
  }

  .shelf-facts {
    gap: 12px 28px;
  }
}

/* Very narrow phones: keep the fanned deck inside the viewport. */
@media (max-width: 360px) {
  .deck-slide[data-slot="1"] {
    --x: 16px;
    --y: 18px;
  }

  .deck-slide[data-slot="2"] {
    --x: -18px;
    --y: 28px;
  }

  .deck-slide[data-slot="3"] {
    --x: 4px;
    --y: 38px;
  }

  .deck-stamp {
    right: 0;
    bottom: 0;
    width: 74px;
    height: 74px;
    font-size: 8.5px;
  }

  .poster__title h3 {
    font-size: 26px;
  }
}

/* ------------------------------------------------------------- entrance
   Motion is decoration-free: content first, movement only to signal that
   something is a stack / a slide. Scroll-driven where supported. */

@media (prefers-reduced-motion: no-preference) {
  .hero__copy > .hero__title {
    animation: rise-in 680ms var(--ease) 60ms both;
  }

  .hero__copy > .hero__lede {
    animation: rise-in 680ms var(--ease) 140ms both;
  }

  .hero__copy > .hero__actions {
    animation: rise-in 680ms var(--ease) 220ms both;
  }

  .hero__deck {
    animation: deck-in 820ms var(--ease) 120ms both;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Scroll-driven reveal: translate only. Fading from opacity 0 needs a backwards
 * fill to hold the hidden state, and any render path that never scrolls (a
 * full-page capture, a preview panel, an export) then paints everything below
 * the fold as blank paper. Movement alone is enough to read the page in order. */
@keyframes slide-up {
  from {
    transform: translateY(16px);
  }
  to {
    transform: none;
  }
}

@keyframes deck-in {
  from {
    opacity: 0;
    transform: translateY(26px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .shelf > .section-head,
    .shelf-feature {
      animation: slide-up linear;
      animation-timeline: view();
      animation-range: entry 0% entry 26%;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .deck-slide,
  .shelf-feature__poster::before,
  .shelf-feature__poster::after,
  .poster,
  .deck-stack {
    transition: none;
  }

  .hero__deck:hover .deck-slide {
    --x: 0px;
    --y: 0px;
    --r: 0deg;
  }
}

@media print {
  .hero__deck {
    display: none;
  }

  .shelf > .section-head,
  .shelf-feature {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  body.page-home::before {
    background: none;
  }
}
