/* =============================================================
   LEGACY EXHIBITION — homepage only
   A scoped, scroll-driven architectural archive. No shared
   component selectors are overridden in this file.
   ============================================================= */

.legacy {
  --legacy-bronze: #c39a63;
  --legacy-paper: #f5f1e9;
  --legacy-ink: #0b0a08;
  position: relative;
  z-index: 5;
  background: var(--legacy-ink);
  color: var(--legacy-paper);
  isolation: isolate;
  overflow: clip;
}

.legacy__opening {
  position: relative;
  z-index: 2;
  padding-block: clamp(6rem, 12vw, 11rem) clamp(4rem, 8vw, 7rem);
  border-top: 1px solid rgba(245, 241, 233, .1);
  background:
    radial-gradient(circle at 78% 20%, rgba(195, 154, 99, .075), transparent 33rem),
    var(--legacy-ink);
}

.legacy__index,
.legacy__chapter-no,
.legacy__material,
.legacy__coordinate,
.legacy__mode,
.legacy__sequence,
.legacy__prompt {
  font-family: var(--label);
  font-size: .64rem;
  font-weight: 560;
  line-height: 1.2;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.legacy__index {
  display: block;
  margin-bottom: clamp(1.75rem, 4vw, 3.5rem);
  color: var(--legacy-bronze);
}

.legacy__opening-grid {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(16rem, 4fr);
  gap: var(--gutter);
  align-items: end;
}

.legacy__title {
  max-width: 11ch;
  font-size: clamp(3.25rem, 8.2vw, 8.8rem);
  font-weight: 450;
  line-height: .91;
  letter-spacing: -.055em;
}

.legacy__title em {
  color: var(--legacy-bronze);
  font-style: italic;
  font-weight: 370;
}

.legacy__lede {
  max-width: 36ch;
  padding-bottom: .5rem;
  color: rgba(245, 241, 233, .64);
  font-size: clamp(.95rem, 1.15vw, 1.12rem);
  line-height: 1.75;
}

.legacy__experience {
  position: relative;
  height: 560vh;
  height: 560svh;
  background: var(--legacy-ink);
}

.legacy__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  min-height: 37rem;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(11, 10, 8, .97) 0%, rgba(11, 10, 8, .6) 34%, rgba(11, 10, 8, .06) 63%, rgba(11, 10, 8, .34) 100%),
    radial-gradient(circle at 70% 45%, #242019 0%, #100f0c 46%, #090806 78%);
}

.legacy__stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(rgba(195, 154, 99, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(195, 154, 99, .055) 1px, transparent 1px);
  background-size: clamp(3.25rem, 5vw, 5rem) clamp(3.25rem, 5vw, 5rem);
  mask-image: radial-gradient(ellipse at 69% 50%, #000 0%, transparent 70%);
  opacity: .62;
}

.legacy__stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  box-shadow: inset 0 0 9rem rgba(0, 0, 0, .74);
  background:
    linear-gradient(180deg, rgba(6, 5, 4, .68), transparent 16%, transparent 80%, rgba(6, 5, 4, .72)),
    radial-gradient(circle at 73% 44%, transparent 0%, rgba(5, 4, 3, .2) 63%, rgba(5, 4, 3, .7) 100%);
}

.legacy__scene,
.legacy__canvas,
.legacy__atmosphere {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.legacy__scene {
  z-index: 1;
}

.legacy__canvas {
  display: block;
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}

.legacy.is-rendered .legacy__canvas {
  opacity: 1;
}

.legacy__atmosphere {
  pointer-events: none;
  background:
    radial-gradient(circle at 72% 62%, rgba(195, 154, 99, .1), transparent 26%),
    radial-gradient(circle at 67% 37%, rgba(242, 220, 186, .045), transparent 18%);
  mix-blend-mode: screen;
  animation: legacy-breathe 8s ease-in-out infinite alternate;
}

@keyframes legacy-breathe {
  from { opacity: .48; }
  to { opacity: .78; }
}

.legacy__datum {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  background: rgba(195, 154, 99, .23);
  transform-origin: center;
  opacity: .34;
}

.legacy__datum::after {
  content: "";
  position: absolute;
  background: var(--legacy-bronze);
  box-shadow: 0 0 1rem rgba(195, 154, 99, .65);
}

.legacy__datum--x {
  left: 50%;
  right: 0;
  top: 64%;
  height: 1px;
}

.legacy__datum--x::after {
  left: 42%;
  top: -2px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.legacy__datum--y {
  top: 0;
  bottom: 0;
  left: 72%;
  width: 1px;
}

.legacy__datum--y::after {
  left: -2px;
  top: 64%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.legacy__hud {
  position: absolute;
  inset: clamp(5.5rem, 9vh, 7rem) 0 auto;
  z-index: 12;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 2rem;
  pointer-events: none;
  color: rgba(245, 241, 233, .42);
}

.legacy__mode {
  color: rgba(195, 154, 99, .8);
}

.legacy__sequence b {
  color: var(--legacy-paper);
  font-size: .82rem;
  font-weight: 570;
}

.legacy__chapters {
  position: absolute;
  inset: 0;
  z-index: 11;
  pointer-events: none;
}

.legacy__chapter {
  position: absolute;
  left: var(--gutter);
  top: 50%;
  width: min(35rem, 39vw);
  opacity: 0;
  transform: translate3d(0, 3rem, 0);
  visibility: hidden;
  transition:
    opacity .68s var(--ease),
    transform .9s var(--ease),
    visibility 0s linear .9s;
}

.legacy__chapter.is-active {
  opacity: 1;
  transform: translate3d(0, -46%, 0);
  visibility: visible;
  transition-delay: 0s;
}

.legacy__chapter.is-past {
  transform: translate3d(0, -6rem, 0);
}

.legacy__chapter-no {
  display: block;
  margin-bottom: 1.25rem;
  color: rgba(245, 241, 233, .42);
}

.legacy__year {
  display: block;
  margin-left: -.055em;
  color: var(--legacy-bronze);
  font-family: var(--display);
  font-size: clamp(4.5rem, 9.2vw, 9.5rem);
  font-weight: 250;
  line-height: .78;
  letter-spacing: -.075em;
}

.legacy__chapter h3 {
  max-width: 22ch;
  margin-top: clamp(1.5rem, 3vh, 2.25rem);
  color: var(--legacy-paper);
  font-size: clamp(1.4rem, 2.15vw, 2.35rem);
  font-weight: 480;
  line-height: 1.14;
}

.legacy__chapter p {
  max-width: 46ch;
  margin-top: 1.2rem;
  color: rgba(245, 241, 233, .6);
  font-size: clamp(.91rem, 1vw, 1.05rem);
  line-height: 1.72;
}

.legacy__material {
  display: block;
  margin-top: clamp(1.5rem, 3vh, 2.4rem);
  padding-top: 1rem;
  border-top: 1px solid rgba(245, 241, 233, .12);
  color: rgba(195, 154, 99, .72);
}

.legacy__prompt {
  position: absolute;
  z-index: 12;
  left: 0;
  right: 0;
  bottom: max(1.6rem, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 1rem;
  color: rgba(245, 241, 233, .4);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translate3d(0, .45rem, 0);
  transition:
    opacity .65s var(--ease),
    transform .8s var(--ease),
    visibility 0s linear .8s;
}

.legacy__prompt.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate3d(0, 0, 0);
  transition-delay: 0s;
}

.legacy__prompt span::after {
  content: "\2193";
  display: inline-block;
  margin-left: .8rem;
  color: rgba(195, 154, 99, .82);
  animation: legacy-scroll-nudge 2.8s var(--ease) infinite;
}

.legacy__prompt i {
  position: relative;
  display: block;
  width: clamp(4rem, 9vw, 8rem);
  height: 1px;
  overflow: hidden;
  background: rgba(245, 241, 233, .14);
}

.legacy__prompt i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--legacy-bronze);
  transform-origin: left;
  animation: legacy-travel 2.8s var(--ease) infinite;
}

@keyframes legacy-travel {
  0% { transform: translate3d(-105%, 0, 0); }
  55%, 100% { transform: translate3d(105%, 0, 0); }
}

@keyframes legacy-scroll-nudge {
  0%, 20% { opacity: .28; transform: translate3d(0, -.12rem, 0); }
  52% { opacity: .9; transform: translate3d(0, .18rem, 0); }
  75%, 100% { opacity: .28; transform: translate3d(0, .34rem, 0); }
}

.legacy--static .legacy__experience {
  height: auto;
}

.legacy--static .legacy__stage {
  position: relative;
  min-height: 60rem;
  height: auto;
  padding-block: 7rem;
}

.legacy--static .legacy__scene,
.legacy--static .legacy__hud,
.legacy--static .legacy__prompt {
  display: none;
}

.legacy--static .legacy__chapters {
  position: relative;
  inset: auto;
  display: grid;
  gap: 4rem;
}

.legacy--static .legacy__chapter,
.legacy--static .legacy__chapter.is-active,
.legacy--static .legacy__chapter.is-past {
  position: relative;
  left: auto;
  top: auto;
  width: min(42rem, 100%);
  opacity: 1;
  visibility: visible;
  transform: none;
}

@media (max-width: 1180px) {
  .legacy__opening-grid {
    grid-template-columns: 1fr;
  }

  .legacy__lede {
    margin-top: 1rem;
  }

  .legacy__chapter {
    width: min(31rem, 43vw);
  }
}

@media (max-width: 900px) {
  .legacy__experience {
    height: 470vh;
    height: 470svh;
  }

  .legacy__stage {
    min-height: 35rem;
    background:
      linear-gradient(180deg, rgba(11, 10, 8, .28) 0%, rgba(11, 10, 8, .05) 46%, rgba(11, 10, 8, .98) 76%),
      radial-gradient(circle at 58% 37%, #242019 0%, #100f0c 48%, #090806 78%);
  }

  .legacy__datum--x {
    left: 0;
    top: 55%;
  }

  .legacy__datum--y {
    left: 58%;
    bottom: 35%;
  }

  .legacy__hud {
    grid-template-columns: 1fr auto;
  }

  .legacy__mode {
    display: none;
  }

  .legacy__chapter {
    top: auto;
    bottom: clamp(5.5rem, 10vh, 7.5rem);
    width: calc(100% - (var(--gutter) * 2));
    padding: 1.5rem 1.35rem 1.35rem;
    background: linear-gradient(135deg, rgba(14, 12, 10, .9), rgba(14, 12, 10, .56));
    border: 1px solid rgba(245, 241, 233, .1);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  .legacy__chapter.is-active {
    transform: translate3d(0, 0, 0);
  }

  .legacy__chapter.is-past {
    transform: translate3d(0, -3rem, 0);
  }

  .legacy__year {
    font-size: clamp(3.75rem, 12vw, 6rem);
  }

  .legacy__chapter h3 {
    margin-top: 1.15rem;
    max-width: 28ch;
  }

  .legacy__chapter p {
    max-width: 60ch;
    line-height: 1.55;
  }

  .legacy__material {
    display: none;
  }

  .legacy__prompt {
    inset: max(8rem, 15vh) var(--gutter) auto auto;
    width: auto;
    padding-inline: 0;
    gap: .75rem;
  }

  .legacy__prompt i {
    width: clamp(2.5rem, 8vw, 4rem);
  }
}

@media (max-width: 600px) {
  .legacy__opening {
    padding-block: 5.5rem 4rem;
  }

  .legacy__title {
    font-size: clamp(3.15rem, 16vw, 5rem);
  }

  .legacy__experience {
    height: 410vh;
    height: 410svh;
  }

  .legacy__stage {
    min-height: 31rem;
  }

  .legacy__stage::before {
    background-size: 3.2rem 3.2rem;
  }

  .legacy__hud {
    inset: max(5rem, 10vh) 0 auto;
  }

  .legacy__coordinate {
    max-width: 16ch;
    line-height: 1.5;
  }

  .legacy__chapter {
    bottom: max(1.2rem, env(safe-area-inset-bottom));
    padding: 1.25rem;
  }

  .legacy__chapter-no {
    margin-bottom: .85rem;
  }

  .legacy__year {
    font-size: clamp(3.35rem, 17vw, 4.8rem);
  }

  .legacy__chapter h3 {
    margin-top: .85rem;
    font-size: clamp(1.12rem, 5vw, 1.45rem);
  }

  .legacy__chapter p {
    margin-top: .7rem;
    font-size: .84rem;
    line-height: 1.5;
  }
}

@media (max-height: 650px) and (min-width: 761px) {
  .legacy__chapter {
    top: 53%;
  }

  .legacy__chapter p {
    line-height: 1.5;
  }

  .legacy__material {
    margin-top: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .legacy__atmosphere,
  .legacy__prompt i::after,
  .legacy__prompt span::after {
    animation: none !important;
  }
}

@media print {
  .legacy {
    background: #fff;
    color: #111;
  }

  .legacy__opening {
    background: #fff;
  }
}
