/* =========================================
   TIMELINE RULER (FILTER ENGINE)
========================================= */

.timeline-ruler-wrapper {
  width: 92%;
  max-width: var(--container-width-lg);
  margin: 0 auto var(--space-xl); /* Centers it and spaces it above the stage */
  position: relative;
}

.timeline-ruler {
  display: flex;
  align-items: flex-end;
  gap: var(--space-4xl); 
  padding-bottom: var(--space-md);
  overflow-x: auto; 
  border-bottom: 1px solid var(--color-border-medium);
  scrollbar-width: none; 
  -ms-overflow-style: none;
  
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.timeline-ruler:active {
  cursor: grabbing; /* Shows the closed hand when they click and hold */
}

.timeline-ruler::-webkit-scrollbar {
  display: none;
}

/* --- THE INDIVIDUAL TICK MARKS --- */
.timeline-tick {
  position: relative;
  cursor: pointer;
  padding: 0 var(--space-xs);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* The physical line marker */
.timeline-tick::after {
  content: '';
  position: absolute;
  bottom: calc(var(--space-md) * -1); /* Anchors it precisely to the border-bottom */
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 8px; /* Short tick mark normally */
  background-color: var(--color-border-strong);
  transition: height 0.3s ease, background-color 0.3s ease;
}

.timeline-year {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--color-text-secondary);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.1em;
}

/* --- THE HOVER & ACTIVE PHYSICS (THE "POP") --- */
.timeline-tick:hover .timeline-year,
.timeline-tick.is-active .timeline-year {
  color: var(--color-antique-gold);
  transform: scale(1.4) translateY(-4px); /* Pops up and gets larger */
}

.timeline-tick:hover::after,
.timeline-tick.is-active::after {
  height: 16px; /* Tick mark extends to connect with the glowing text */
  background-color: var(--color-antique-gold);
}

/* =========================================
   LATERAL STAGE (HORIZONTAL ACCORDION)
========================================= */

.page-hero-archival {
  background-image: 
    linear-gradient(to top, var(--color-curtain-black) 0%, transparent 40%),
    url('../assets/images/backgrounds/stage-back.webp');
  
  background-position: center 35%;
}

/* 1. BRIDGING THE GAP (The Cinematic Overlap) */
.archive-stage-section {
  position: relative;
  padding: var(--page-section-padding);
  background-color: var(--color-surface-primary);
  overflow: hidden;

  justify-content: center;
  align-items: center;
}

/* --- NEW: SECTION HEADING --- */
.stage-header {
  text-align: center;
  margin-bottom: 80px; 
}

.stage-heading {
  font-family: var(--font-heading);
  font-size: 5rem;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-md);
}

.stage-subheading {
  font-family: var(--font-body);
  color: var(--color-antique-gold);
  font-size: 1rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  opacity: 0.85;
}

.stage-subheading::after {
  content: "";
  display: block;
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-antique-gold), transparent);
  margin: var(--space-lg) auto 0;
  opacity: 0.6;
}

.lateral-stage {
  display: flex;
  
  margin: 0 auto var(--section-padding-y);
  width: 98%; 
  max-width: var(--container-width-lg);

  height: 70vh; 
  min-height: 650px; 
  max-height: 800px;
  
  background-color: var(--color-surface-elevated);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;

  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-base);
}

body[data-theme="light"] .lateral-stage {
  box-shadow: 0 10px 28px rgba(26, 10, 14, 0.08);
}

/* --- THE PILLAR (CLOSED STATE) --- */
.stage-pillar {
  position: relative;
  flex: 1; 
  display: flex;
  justify-content: center;
  align-items: center;
  border-right: 1px solid var(--color-border-subtle);
  cursor: pointer;
  overflow: hidden;
  background-color: transparent; 
  
  transition: flex 0.7s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.4s ease;
  
  will-change: flex-grow, background-color;
  transform: translateZ(0); 
}

.stage-pillar:last-child {
  border-right: none;
}

.stage-pillar:hover {
  background-color: var(--color-surface-elevated);
}

/* Vertical Text for Closed State */
.pillar-closed-content {
  position: absolute;
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  transition: opacity 0.4s ease, transform 0.6s ease;
  opacity: 0.5;
}

.stage-pillar:hover .pillar-closed-content {
  opacity: 1;
}

.pillar-year {
  font-family: var(--font-heading);
  font-size: var(--font-size-lg);
  color: var(--color-antique-gold);
  letter-spacing: 0.1em;
}

.pillar-title-vertical {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
}

/* --- THE PILLAR (OPEN/ACTIVE STATE) --- */
.stage-pillar.is-active {
  flex: 8; 
  cursor: default;
}

.stage-pillar.is-active .pillar-closed-content {
  opacity: 0;
  transform: rotate(180deg) translateY(20px);
  pointer-events: none;
}

.pillar-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.05);
  transition: opacity 0.8s ease 0.2s, transform 3s ease-out; 
  z-index: 0;
}

.stage-pillar.is-active .pillar-background {
  opacity: 0.4; 
  transform: scale(1);
}

.pillar-open-content {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  min-width: 800px;

  padding: var(--space-4xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  z-index: var(--z-content, 10);
  background: linear-gradient(to top, var(--color-bg) 0%, transparent 100%);

  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.15s ease, transform 0.2s ease;
  pointer-events: none;
}

.stage-pillar.is-active .pillar-open-content {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s ease 0.4s, transform 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.4s;
  pointer-events: auto;
}

.pillar-title-horizontal {
  font-family: var(--font-heading);
  font-size: 4rem;
  color: var(--color-text-primary);
  line-height: 1.1;
  text-transform: uppercase;
  margin: 0;
}

.pillar-metadata {
  display: flex;
  flex-wrap: wrap; /* Ensures data wraps gracefully on smaller screens */
  gap: var(--space-lg);
  font-family: var(--font-heading);
  color: var(--color-antique-gold);
  font-size: var(--font-size-sm);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.pillar-synopsis {
  font-family: var(--font-body);
  color: var(--color-text-secondary);
  font-size: 1.2rem;
  line-height: 1.6;
  max-width: 600px;
}

/* =========================================
   ARCHIVE STATS DIVIDER
========================================= */

.archive-stats-divider {
  position: relative;
  width: 100%;
  min-height: 35vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: url('../assets/images/backgrounds/stage-performance.webp');
  background-size: cover;
  background-position: center;
  border-top: 1px solid var(--color-border-subtle);
  overflow: hidden;
}

.stats-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(13, 5, 8, 0.85);
  z-index: 1;
}

.stats-container {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  max-width: var(--container-width-lg);
  padding: var(--space-4xl) var(--space-xl);
  flex-wrap: wrap; 
  gap: var(--space-2xl);
}

.stat-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-number {
  font-family: var(--font-heading);
  font-size: 5rem;
  font-weight: 400;
  color: var(--color-parchment);
  line-height: 1;
  margin-bottom: var(--space-sm);
  text-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.stat-label {
  font-family: var(--font-body);
  color: var(--color-antique-gold);
  font-size: 0.95rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 600;
}

@media (max-width: 768px) {
  .stats-container {
    flex-direction: column;
    gap: var(--space-4xl);
  }
  .stat-number {
    font-size: 4rem;
  }
}

/* =========================================
   FEATURED UPCOMING CTA (MARQUEE)
========================================= */

.upcoming-cta {
  position: relative;
  width: 100%;
  min-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
  text-align: center;
  overflow: hidden;
  border-top: 1px solid var(--color-border-subtle);
}

.upcoming-cta-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom, 
    rgba(13, 5, 8, 0.7),
    rgba(13, 5, 8, 0.95)
  );
  z-index: 1;
}

.upcoming-cta-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xl);
  padding: var(--space-2xl);
  width: 90%;
  max-width: var(--container-width-lg);
}

.upcoming-cta-meta {
  font-family: var(--font-body);
  color: var(--color-parchment);
  font-size: 1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  line-height: 1.8;
  font-weight: 600;
  margin: 0;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.upcoming-cta-title {
  font-family: var(--font-heading);
  font-size: clamp(3rem, 8vw, 9rem); 
  color: var(--color-parchment);
  text-transform: uppercase;
  line-height: 0.9;
  margin: 0;
  letter-spacing: 0.02em;
  text-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

.upcoming-cta-btn {
  display: inline-block;
  margin-top: var(--space-md);
  padding: 16px 48px;

  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: bold;

  background-color: var(--color-antique-gold);
  color: var(--color-text-on-accent);
  border-radius: var(--radius-pill);

  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  transition: all var(--duration-base) var(--ease-standard);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.upcoming-cta-btn:hover {
  background-color: var(--color-antique-gold);
  transform: translateY(-4px);
  box-shadow: 0 15px 40px rgba(0,0,0,0.6);
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  .upcoming-cta {
    min-height: 60vh;
    background-attachment: scroll;
  }
  
  .upcoming-cta-meta {
    font-size: 0.85rem;
    letter-spacing: 0.1em;
  }
}

/* =========================================
   MOBILE ARCHIVE & MODAL RESPONSIVENESS
========================================= */

/* Hide mobile UI on Desktop */
.mobile-archive-controls,
.mobile-archive-container,
.production-modal {
  display: none;
}

@media (max-width: 992px) {
  /* 1. Hide Desktop Stage Elements */
  .timeline-ruler-wrapper,
  .lateral-stage {
    display: none !important;
  }

  /* 2. Full-Width Container Fix */
  .archive-stage-section {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  
  .stage-header,
  .mobile-archive-controls {
    padding-left: 24px; 
    padding-right: 24px;
  }
  
  /* 3. Show Mobile UI */
  .mobile-archive-controls,
  .mobile-archive-container {
    display: block;
    width: 100%;
    max-width: 100%;
  }

  /* 4. The Toggle Switch */
  .mobile-archive-controls {
    margin-bottom: 32px;
    display: flex;
    justify-content: center;
  }
  
  .archive-toggle-wrapper {
    display: inline-flex;
    background: rgba(255,255,255,0.05);
    border-radius: 30px;
    padding: 4px;
    border: 1px solid var(--color-effect-gold-15);
  }
  
  .archive-toggle-btn {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    font-family: var(--font-heading);
    font-size: 1rem;
    padding: 8px 24px;
    border-radius: 24px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.3s ease;
  }
  
  .archive-toggle-btn.is-active {
    background: var(--color-antique-gold);
    color: var(--color-bg);
  }

  /* 5. VIEW A: INDEX (List View) */
  .view-index .index-header {
    display: flex;
    justify-content: space-between;
    padding: 0 16px 8px;
    border-bottom: 1px solid var(--color-antique-gold);
    font-family: var(--font-heading);
    color: var(--color-antique-gold);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.15em;
  }
  
  .view-index .index-list {
    list-style: none;
    padding: 0; margin: 0;
  }
  
  .view-index .index-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    cursor: pointer;
    transition: background 0.3s ease;
  }
  
  .view-index .index-row:hover { background: rgba(255,255,255,0.03); }
  
  .view-index .index-title {
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-primary);
  }
  
  .view-index .index-year {
    font-family: var(--font-heading);
    font-size: 1rem;
    color: var(--color-text-tertiary);
  }

  /* 6. VIEW B: DRAWER (Folder View) */
  .view-drawer .folder-stack {
    position: relative;
    height: 60vh;
    min-height: 500px;
    width: 95%;
    margin: 40px auto 0;
    perspective: 1200px; /* Required for the 3D tilt */
  }

  .archive-folder {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%;
    height: 100%;
    transform-origin: bottom center;
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), z-index 0s;
    pointer-events: none;

    --bg-color: var(--color-curtain-black);
  }

  /* The Monochromatic Folder Body */
  .folder-body {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%;
    height: calc(100% - 46px); 
    background-color: var(--bg-color);

    pointer-events: auto;

    border-radius: 12px 12px 0 0;
    border-top: none;
    border-left: 1px solid rgba(255,255,255,0.1);
    border-right: 1px solid rgba(255,255,255,0.1);

    box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
    box-sizing: border-box;

    padding: 24px 16px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;

    transition: background-color 0.4s ease, bottom 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), height 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .folder-body::-webkit-scrollbar { display: none; }

  /* The Tab */
  .folder-tab {
    position: absolute;
    top: 0;
    width: 80px;
    height: 48px; /* Taller tab */
    background-color: var(--bg-color);

    border-radius: 10px 10px 0 0;  /* match body radius */
    border-top: 1px solid rgba(255,255,255,0.15);
    border-left: 1px solid rgba(255,255,255,0.15);
    border-right: 1px solid rgba(255,255,255,0.15);
    border-bottom: none;

    z-index: 100;

    pointer-events: auto !important;


    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12px; /* Breathing room for the text */
    font-family: var(--font-heading);
    font-size: 0.95rem;
    color: var(--color-parchment); /* Bright off-white so it's always readable */
    cursor: pointer;

    transition: background-color 0.4s ease, color 0.4s ease;
  }

  /* The Animation: Rising and Tilting Forward */
  .archive-folder.is-pulled {
    transform: translateY(-8px) rotateX(2deg) scale(1.02);

    --bg-color: var(--color-curtain-black-deep);
  }

  .archive-folder.is-pulled .folder-body {
    pointer-events: none;
    bottom: -24px;
    height: calc(100% - 22px); /* 100% - 46px + 24px */
    padding-bottom: 48px;
  }
  .archive-folder.is-pulled .folder-tab {
    color: var(--color-antique-gold);
  }

  /* Grid inside the Folder */
  .folder-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  
  .folder-poster {
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
  }
  
  .folder-poster img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  }
  
  .folder-poster span {
    font-family: var(--font-body);
    font-size: 0.8rem;
    text-transform: uppercase;
    text-align: center;
    color: var(--color-text-secondary);
  }

  /* 6. MODAL STYLES*/
  .production-modal {
    display: flex;
    position: fixed;

    inset: 0; 
    width: 100%;
    height: 100%;
    top: 0; left: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  
  .production-modal.is-active {
    pointer-events: auto;
    opacity: 1;
  }
  
  .modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(13, 5, 8, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    
    will-change: transform;
  }
  
  .modal-close {
    position: absolute;
    top: 24px; right: 24px;
    background: transparent; border: none;
    color: var(--color-parchment);
    font-size: 3rem;
    cursor: pointer;
    z-index: 10;
  }
  
  .modal-content-wrapper {
    position: relative;
    z-index: 2;
    width: 90%;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding-top: 80px;
    padding-bottom: 40px;
    scrollbar-width: none;
  }

  .modal-content-wrapper::-webkit-scrollbar { display: none; }
  
  .modal-poster img {
    width: 100%;
    max-width: 300px;
    border-radius: 6px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
  }
  
  .modal-details {
    text-align: center;
    color: var(--color-text-primary);
  }
  
  .modal-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    text-transform: uppercase;
    margin-bottom: 8px;
  }
  
  .modal-meta {
    font-family: var(--font-heading);
    color: var(--color-antique-gold);
    font-size: 0.9rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 16px;
  }
  
  .modal-synopsis {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text-secondary);
  }
}