/* AMICO Timeline — core styles */
.amico-timeline {
  --amico-line-color: rgba(255, 255, 255, 0.3);
  --amico-line-width: 2px;
  --amico-item-gap: 120px;
  --amico-marker-size: 20px;
  --amico-marker-color: #FFFFFF;
  --amico-marker-border-color: #FFFFFF;
  position: relative;
  padding: 40px 0;
}

/* Vertical line - simple full height */
.amico-timeline__line {
  position: absolute;
  left: 50%;
  width: var(--amico-line-width);
  transform: translateX(-50%);
  background: var(--amico-line-color);
  opacity: 1;
  pointer-events: none;
  z-index: 1;
  top: 0;
  bottom: 0;
}

.amico-timeline[data-line="left"] .amico-timeline__line {
  left: 32px;
  transform: none;
}

/* List container */
.amico-timeline__list {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

/* Timeline items */
.amico-timeline__item {
  position: relative;
  display: flex;
  align-items: flex-start;
  margin-bottom: var(--amico-item-gap);
  opacity: 1;
  transition: transform .5s ease, opacity .5s ease;
}

/* Ensure spacing is applied at different breakpoints */
@media (min-width: 1025px) {
  .amico-timeline__item {
    margin-bottom: 120px;
  }
}

@media (max-width: 1024px) and (min-width: 641px) {
  .amico-timeline__item {
    margin-bottom: 140px;
  }
}

@media (max-width: 640px) {
  .amico-timeline__item {
    margin-bottom: 180px;
  }
}

/* Remove pseudo-element approach - not working properly */

/* Remove bottom margin from last item to help with line calculation */
.amico-timeline__item:last-child {
  margin-bottom: 0;
}

.amico-timeline[data-animate="true"] .amico-timeline__item {
  opacity: 0;
  transform: translateY(20px);
}

.amico-timeline[data-animate="true"] .amico-timeline__item.is-inview {
  opacity: 1;
  transform: translateY(0);
}

/* Left side items */
.amico-timeline__item.is-left {
  justify-content: flex-start;
  padding-right: calc(50% + 40px);
}

.amico-timeline__item.is-left .amico-timeline__card {
  text-align: right;
  align-items: flex-end;
  margin-right: 0;
}

/* Right side items */
.amico-timeline__item.is-right {
  justify-content: flex-end;
  padding-left: calc(50% + 40px);
}

.amico-timeline__item.is-right .amico-timeline__card {
  text-align: left;
  align-items: flex-start;
  margin-left: 0;
}

/* Single side layouts */
.amico-timeline[data-layout="left"] .amico-timeline__item,
.amico-timeline[data-layout="right"] .amico-timeline__item {
  padding: 0 0 0 80px;
  justify-content: flex-start;
}

.amico-timeline[data-layout="right"] .amico-timeline__item {
  padding: 0 80px 0 0;
  justify-content: flex-end;
}

/* Marker (white circle on the line) */
.amico-timeline__marker {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: var(--amico-marker-size);
  height: var(--amico-marker-size);
  border-radius: 50%;
  background: #FFFFFF;
  border: 4px solid rgba(255, 255, 255, 0.4);
  z-index: 3;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.15), 0 2px 8px rgba(0, 0, 0, 0.2);
}

.amico-timeline[data-line="left"] .amico-timeline__marker {
  left: 32px;
  transform: translateX(-50%);
}

.amico-timeline__marker .amico-timeline__marker-icon i,
.amico-timeline__marker .amico-timeline__marker-icon svg {
  width: calc(var(--amico-marker-size) * 0.5);
  height: calc(var(--amico-marker-size) * 0.5);
  color: #2A6E91;
  position: relative;
  z-index: 1;
}

/* Pulse animation for better visibility */
.amico-timeline__marker::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(var(--amico-marker-size) + 16px);
  height: calc(var(--amico-marker-size) + 16px);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  animation: pulse 2s infinite;
  z-index: -1;
}

@keyframes pulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.5;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 0.2;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.5;
  }
}

/* Year labels */
.amico-timeline__year {
  position: absolute;
  top: 0;
  padding: 0;
  background: transparent;
  border: none;
  color: #FFFFFF;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  margin-bottom: 15px;
}

/* Position year on opposite side of image to prevent overlap */
.amico-timeline__item.is-left .amico-timeline__year {
  left: calc(50% + 40px);
  right: auto;
  transform: none;
  text-align: left;
}

.amico-timeline__item.is-right .amico-timeline__year {
  right: calc(50% + 40px);
  left: auto;
  transform: none;
  text-align: right;
}

/* Card (content container) - transparent */
.amico-timeline__card {
  background: transparent;
  border: none;
  padding: 0;
  color: #FFFFFF;
  box-shadow: none;
  max-width: 360px;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* Timeline images */
.amico-timeline__image {
  margin-top: 0;
  margin-bottom: 15px;
}

.amico-timeline__image img {
  display: block;
  width: 100%;
  max-width: 180px;
  height: auto;
  filter: drop-shadow(0 10px 40px rgba(0, 0, 0, 0.3));
}

.amico-timeline__item.is-left .amico-timeline__image img {
  margin-left: auto;
  margin-right: 20px;
}

.amico-timeline__item.is-right .amico-timeline__image img {
  margin-right: auto;
  margin-left: 20px;
}

/* Text content */
.amico-timeline__text {
  font-size: 16px;
  line-height: 1.5;
  color: #FFFFFF;
  margin: 0;
}

.amico-timeline__text p {
  margin: 0 0 8px 0;
}

.amico-timeline__text p:last-child {
  margin-bottom: 0;
}

/* When no image is present, add spacing to avoid year overlap */
.amico-timeline__item:not(:has(.amico-timeline__image)) .amico-timeline__card {
  margin-top: 0;
}

/* Alternative fallback for browsers that don't support :has() */
.amico-timeline__item .amico-timeline__card:only-child {
  margin-top: 0;
}

/* Reset margin when image is present */
.amico-timeline__item:has(.amico-timeline__image) .amico-timeline__card {
  margin-top: 0;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  /* Keep alternating layout on tablet/mobile */
  .amico-timeline {
    --amico-item-gap: 140px; /* More vertical space on mobile */
  }

  .amico-timeline__item.is-left {
    padding-left: 20px;
    padding-right: calc(50% + 20px);
    justify-content: flex-end;
  }

  .amico-timeline__item.is-right {
    padding-left: calc(50% + 20px);
    padding-right: 20px;
    justify-content: flex-start;
  }

  .amico-timeline__item.is-left .amico-timeline__card {
    text-align: right;
    align-items: flex-end;
  }

  .amico-timeline__item.is-right .amico-timeline__card {
    text-align: left;
    align-items: flex-start;
  }

  .amico-timeline__item.is-left .amico-timeline__image img {
    margin-left: auto;
    margin-right: 15px;
  }

  .amico-timeline__item.is-right .amico-timeline__image img {
    margin-left: 15px;
    margin-right: auto;
  }

  .amico-timeline__item.is-left .amico-timeline__year {
    left: calc(50% + 30px);
    right: auto;
    transform: none;
  }

  .amico-timeline__item.is-right .amico-timeline__year {
    right: calc(50% + 30px);
    left: auto;
    transform: none;
  }

  /* Responsive images on tablet */
  .amico-timeline__image img {
    width: 100%;
    max-width: 140px;
  }
}

@media (max-width: 640px) {
  .amico-timeline {
    --amico-item-gap: 180px; /* More space to prevent overlaps */
  }

  /* Keep center line and alternating layout */
  .amico-timeline__line {
    left: 50%;
    transform: translateX(-50%);
  }

  .amico-timeline__marker {
    left: 50%;
    transform: translateX(-50%);
  }

  /* Adjust padding for smaller screens - closer to line */
  .amico-timeline__item.is-left {
    padding-left: 15px;
    padding-right: calc(50% + 15px);
  }

  .amico-timeline__item.is-right {
    padding-left: calc(50% + 15px);
    padding-right: 15px;
  }

  /* Position year labels on opposite side of images on mobile */
  .amico-timeline__item.is-left .amico-timeline__year {
    position: absolute;
    left: calc(50% + 25px);
    right: auto;
    top: 0;
    margin-bottom: 0;
    font-size: 16px;
    text-align: left;
    transform: none;
  }

  .amico-timeline__item.is-right .amico-timeline__year {
    position: absolute;
    right: calc(50% + 25px);
    left: auto;
    top: 0;
    margin-bottom: 0;
    font-size: 16px;
    text-align: right;
    transform: none;
  }

  /* Smaller responsive images on mobile */
  .amico-timeline__item.is-left .amico-timeline__image img {
    width: 100%;
    max-width: 100px;
    display: block;
    margin-bottom: 10px;
    margin-left: auto;
    margin-right: 10px;
  }

  .amico-timeline__item.is-right .amico-timeline__image img {
    width: 100%;
    max-width: 100px;
    display: block;
    margin-bottom: 10px;
    margin-left: 10px;
    margin-right: auto;
  }

  .amico-timeline__text {
    font-size: 14px;
    line-height: 1.4;
  }

  /* Add padding to text content for left-aligned items */
  .amico-timeline__item.is-left .amico-timeline__text {
    padding-right: 15px;
  }

  /* Add padding to text content for right-aligned items */
  .amico-timeline__item.is-right .amico-timeline__text {
    padding-left: 15px;
  }

  /* Ensure card content doesn't overflow */
  .amico-timeline__card {
    max-width: 100%;
    word-wrap: break-word;
  }
}