/* ============================================
   Work Detail — Layout + Rail Blocks V1
   ============================================ */

/* ── Header ── */
.work-detail__header {
  /* margin-bottom: var(--space-xs); */
  container-type: inline-size;
  transition: margin-bottom 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.work-detail__title {
  /* margin-bottom: var(--space-xs); */
  font-family: var(--font-display-current);
  font-size: clamp(1.5rem, 15cqi, 4rem);
  line-height: 1;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
  transition: font-size 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ── Tags (pills) ── */
.work-detail__tags {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-sm) 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 80px;
  overflow: hidden;
  opacity: 1;
  transition:
    max-height 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    opacity 0.4s ease,
    margin 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.work-detail__tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  background: color-mix(in srgb, var(--surface-text) 12%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: none;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: var(--text-xxxs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--surface-text);
  line-height: 1;
  white-space: nowrap;
}

.work-detail__tag--more {
  opacity: 0.45;
  background: color-mix(in srgb, var(--surface-text) 6%, transparent);
}

/* ── Meta line: "Year · Role" ── */
.work-detail__meta-line {
  max-height: 40px;
  overflow: hidden;
  opacity: 0.45;
  margin-top: var(--space-xs);
  margin-bottom: 0;
  line-height: 1.4;
  transition:
    max-height 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    opacity 0.4s ease,
    margin 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ── Compact state (non-context sections) ── */
.work-detail.is-compact .work-detail__title {
  font-size: clamp(1rem, 1.5vw + 0.5rem, 1.5rem);
}

.work-detail.is-compact .work-detail__tags {
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
}

.work-detail.is-compact .work-detail__meta-line {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}

/* .work-detail.is-compact .work-detail__header {
  margin-bottom: var(--space-xs);
} */

/* Show toggle button in compact mode */
.work-detail.is-compact .work-detail__tocToggle {
  display: flex;
}

/* Collapse list in compact mode */
.work-detail.is-compact .work-detail__tocList {
  max-height: 0;
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 60%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0, #000 60%, transparent 100%);
}

/* Expand on hover (desktop) or explicit toggle */
.work-detail.is-compact .work-detail__toc:hover .work-detail__tocList,
.work-detail.is-compact.is-toc-open .work-detail__tocList {
  max-height: clamp(120px, 28vh, 260px);
  overflow-y: auto;
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 18px), transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 18px), transparent 100%);
}

/* Chevron rotation when open */
.work-detail.is-compact .work-detail__toc:hover .work-detail__tocChevron,
.work-detail.is-compact.is-toc-open .work-detail__tocChevron {
  transform: rotate(-135deg);
}

.work-detail.is-compact .work-detail__index-list {
  gap: 0;
}

.work-detail.is-compact .work-detail__index-link {
  padding: 2px 0;
  font-size: calc(var(--text-xs) - 0.05rem);
}

/* ── Main grid: 4/8 ── */
.work-detail {
  padding-inline: var(--edge-margin);
  max-width: var(--wide-max);
  margin-inline: auto;
  padding-bottom: var(--space-2xl);
}

.work-detail__grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(16px, 3vw, 48px);
}

.work-detail__left {
  grid-column: 1 / span 4;
  position: sticky;
  top: clamp(16px, 6vh, 72px);
  align-self: start;
  padding-top: var(--space-md);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2vh, 20px);
  max-height: calc(100vh - clamp(16px, 6vh, 72px) - var(--space-lg));
}

.work-detail__right {
  grid-column: 5 / span 8;
  min-width: 0;
  /* prevent grid track overflow */
}

/* ── TOC (collapsible index) ── */
.work-detail__toc {
  flex-shrink: 0;
}

.work-detail__tocHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.work-detail__tocLabel {
  opacity: 0.5;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.work-detail__tocToggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: none;
  color: var(--surface-text);
  opacity: 0.4;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.work-detail__tocToggle:hover {
  opacity: 1;
}

.work-detail__tocChevron {
  display: block;
  width: 10px;
  height: 10px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.work-detail__tocList {
  max-height: 600px;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ── Section index ── */
.work-detail__index-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  transition:
    gap 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.work-detail__index-link {
  display: flex;
  align-items: baseline;
  gap: 0.75em;
  padding: 2px 0;
  text-decoration: none;
  color: var(--surface-text);
  opacity: 0.4;
  transition:
    opacity 0.2s ease,
    padding 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    font-size 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.work-detail__index-link:hover,
.work-detail__index-link.is-active {
  opacity: 1;
  color: var(--accent-current);
}

.work-detail__index-label {
  font-variant-numeric: tabular-nums;
  min-width: 1.6em;
  opacity: 0.6;
}

/* ── Narrative body ── */
.work-detail__narrative {
  padding-top: var(--space-xs);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.work-detail__narrative-window {
  position: relative;
  width: 100%;
  flex: 1;
  overflow: hidden;
  /* We scroll this via JS */
  /* Mask removed to ensure full text visibility as requested */
}

.work-detail__narrative-scroll {
  display: flex;
  flex-direction: column;
  padding-bottom: 20vh;
  /* space to scroll last item up */
}

.work-detail__narrative-item {
  padding-bottom: var(--space-lg);
  opacity: 0.2;
  transition: opacity 0.4s ease;
  will-change: transform, opacity;
}

.work-detail__narrative-item.is-active {
  opacity: 1;
}

.work-detail__narrative-body {
  line-height: 1.7;
  color: var(--surface-text);
  padding-right: 8px;
}

.work-detail__narrative-body p {
  margin-bottom: 0.8em;
}

.work-detail__narrative-body p:last-child {
  margin-bottom: 0;
}

/* ── Section head (discrete dividers + mobile section titles) ── */
.rail-section-head {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: var(--space-sm);
}

.rail-section-head__label {
  display: none;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--surface-text);
  opacity: 0.4;
}

/* ── Rail ── */
.work-detail__rail {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.5vw, 24px);
}

/* ── Placeholder media ── */
.ph {
  width: 100%;
  border-radius: 8px;
  background:
    linear-gradient(135deg,
      rgba(255, 255, 255, 0.04) 0%,
      rgba(255, 255, 255, 0.02) 50%,
      rgba(255, 255, 255, 0.05) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ── Base block ── */
.rail-block {
  position: relative;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--surface-bg);
  filter: blur(0);
  transition: filter 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ── Section defocus (non-active sections get subtle blur) ── */
.rail-block.is-defocused {
  filter: blur(2px);
  opacity: 0.5;
}

/* ── Surface (content layer, always present) ── */
.rail-block__surface {
  position: relative;
  z-index: 1;
}

.rail-block[data-aura="true"] .rail-block__surface {
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(14, 14, 14, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* grain overlay via pseudo */
.rail-block[data-aura="true"] .rail-block__surface::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 4px);
  filter: contrast(120%) brightness(90%);
}

/* ── Aura layer ── */
.rail-block__aura {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;

  --aura-base: var(--work-color, var(--accent-current, #2865FF));
  --aura-light: color-mix(in oklab, var(--aura-base) 55%, white);
  --aura-dark: color-mix(in oklab, var(--aura-base) 55%, black);
}

/* ── Blobs ── */
.aura-blob {
  display: block;
  position: absolute;
  filter: blur(40px) saturate(140%);
  mix-blend-mode: screen;
  will-change: transform, border-radius;
}

/* blob 0: base puro, centrado, detrás de todos */
.aura-blob--0 {
  width: 70%;
  aspect-ratio: 1;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  opacity: 0.95;
  background: radial-gradient(ellipse at center, var(--aura-base) 0%, transparent 65%);
  border-radius: 50% 50% 50% 50%;
  filter: blur(50px) saturate(140%);
  z-index: 0;
  animation:
    blobDrift0 16s ease-in-out infinite alternate;
}

.aura-blob--1 {
  width: 55%;
  aspect-ratio: 1;
  top: 10%;
  left: 5%;
  opacity: 0.9;
  z-index: 1;
  background: radial-gradient(ellipse at center, var(--aura-light) 0%, transparent 70%);
  border-radius: 43% 57% 62% 38% / 55% 42% 58% 45%;
  animation:
    blobMorph1 8s ease-in-out infinite alternate,
    blobDrift1 10s ease-in-out infinite alternate;
}

.aura-blob--2 {
  width: 50%;
  aspect-ratio: 1.15;
  top: 20%;
  right: 5%;
  opacity: 0.85;
  z-index: 1;
  background: radial-gradient(ellipse at center, var(--aura-base) 0%, transparent 70%);
  border-radius: 58% 42% 35% 65% / 45% 60% 40% 55%;
  animation:
    blobMorph2 10s ease-in-out infinite alternate,
    blobDrift2 13s ease-in-out infinite alternate;
}

.aura-blob--3 {
  width: 55%;
  aspect-ratio: 0.9;
  bottom: 5%;
  left: 15%;
  opacity: 0.8;
  z-index: 1;
  background: radial-gradient(ellipse at center, var(--aura-dark) 0%, transparent 70%);
  border-radius: 38% 62% 52% 48% / 60% 38% 62% 40%;
  animation:
    blobMorph3 9s ease-in-out infinite alternate,
    blobDrift3 12s ease-in-out infinite alternate;
}

/* ── Aura seed: vary duration + delay per block for true variety ── */
.rail-block__aura .aura-blob--0 {
  animation-duration: calc(16s + var(--aura-seed, 0) * 0.9s);
  animation-delay: calc(var(--aura-seed, 0) * -3.2s);
}

.rail-block__aura .aura-blob--1 {
  animation-duration: calc(8s + var(--aura-seed, 0) * 0.7s), calc(10s + var(--aura-seed, 0) * 1.1s);
  animation-delay: calc(var(--aura-seed, 0) * -1.7s), calc(var(--aura-seed, 0) * -2.3s);
}

.rail-block__aura .aura-blob--2 {
  animation-duration: calc(10s + var(--aura-seed, 0) * 0.5s), calc(13s + var(--aura-seed, 0) * 0.8s);
  animation-delay: calc(var(--aura-seed, 0) * -2.1s), calc(var(--aura-seed, 0) * -1.4s);
}

.rail-block__aura .aura-blob--3 {
  animation-duration: calc(9s + var(--aura-seed, 0) * 1.3s), calc(12s + var(--aura-seed, 0) * 0.6s);
  animation-delay: calc(var(--aura-seed, 0) * -1.3s), calc(var(--aura-seed, 0) * -2.8s);
}

/* Flip direction on even-seeded blocks for extra variety */
.rail-block[data-aura="true"]:nth-child(even) .aura-blob {
  animation-direction: alternate-reverse;
}

/* ── Background color options ── */
/* Applied per .rail-media so color stays inside each card, not bleeding into gaps */
/* brand_alt falls back to brand which falls back to accent */
.rail-block[data-bg="accent"] .rail-media {
  background: var(--accent-current);
}

.rail-block[data-bg="brand"] .rail-media {
  background: var(--work-color, var(--accent-current));
}

.rail-block[data-bg="brand_alt"] .rail-media {
  background: var(--work-color-alt, var(--work-color, var(--accent-current)));
}

.rail-block[data-bg="white"] .rail-media,
.rail-block[data-bg="light"] .rail-media {
  background: #ffffffae;
}

.rail-block[data-bg="dark"] .rail-media {
  background: #060606;
}

.rail-block[data-bg="soft-dark"] .rail-media {
  background: #2e2e2e;
}

/* ── Desaturated aura (mono) ── */
.rail-block[data-aura-mono="true"] .rail-block__aura {
  filter: grayscale(1) brightness(0.7);
}

/* ── Logo overlay inside surface ── */
.rail-block__logo {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.rail-block__logo-img {
  width: 48%;
  max-height: 58%;
  opacity: 0.85;
  object-fit: contain;
}

/* ── Blob morph keyframes ── */
@keyframes blobMorph1 {
  0% {
    border-radius: 43% 57% 62% 38% / 55% 42% 58% 45%;
  }

  33% {
    border-radius: 52% 48% 45% 55% / 40% 60% 38% 62%;
  }

  66% {
    border-radius: 60% 40% 55% 45% / 48% 52% 45% 55%;
  }

  100% {
    border-radius: 45% 55% 50% 50% / 58% 42% 55% 45%;
  }
}

@keyframes blobMorph2 {
  0% {
    border-radius: 58% 42% 35% 65% / 45% 60% 40% 55%;
  }

  33% {
    border-radius: 42% 58% 55% 45% / 60% 40% 55% 45%;
  }

  66% {
    border-radius: 50% 50% 42% 58% / 38% 62% 48% 52%;
  }

  100% {
    border-radius: 55% 45% 60% 40% / 50% 50% 42% 58%;
  }
}

@keyframes blobMorph3 {
  0% {
    border-radius: 38% 62% 52% 48% / 60% 38% 62% 40%;
  }

  33% {
    border-radius: 55% 45% 40% 60% / 48% 52% 50% 50%;
  }

  66% {
    border-radius: 42% 58% 58% 42% / 55% 45% 38% 62%;
  }

  100% {
    border-radius: 50% 50% 45% 55% / 42% 58% 55% 45%;
  }
}

/* ── Blob drift keyframes ── */
@keyframes blobDrift0 {
  0% {
    transform: scale(1.0);
  }

  50% {
    transform: scale(1.18);
  }

  100% {
    transform: scale(0.95);
  }
}

@keyframes blobDrift1 {
  0% {
    transform: translate3d(0, 0, 0) scale(1.0);
  }

  33% {
    transform: translate3d(35%, -15%, 0) scale(1.2);
  }

  66% {
    transform: translate3d(-20%, 25%, 0) scale(0.9);
  }

  100% {
    transform: translate3d(10%, 10%, 0) scale(1.15);
  }
}

@keyframes blobDrift2 {
  0% {
    transform: translate3d(0, 0, 0) scale(1.05);
  }

  33% {
    transform: translate3d(-35%, 20%, 0) scale(1.3);
  }

  66% {
    transform: translate3d(25%, -25%, 0) scale(0.85);
  }

  100% {
    transform: translate3d(-10%, -10%, 0) scale(1.1);
  }
}

@keyframes blobDrift3 {
  0% {
    transform: translate3d(0, 0, 0) scale(1.1);
  }

  33% {
    transform: translate3d(25%, -30%, 0) scale(0.9);
  }

  66% {
    transform: translate3d(-30%, 20%, 0) scale(1.3);
  }

  100% {
    transform: translate3d(15%, -5%, 0) scale(1.05);
  }
}

.rail-block__figure {
  margin: 0;
}

/* ── Media wrapper (ratio lives here) ── */
.rail-media {
  width: 100%;
  overflow: hidden;
  border-radius: 12px;
  /* Internal cards always rounded */
  background: rgba(255, 255, 255, 0.02);
  display: block;
}

/* ── Individual Card (The Premium Unit) ── */
.rail-card {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Individual card background variants */
.rail-card[data-bg="brand"] {
  background: var(--work-color, var(--accent-current));
}

.rail-card[data-bg="white"] {
  background: #ffffffae;
}

.rail-card[data-bg="dark"] {
  background: #060606;
}

.rail-card[data-bg="soft-dark"] {
  background: #2e2e2e;
}

/* If a card has background, give it some padding so the media floats inside */
.rail-card[data-bg] {
  padding: var(--space-xs);
}

.rail-card[data-bg] .rail-media {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Make both image + placeholder fill the ratio box */
.rail-media__img,
.rail-media .ph {
  width: 100%;
  height: 100%;
  display: block;
}

/* Real image behavior */
.rail-media__img {
  object-fit: cover;
  object-position: center;
}

/* ── Media caption / credits ── */
.rail-media__caption {
  font-family: var(--font-ui);
  font-size: var(--text-xs, 0.75rem);
  line-height: 1.4;
  color: var(--surface-text);
  opacity: 0.45;
  padding-top: 8px;
  letter-spacing: 0.01em;
}

/* ── hero_full: brand color panel + logo — fills the above-fold viewport ── */
.rail-block--hero_full {
  background: var(--work-color, var(--accent-current));
  height: calc(100dvh - 10dvh);
}

.rail-block--hero_full .rail-block__surface {
  height: 100%;
}

.rail-block--hero_full .rail-block__logo-img {
  width: 52%;
  max-height: 65%;
}

/* ── duo_equal ── */
.rail-block__duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(8px, 1.5vw, 16px);
}

/* ── duo_stack (right / left) ── */
.rail-block__duo-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(8px, 1.5vw, 16px);
  align-items: stretch;
}

/* Make right stack match left height */
.rail-block__duo-stack .rail-block__stack {
  height: 100%;
}

.rail-block__duo-stack .rail-block__stack>.rail-block__figure {
  flex: 1;
  min-height: 0;
}

.rail-block__duo-stack .rail-block__figure .rail-media {
  height: 100%;
}

.rail-block__duo-stack>* {
  min-width: 0;
}

.rail-block__duo-stack--reverse {
  direction: ltr;
}

.rail-block__stack {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.5vw, 16px);
}

.rail-block__stack .rail-block__figure {
  flex: 1;
  min-height: 0;
}

.rail-block__stack .ph {
  height: 100%;
}

.rail-block__duo-stack .rail-block__figure--large .ph {
  height: 100%;
}

/* ── quad_grid (2x2) ── */
.rail-block__quad {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(8px, 1.5vw, 16px);
}

/* ── mosaic ── */
.rail-block__mosaic {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: clamp(8px, 1.5vw, 16px);
}

.rail-block__mosaic>.rail-block__figure--large .ph {
  height: 100%;
}

/* ── strip_screens (horizontal scroll) ── */
.rail-block__strip {
  display: flex;
  gap: clamp(8px, 1.5vw, 16px);
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.rail-block__strip::-webkit-scrollbar {
  display: none;
}

/* ── Per-card wrapper for strip_screens ── */
.strip-card {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  flex: 0 0 auto;
  width: clamp(120px, 18vw, 200px);
}

.strip-card .rail-block__aura {
  border-radius: inherit;
}

.strip-card .rail-block__figure {
  position: relative;
  z-index: 1;
}

.strip-card .aura-blob {
  filter: blur(24px) saturate(140%);
}

.strip-card:nth-child(even) .aura-blob {
  animation-direction: alternate-reverse;
}

/* Fallback: figures without strip-card wrapper keep sizing */
.rail-block__strip>.rail-block__figure {
  flex: 0 0 auto;
  width: clamp(120px, 18vw, 200px);
}

/* ── float_cluster ── */
.rail-block__cluster {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
}

.rail-block__cluster .rail-block__figure {
  position: absolute;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .work-detail {
    padding-top: var(--space-md);
  }

  .work-detail__grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .work-detail__left {
    grid-column: 1;
    position: static;
    max-height: none;
    padding-top: 0;
    width: 100%;
  }

  .work-detail__right {
    grid-column: 1;
    width: 100%;
  }

  .work-detail__tocToggle {
    display: none !important;
  }

  .work-detail__tocList {
    max-height: none !important;
    overflow: visible !important;
    -webkit-mask-image: none !important;
    mask-image: none !important;
  }

  .work-detail__index-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-bottom: var(--space-md);
    max-height: none;
    overflow-y: visible;
  }

  .work-detail__index-link {
    padding: 4px 0;
  }

  .work-detail__narrative-body {
    overflow-y: visible;
    -webkit-mask-image: none;
    mask-image: none;
    padding-right: 0;
    scrollbar-gutter: auto;
  }

  .work-detail__narrative {
    margin-bottom: var(--space-md);
  }

  .work-detail__narrative-window {
    overflow: visible;
    -webkit-mask-image: none;
    mask-image: none;
  }

  .work-detail__narrative-item {
    opacity: 1 !important;
    padding-bottom: var(--space-md);
  }

  .work-detail__narrative-scroll {
    padding-bottom: 0;
  }

  /* Show section titles in rail on mobile */
  .rail-section-head__label {
    display: block;
    margin-bottom: 8px;
  }

  /* Logo block: taller aspect ratio + bigger logo on mobile */
  .rail-block[data-logo="true"] .rail-media {
    aspect-ratio: 4/3 !important;
  }

  .rail-block[data-logo="true"] .rail-block__logo-img {
    max-width: 55%;
    max-height: 60%;
  }

  /* hero_full: shorter on mobile since narrative stacks above */
  .rail-block--hero_full {
    height: 65svh;
  }
}

@media (max-width: 600px) {
  .work-detail__tags {
    max-height: none;
  }

  .rail-block__duo,
  .rail-block__quad {
    grid-template-columns: 1fr;
  }

  .rail-block__duo-stack {
    grid-template-columns: 1fr;
  }

  .rail-block__mosaic {
    grid-template-columns: 1fr;
  }

  .rail-block__mosaic>.rail-block__figure--large .ph {
    height: auto;
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {

  .work-detail__title,
  .work-detail__tags,
  .work-detail__meta-line,
  .work-detail__header,
  .work-detail__index-list,
  .work-detail__index-link,
  .work-detail__tocList,
  .work-detail__tocChevron,
  .rail-block {
    transition: none;
  }

  .aura-blob {
    animation: none;
  }
}