/* ==========================================================================
   Vertical Timeline (Majera Brand Integration) - FIXED
   RTL-friendly | Mobile-first | Lyon & Adobe Arabic
   ========================================================================== */

:root {
  --vt-max-mobile: 720px;
  --vt-max-desktop: 1060px;

  /* Map Majera global variables */
  --vt-accent: var(--majera-warm-strong);    /* #BBA77F */
  --vt-bg:     var(--majera-bg);             /* #FFFFFF */
  --vt-card:   var(--majera-card-bg);        /* #F3F4F5 */
  --vt-spine:  var(--majera-border);         /* #DCDCDC */
  --vt-text:   var(--majera-text);           /* #212121 */
  --vt-muted:  var(--majera-text-muted);     /* #6D6A65 */
  
  --vt-spine-gutter: 3.5rem;                 /* Gutter size around spine */
}

/* Main Container */
#v-timeline {
  direction: rtl;
  text-align: right;
  margin: 2rem auto;
  padding: 0 1rem;
  max-width: var(--vt-max-mobile);
  position: relative;
  color: var(--vt-text);
  font-family: "Adobe Arabic", serif;
}

/* Center Spine */
#v-timeline::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  inset-inline-start: 10px;                  /* Mobile: 10px from right edge */
  width: 1px;
  background: var(--vt-spine);
}

/* Year Header (Sticky) */
#v-timeline .vt-year {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 2rem 0 1.5rem;
  display: block;
  background: transparent;
  border: 0;
  padding: 0;
  text-align: center; 
}

/* The Year Chip */
#v-timeline .vt-year .vt-chip {
  display: inline-block;
  background: var(--vt-bg);
  border: 1px solid var(--vt-spine);
  color: var(--majera-heading);
  border-radius: 999px;
  padding: 0.4rem 1.2rem;
  font-family: "Lyon Arabic Display", serif;
  font-size: 1.8rem;
  font-weight: 500;
  line-height: 1.2;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

/* Individual Items */
#v-timeline .vt-item {
  position: relative;
  margin: 1.5rem 0 2rem;
  padding-inline-start: 2rem; /* Mobile: push text away from right-side spine */
}

/* Date Label */
#v-timeline .vt-date {
  display: block;
  font-family: "Adobe Arabic", serif;
  font-size: 1.5rem;
  color: var(--vt-muted);
  margin-bottom: 0.25rem;
}

/* Event Title */
#v-timeline .vt-item h3 {
  margin: 0 0 0.5rem 0;
  font-family: "Lyon Arabic Display", serif;
  font-size: 2.1rem;
  line-height: 1.35;
  font-weight: 500;
  color: var(--majera-heading);
}

/* Event Description */
#v-timeline .vt-item p {
  margin: 0;
  font-family: "Adobe Arabic", serif;
  font-size: var(--content-font-size, 1.7rem); 
  line-height: 1.9;
  color: var(--vt-text);
}

/* Mobile Dividers */
#v-timeline .vt-item + .vt-item {
  border-top: 1px solid var(--vt-spine);
  padding-top: 1.5rem;
}

/* First item after a year (accent separator) */
#v-timeline .vt-year + .vt-item {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--vt-accent);
}

/* Fade-in Animation */
@media (prefers-reduced-motion: no-preference) {
  #v-timeline .vt-item {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease, transform 0.4s ease;
  }
  #v-timeline .vt-item.vt-in {
    opacity: 1;
    transform: none;
  }
}

/* ==========================================================================
   Desktop Layout (≥1024px)
   Two-column alternating with centered spine
   ========================================================================== */

@media (min-width: 1024px) {
  #v-timeline {
    max-width: var(--vt-max-desktop);
    display: grid;
    /* Grid: [Right Col] [Spine] [Left Col] in RTL */
    grid-template-columns: 1fr 1px 1fr;
    column-gap: 0; /* We handle spacing via padding */
  }

  /* Center spine exactly */
  #v-timeline::before {
    inset-inline-start: 50%;
    transform: translateX(50%); 
    width: 1px;
  }

  /* Year Row spans all */
  #v-timeline .vt-year {
    grid-column: 1 / -1;
    margin: 3rem 0 1rem;
  }

  /* Full-width decorative line behind year chip */
  #v-timeline .vt-year::after {
    content: "";
    position: absolute;
    left: 0; right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 1px;
    background: var(--vt-spine);
    z-index: -1;
  }

  /* Remove Mobile Dividers */
  #v-timeline .vt-year + .vt-item,
  #v-timeline .vt-item + .vt-item {
    border-top: 0; 
    padding-top: 0;
    margin-top: 0;
  }

  /* --- RTL Alternating Logic --- */
  
  /* Even Items (Right Side) */
  html[dir="rtl"] #v-timeline .vt-item:nth-of-type(even) {
    grid-column: 1 / 3;        /* Span Right Col + Spine */
    text-align: right;         /* Keep Persian alignment */
    padding-inline-start: 0;   /* Reset mobile padding */
    padding-left: var(--vt-spine-gutter); /* Safety gap from spine (which is on Left) */
  }
  
  /* Odd Items (Left Side) */
  html[dir="rtl"] #v-timeline .vt-item:nth-of-type(odd) {
    grid-column: 2 / 4;        /* Span Spine + Left Col */
    text-align: right;         /* Keep Persian alignment */
    padding-inline-start: 0;   /* Reset mobile padding */
    padding-right: var(--vt-spine-gutter); /* Safety gap from spine (which is on Right) */
  }
}

/* ==========================================================================
   Timeline Navigation (Next / Prev Buttons)
   ========================================================================== */

.timeline-nav-container {
  max-width: 720px;
  margin: 3rem auto 4rem;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  direction: rtl;
}

@media (min-width: 1024px) {
  .timeline-nav-container {
    max-width: var(--vt-max-desktop);
  }
}

.timeline-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1.4rem;
  border: 1px solid var(--majera-border);
  border-radius: 999px;
  background: var(--majera-bg);
  color: var(--majera-text);
  
  font-family: "Adobe Arabic", serif;
  font-weight: 700;
  font-size: 1.7rem;
  line-height: 1;
  /* FORCE remove underlines */
  text-decoration: none !important;
  box-shadow: none !important;
  
  transition: all 0.2s ease;
}

.timeline-btn:hover {
  background: var(--majera-warm-strong);
  color: #fff;
  border-color: var(--majera-warm-strong);
  transform: translateY(-2px);
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(187, 167, 127, 0.25);
}

.timeline-btn:focus {
  outline: 2px solid var(--majera-warm-soft);
  outline-offset: 2px;
}

.timeline-btn.next::before { 
  content: "◀"; margin-left: 8px; font-size: 0.8em; position: relative; top: 1px;
}
.timeline-btn.prev::before { 
  content: "▶"; margin-left: 8px; font-size: 0.8em; position: relative; top: 1px;
}