/* STORY SECTION (Section 2) */
.story-section {
  background-color: var(--color-bg);
  position: relative;
  overflow-x: clip;
  overflow-y: visible;
  padding-block: 80px;
}

@media (min-width: 1024px) {
  .story-section {
    padding-block: 120px;
  }
}

/* INTRO */
.story-section__intro {
  text-align: center;
  max-width: 1400px;
  margin: 0 auto 24px; /* Reduced for extremely close card approach */
  padding-inline: 20px;
}

@media (min-width: 1024px) {
  .story-section__intro {
    margin-bottom: 32px;
  }
}

.story-section__eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-brand);
  margin-bottom: 24px;
}

.eyebrow-line {
  width: 40px;
  height: 1px;
  background-color: var(--color-accent);
  opacity: 0.6;
}

.story-section__title {
  font-family: var(--font-display);
  font-size: clamp(2.35rem, 8vw, 4rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--color-text);
  margin: 0 auto 32px;
  width: 100%;
  max-width: 1400px;
  text-wrap: balance;
}

.story-section__copy {
  font-family: var(--font-body);
  font-size: clamp(15px, 2vw, 17px);
  line-height: 1.6;
  color: var(--color-text-muted);
  max-width: 1200px;
  margin: 0 auto;
}

.story-section__copy p {
  margin-bottom: 16px;
}

/* MINIMAL EDITORIAL LIST (Mobile Timeline & Desktop Grid) */
.story-list {
  max-width: 1100px;
  margin: 40px auto 0;
  display: flex;
  flex-direction: column;
  padding-inline: 20px;
  position: relative;
}

.story-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding-block: 24px;
  transition: transform 0.3s ease;
  /* border-bottom removed for timeline */
}

/* Timeline Line */
.story-item:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 15.5px; /* center of 32px icon */
  width: 1px;
  height: 100%; /* reaches exactly the center of the next item */
  background: linear-gradient(
    180deg,
    var(--color-primary) 0%,
    var(--color-primary) var(--story-step-progress, 0%),
    rgba(148, 119, 88, 0.15) var(--story-step-progress, 0%),
    rgba(148, 119, 88, 0.15) 100%
  );
  z-index: 1;
}

/* Fallback for reduced motion */
@media (prefers-reduced-motion: reduce) {
  .story-item:not(:last-child)::after {
    background: var(--color-primary); /* Fully filled or static */
  }
}

.story-item__icon {
  width: 32px;
  height: 32px;
  color: var(--color-text-muted); /* Neutro by default on mobile */
  background-color: var(--color-bg); /* Hides the line behind it */
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  transition: color 0.4s ease, transform 0.3s ease;
}

.story-item__icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Toggle Desktop/Mobile Icons */
.icon-desktop {
  display: none;
}
.icon-mobile {
  display: block;
}

.story-item__title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--color-text-muted); /* Neutro by default */
  line-height: 1.2;
  position: relative;
  z-index: 2;
  transition: color 0.4s ease;
}

/* Active state triggered by JS on Mobile */
.story-item.is-active .story-item__icon {
  color: var(--color-primary-dark);
}
.story-item.is-active .story-item__title {
  color: var(--color-text);
}

/* Fallback for reduced motion */
@media (prefers-reduced-motion: reduce) {
  .story-item__icon {
    color: var(--color-primary-dark);
  }
  .story-item__title {
    color: var(--color-text);
  }
}

/* DESKTOP overrides */
@media (min-width: 1024px) {
  .story-list {
    margin-top: 80px;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 64px 80px;
  }

  .story-item {
    flex: 0 1 200px;
    flex-direction: column;
    text-align: center;
    padding-block: 0;
    border-bottom: none;
    position: relative;
    gap: 20px;
  }

  /* Rimuovi la timeline verticale su desktop */
  .story-item::after {
    display: none !important;
  }

  /* Decorative top line for desktop */
  .story-item::before {
    content: "";
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 1px;
    background-color: var(--color-accent);
    opacity: 0.6;
  }

  /* Toggle Desktop/Mobile Icons */
  .icon-desktop {
    display: block !important;
  }
  .icon-mobile {
    display: none !important;
  }

  /* Ripristina i colori pieni su desktop (nessun tracking scroll) */
  .story-item__icon {
    width: 40px;
    height: 40px;
    color: var(--color-primary-dark) !important;
    background-color: transparent;
  }

  .story-item__title {
    font-size: 26px;
    color: var(--color-text) !important;
  }

  /* Micro-interaction */
  .story-item:hover .story-item__icon {
    transform: translateY(-4px) scale(1.05);
  }
}

/* CLOSING BLOCK */
.story-closing {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 24px 64px; /* Reduced top padding since it sits under the cards now */
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-align: center;
  background-color: transparent;
}

.story-closing__br-mobile {
  display: block;
}

@media (min-width: 768px) {
  .story-closing__br-mobile {
    display: none;
  }
}

.story-closing__content {
  position: relative;
  z-index: 3;
  max-width: 700px;
  margin: 0 auto;
}

.story-closing__text {
  font-family: var(--font-body);
  font-size: clamp(16px, 4vw, 18px);
  line-height: 1.6;
  color: var(--color-text-muted);
  margin-bottom: 24px;
}

.story-closing__highlight {
  font-family: var(--font-display);
  font-size: clamp(28px, 6vw, 42px);
  font-weight: 500;
  font-style: italic;
  color: var(--color-brand);
  margin-bottom: 40px;
  line-height: 1.2;
}

.story-closing__btn {
  width: 100%;
  max-width: 400px;
}

/* STORY — Timeline centrata su mobile e tablet */
@media (max-width: 1023px) {

  .story-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr);
    column-gap: 12px;
    align-items: center;
  }

  /* Linea progressiva centrata */
  .story-item:not(:last-child)::after {
    left: 50%;
    transform: translateX(-50%);
  }

  /* Icone lungo l'asse centrale */
  .story-item__icon {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
  }

  /* Titoli a destra */
  .story-item__title {
    grid-column: 3;
    grid-row: 1;
    min-width: 0;
    text-align: left;
    font-size: clamp(18px, 4.8vw, 22px);
  }

  /* Titoli alternati a sinistra */
  .story-item:nth-child(even) .story-item__title {
    grid-column: 1;
    text-align: right;
  }

}