/* details.css — editorial ornament layer (grain, headers, quotes, cards, motion) */

/* ── Selection & focus-visible ── */
::selection {
  background: rgba(196, 160, 53, 0.38);
  color: var(--cream);
}

::-moz-selection {
  background: rgba(196, 160, 53, 0.38);
  color: var(--cream);
}

:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(196, 160, 53, 0.22);
}

.thumb-item:focus-visible,
.slide-dot:focus-visible {
  outline-offset: 2px;
}

/* ── Enhanced grain (layered with body::after in anna-theme) ── */
.deck::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

/* ── Slide section counter (01 …) ── */
.deck-viewport {
  counter-reset: slide-section;
}

.slide:not(.slide-cover) {
  counter-increment: slide-section;
}

.slide-inner {
  --section-pad-top: 0.15rem;
}

.slide:not(.slide-cover) .slide-inner::before {
  content: counter(slide-section, decimal-leading-zero);
  position: absolute;
  top: auto;
  bottom: calc(var(--deck-chrome-safe) + 2.5rem);
  right: 2.5rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.2vw, 2.75rem);
  line-height: 1;
  color: var(--gold);
  opacity: 0.08;
  letter-spacing: 0.06em;
  pointer-events: none;
  z-index: 0;
}

.slide-quote .slide-inner::before {
  opacity: 0.05;
  bottom: calc(var(--deck-chrome-safe) + 1.5rem);
  right: 1.75rem;
  font-size: clamp(1.75rem, 2.5vw, 2.25rem);
}

/* ── Header ornament line ── */
.slide::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(196, 160, 53, 0.08) 8%,
    rgba(196, 160, 53, 0.55) 22%,
    rgba(196, 160, 53, 0.75) 50%,
    rgba(196, 160, 53, 0.55) 78%,
    rgba(196, 160, 53, 0.08) 92%,
    transparent 100%
  );
  z-index: 4;
  pointer-events: none;
}

.slide::before {
  content: "";
  position: absolute;
  top: 0;
  left: 3.5rem;
  width: 72px;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), rgba(196, 160, 53, 0.25));
  z-index: 5;
  pointer-events: none;
  border-radius: 0 0 2px 2px;
}

.slide-cover::before,
.slide-cover::after {
  display: none;
}

/* ── Quote ornaments: gold bar + curly marks + hover glow ── */
blockquote,
.glass-card blockquote {
  position: relative;
  border-left: none;
  padding-left: 2rem;
}

blockquote::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.15rem;
  bottom: 0.15rem;
  width: 3px;
  background: linear-gradient(
    180deg,
    rgba(196, 160, 53, 0.35) 0%,
    var(--gold) 35%,
    var(--gold-light) 65%,
    rgba(196, 160, 53, 0.35) 100%
  );
  border-radius: 2px;
  box-shadow: 0 0 14px rgba(196, 160, 53, 0.35);
}

blockquote::after {
  /* 正文已含弯双引号 “ ”，勿再叠加装饰引号 */
  content: none;
  display: none;
}

.quote-focusable {
  padding: 0.85rem 1rem 0.85rem 2rem;
  border-radius: var(--radius);
  cursor: pointer;
  pointer-events: auto;
  transition:
    transform 0.35s var(--ease-out),
    box-shadow 0.35s var(--ease-out),
    background 0.35s;
}

.quote-focusable:hover,
.quote-focusable:focus-visible {
  background: rgba(196, 160, 53, 0.06);
  box-shadow:
    0 0 0 1px rgba(196, 160, 53, 0.28),
    0 0 28px rgba(196, 160, 53, 0.18),
    0 12px 32px rgba(28, 21, 18, 0.22);
  transform: translateY(-3px);
}

.quote-focusable blockquote::before {
  box-shadow: 0 0 20px rgba(196, 160, 53, 0.55);
}

/* ── Cards: inner shadow, gold rim, corner marks ── */
.glass-card,
.text-card,
.path-card {
  position: relative;
  border: 1px solid rgba(196, 160, 53, 0.42);
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(244, 239, 228, 0.08),
    inset 0 -12px 28px rgba(28, 21, 18, 0.28),
    inset 0 0 0 1px rgba(196, 160, 53, 0.12);
}

.glass-card::before,
.text-card::before,
.path-card::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 10px;
  width: 18px;
  height: 18px;
  border-top: 2px solid rgba(196, 160, 53, 0.55);
  border-left: 2px solid rgba(196, 160, 53, 0.55);
  pointer-events: none;
  opacity: 0.75;
}

.glass-card::after,
.text-card::after,
.path-card::after {
  content: "";
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 18px;
  height: 18px;
  border-bottom: 2px solid rgba(196, 160, 53, 0.4);
  border-right: 2px solid rgba(196, 160, 53, 0.4);
  pointer-events: none;
  opacity: 0.55;
}

/* ── Cover typography & meta rule ── */
.slide-cover h1 {
  letter-spacing: 0.04em;
  word-spacing: 0.08em;
}

.slide-cover .subtitle {
  font-style: italic;
  letter-spacing: 0.03em;
  opacity: 0.94;
}

.slide-cover .meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: clamp(0.75rem, 2vh, 1.5rem);
  padding-top: clamp(0.65rem, 1.5vh, 1rem);
  border-top: 1px solid rgba(196, 160, 53, 0.35);
  max-width: 28rem;
}

.slide-cover .meta::before {
  content: "";
  flex: 0 0 32px;
  height: 1px;
  background: var(--gold);
  opacity: 0.6;
}

/* ── Per-slide background differentiation ── */
.slide[data-slide="cover"] .bg-veil {
  background: linear-gradient(160deg, rgba(28, 21, 18, 0.72) 0%, rgba(74, 15, 24, 0.55) 48%, rgba(28, 21, 18, 0.45) 100%);
}

.slide[data-slide="method"] .bg-veil {
  background: linear-gradient(225deg, rgba(28, 21, 18, 0.52) 0%, rgba(74, 15, 24, 0.38) 55%, rgba(28, 21, 18, 0.58) 100%);
}

.slide[data-slide="placeholder"] .bg-veil,
.slide[data-slide="karenin"] .bg-veil,
.slide[data-slide="vronsky"] .bg-veil {
  background: linear-gradient(135deg, rgba(28, 21, 18, 0.78) 0%, rgba(74, 15, 24, 0.58) 50%, rgba(28, 21, 18, 0.65) 100%);
}

.slide[data-slide^="labels-"] .bg-veil {
  background: linear-gradient(45deg, rgba(28, 21, 18, 0.55) 0%, rgba(122, 31, 46, 0.35) 40%, rgba(28, 21, 18, 0.62) 100%);
}

.slide[data-slide="timeline"] .bg-veil,
.slide[data-slide="closing"] .bg-veil {
  background: linear-gradient(90deg, rgba(28, 21, 18, 0.68) 0%, rgba(74, 15, 24, 0.52) 45%, rgba(28, 21, 18, 0.55) 100%);
}

.slide[data-slide="characters"] .bg-veil,
.slide[data-slide="levin"] .bg-veil {
  background: linear-gradient(315deg, rgba(28, 21, 18, 0.58) 0%, rgba(196, 160, 53, 0.12) 35%, rgba(28, 21, 18, 0.62) 100%);
}

.slide[data-slide="thanks"] .thanks-veil {
  background:
    radial-gradient(ellipse 72% 58% at 50% 42%, rgba(74, 15, 24, 0.38) 0%, transparent 68%),
    linear-gradient(
      180deg,
      rgba(28, 21, 18, 0.74) 0%,
      rgba(74, 15, 24, 0.56) 48%,
      rgba(28, 21, 18, 0.8) 100%
    );
}

/* Subtle bg image drift per slide */
.slide[data-slide="method"] .slide-bg img { transform-origin: 20% 50%; }
.slide[data-slide^="labels-"] .slide-bg img { transform-origin: 80% 30%; }
.slide[data-slide="timeline"] .slide-bg img { transform-origin: 50% 100%; }
.slide[data-slide="characters"] .slide-bg img { transform-origin: 0% 50%; }

/* ── Label tags: paper texture & layered shadow ── */
.label-tag {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.35) 0%, transparent 42%),
    repeating-linear-gradient(
      -3deg,
      var(--cream) 0px,
      var(--cream-deep) 1px,
      var(--cream) 2px,
      var(--cream) 6px
    );
  border: 1px solid rgba(28, 21, 18, 0.18);
  box-shadow:
    1px 2px 0 rgba(28, 21, 18, 0.1),
    3px 4px 0 rgba(28, 21, 18, 0.06),
    5px 8px 16px rgba(28, 21, 18, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.label-tag:hover {
  box-shadow:
    2px 3px 0 rgba(28, 21, 18, 0.08),
    4px 6px 0 rgba(28, 21, 18, 0.05),
    8px 14px 24px rgba(28, 21, 18, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* ── Timeline: pulse + line glow ── */
@keyframes timeline-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(196, 160, 53, 0.45), 0 0 12px rgba(196, 160, 53, 0.35);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(196, 160, 53, 0), 0 0 22px rgba(196, 160, 53, 0.55);
  }
}

.timeline-line-bg {
  box-shadow: 0 0 8px rgba(196, 160, 53, 0.12);
}

.timeline-line-progress {
  box-shadow:
    0 0 16px rgba(196, 160, 53, 0.55),
    0 0 32px rgba(196, 160, 53, 0.22);
  transition: width 0.65s var(--ease-out), box-shadow 0.45s ease;
}

.timeline-line-progress.glow-active {
  box-shadow:
    0 0 20px rgba(196, 160, 53, 0.65),
    0 0 40px rgba(196, 160, 53, 0.28);
}

@keyframes timeline-glow-pulse {
  0%, 100% {
    box-shadow:
      0 0 16px rgba(196, 160, 53, 0.55),
      0 0 32px rgba(196, 160, 53, 0.22);
  }
  50% {
    box-shadow:
      0 0 28px rgba(196, 160, 53, 0.85),
      0 0 56px rgba(196, 160, 53, 0.38);
  }
}

.timeline-line-progress.glow-pulse {
  animation: timeline-glow-pulse 0.85s ease-out;
}

.timeline-node.active .timeline-dot {
  animation: timeline-pulse 2.4s ease-in-out infinite;
}

.timeline-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(196, 160, 53, 0.35);
  opacity: 0;
  transition: opacity 0.3s;
}

.timeline-node.active .timeline-dot::after,
.timeline-node:hover .timeline-dot::after {
  opacity: 1;
}

/* ── Character nav: thicker active bar + avatar glow ── */
.char-nav-btn.active {
  border-left-width: 6px;
  padding-left: 1.05rem;
  box-shadow: inset 4px 0 18px rgba(196, 160, 53, 0.12);
}

.char-nav-btn.active .nav-initial {
  box-shadow:
    0 0 0 2px rgba(244, 239, 228, 0.15),
    0 0 16px rgba(196, 160, 53, 0.45),
    0 0 28px rgba(196, 160, 53, 0.2);
  border-width: 2px;
}

.char-nav-btn:hover .nav-initial {
  box-shadow: 0 0 12px rgba(196, 160, 53, 0.28);
}

/* ── Thumbnail sidebar hover slide indicator ── */
.thumb-item {
  position: relative;
}

.thumb-item::before {
  content: "";
  position: absolute;
  left: -0.35rem;
  top: 50%;
  width: 0;
  height: 0;
  transform: translateY(-50%);
  background: linear-gradient(180deg, rgba(196, 160, 53, 0.2), var(--gold), rgba(196, 160, 53, 0.2));
  border-radius: 2px;
  opacity: 0;
  box-shadow: 0 0 10px rgba(196, 160, 53, 0.45);
  transition:
    width 0.3s var(--ease-out),
    height 0.3s var(--ease-out),
    opacity 0.25s;
}

.thumb-item:hover::before,
.thumb-item:focus-visible::before,
.thumb-item.active::before {
  width: 4px;
  height: 70%;
  opacity: 1;
}

.thumb-item.active::before {
  width: 5px;
  box-shadow: 0 0 14px rgba(196, 160, 53, 0.65);
}

.thumb-item:hover {
  transform: translateX(8px);
}

.thumb-item::after {
  content: "";
  position: absolute;
  right: 0.35rem;
  top: 50%;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(196, 160, 53, 0.55));
  transform: translateY(-50%);
  opacity: 0;
  transition: width 0.35s var(--ease-out), opacity 0.25s;
}

.thumb-item:hover::after {
  width: 28px;
  opacity: 1;
}

/* ── Footer ornament (pairs with header line) ── */
.deck-chrome::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(196, 160, 53, 0.06) 12%,
    rgba(196, 160, 53, 0.35) 50%,
    rgba(196, 160, 53, 0.06) 88%,
    transparent 100%
  );
  pointer-events: none;
}

/* ── Magazine onboarding toast ── */
.onboarding-toast {
  border: 1px solid rgba(196, 160, 53, 0.55);
  border-top: 3px double var(--gold);
  padding: 1.35rem 2rem 1.15rem;
  text-align: left;
  max-width: 520px;
}

.onboarding-toast::before {
  content: "EDITORIAL · 导读";
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.85;
  margin-bottom: 0.65rem;
}

.onboarding-toast::after {
  content: "";
  position: absolute;
  top: 12px;
  right: 14px;
  width: 24px;
  height: 24px;
  border-top: 2px solid rgba(196, 160, 53, 0.45);
  border-right: 2px solid rgba(196, 160, 53, 0.45);
  pointer-events: none;
}

.onboarding-toast p {
  font-size: clamp(1.1rem, 1.6vw, 1.28rem);
  line-height: 1.65;
  border-left: 2px solid rgba(196, 160, 53, 0.4);
  padding-left: 0.85rem;
}

.onboarding-dismiss {
  letter-spacing: 0.18em;
  margin-top: 0.35rem;
  font-size: 0.82rem;
}

/* ── Reduced motion: ornaments without animation ── */
@media (prefers-reduced-motion: reduce) {
  .timeline-node.active .timeline-dot {
    animation: none;
    box-shadow: 0 0 16px rgba(196, 160, 53, 0.45);
  }

  .quote-focusable:hover,
  .quote-focusable:focus-visible {
    transform: none;
  }

  .deck::before {
    opacity: 0.015;
  }
}

/* ── Slide layout helpers (index.html class map) ── */
.slide-figure .method-grid {
  align-items: start;
}

.figure-quote-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.quote-stack-spaced {
  margin-top: 1.25rem;
}

.slide-bg-solid {
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(122, 31, 46, 0.45), transparent 70%),
    var(--burgundy-deep);
}

.slide-bg-solid img {
  display: none;
}

.veil-study {
  background: linear-gradient(
    160deg,
    rgba(28, 21, 18, 0.82) 0%,
    rgba(74, 15, 24, 0.62) 45%,
    rgba(28, 21, 18, 0.78) 100%
  );
}

/* Closing epigraph — no card; quote-hero styles live in presentation.css */

/* Quote column — narrower than --content-max-width for natural wrap */
.slide-quote .eyebrow,
.slide-quote .slide-eyebrow,
.slide-quote .part-label,
.slide-quote blockquote.quote-hero {
  max-width: var(--quote-column-width, min(38em, 78vw));
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  padding-left: 0;
  padding-right: 0;
}

.slide-quote blockquote.quote-hero::before {
  display: none;
}

.slide-quote blockquote.quote-hero p {
  text-wrap: pretty;
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.65;
}

/* ── Keyboard shortcuts overlay ── */
.keyboard-help-overlay {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(28, 21, 18, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s var(--ease-out), visibility 0.35s;
}

.keyboard-help-overlay.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.keyboard-help-panel {
  position: relative;
  width: min(520px, 100%);
  padding: 2rem 2.25rem 1.75rem;
  background: rgba(28, 21, 18, 0.92);
  border: 1px solid rgba(196, 160, 53, 0.45);
  border-top: 3px double var(--gold);
  border-radius: var(--radius);
  box-shadow:
    var(--shadow),
    0 0 48px rgba(196, 160, 53, 0.12);
}

.keyboard-help-panel h3 {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.2vw, 1.65rem);
  color: var(--cream);
  margin-bottom: 1.25rem;
  letter-spacing: 0.04em;
}

.keyboard-help-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.65rem 1.25rem;
  margin: 0;
  font-size: clamp(0.95rem, 1.4vw, 1.05rem);
}

.keyboard-help-grid dt {
  color: var(--gold-light);
  font-weight: 500;
  white-space: nowrap;
}

.keyboard-help-grid dd {
  margin: 0;
  color: var(--cream-deep);
  opacity: 0.92;
}

.keyboard-help-foot {
  margin-top: 1.35rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(196, 160, 53, 0.25);
  font-size: 0.9rem;
  color: var(--cream-deep);
  opacity: 0.75;
}

@media (max-width: 768px) {
  .slide:not(.slide-cover) .slide-inner::before {
    right: 1.5rem;
    top: 2rem;
    font-size: 2rem;
  }

  .slide::before {
    left: 1.5rem;
  }

  .keyboard-help-grid {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .keyboard-help-grid dt {
    margin-top: 0.5rem;
  }
}


/* Per-character label slides */
.slide[data-slide="labels-anna"] .bg-veil {
  background: linear-gradient(45deg, rgba(28, 21, 18, 0.55) 0%, rgba(122, 31, 46, 0.35) 40%, rgba(28, 21, 18, 0.62) 100%);
}

.slide[data-slide="labels-karenin"] .bg-veil {
  background: linear-gradient(135deg, rgba(28, 21, 18, 0.62) 0%, rgba(74, 15, 24, 0.42) 50%, rgba(28, 21, 18, 0.68) 100%);
}

.slide[data-slide="labels-dolly"] .bg-veil {
  background: linear-gradient(225deg, rgba(28, 21, 18, 0.58) 0%, rgba(196, 160, 53, 0.12) 35%, rgba(28, 21, 18, 0.62) 100%);
}

.slide[data-slide="labels-anna"] .slide-bg img { transform-origin: 80% 30%; }
.slide[data-slide="labels-karenin"] .slide-bg img { transform-origin: 20% 40%; }
.slide[data-slide="labels-dolly"] .slide-bg img { transform-origin: 50% 20%; }

.portrait-zone-anna .portrait-silhouette {
  background: linear-gradient(145deg, var(--cream-deep) 0%, #b8908a 45%, #7a1f2e 100%);
}

.portrait-zone-karenin .portrait-silhouette {
  background: linear-gradient(145deg, #c9c4bc 0%, #8a8580 45%, #3d3a38 100%);
}

.portrait-zone-dolly .portrait-silhouette {
  background: linear-gradient(145deg, var(--cream-deep) 0%, #c4b89a 45%, #8b7355 100%);
}
