/*
 * The history page (components/HistoryPage.tsx), redesigned 2026-11-04 from the Elementor timeline (cards left and
 * right of an invisible line, centred text): one column like the About pages — the year, the line with a dot, the
 * card — with left-aligned text, a row of year links and a small picture per entry that opens in the lightbox.
 * The hero is the program pages' (components/PageHero.tsx, styles/hero.css).
 */

.acm-hp {
  --hp-line: var(--accent-line);
  --hp-year: 104px; /* the year column */
  --hp-rail: 44px; /* the line column */
}

.acm-hp-intro {
  max-width: 860px;
  margin: 0 auto 36px;
}
.acm-hp-intro p {
  margin: 0 0 1em;
}
.acm-hp-intro p:last-child {
  margin-bottom: 0;
}

/* year links */
.acm-hp-years {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 44px;
}

/* the timeline */
.acm-hp-line {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}
.acm-hp-line::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: calc(var(--hp-year) + var(--hp-rail) / 2 - 1px);
  width: 2px;
  border-radius: 2px;
  background: var(--hp-line);
}
.acm-hp-item {
  position: relative;
  display: grid;
  grid-template-columns: var(--hp-year) var(--hp-rail) minmax(0, 1fr);
  align-items: start;
  scroll-margin-top: 110px;
}
.acm-hp-item + .acm-hp-item {
  margin-top: 22px;
}
.acm-hp-item:not(.acm-hp-item--same) + .acm-hp-item:not(.acm-hp-item--same) {
  margin-top: 40px; /* a new year */
}
.acm-hp-item__year {
  padding-top: 19px;
  text-align: right;
  font-family: var(--font-head);
  font-size: 21px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.3px;
  color: var(--accent);
  overflow-wrap: anywhere;
}
.acm-hp-item__dot {
  justify-self: center;
  width: 16px;
  height: 16px;
  margin-top: 24px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px #fff, 0 0 0 6px var(--hp-line);
  position: relative; /* above the line */
}
.acm-hp-item--same .acm-hp-item__dot {
  width: 10px;
  height: 10px;
  margin-top: 27px;
  background: #fff;
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 6px #fff;
}

.acm-hp-card {
  display: flow-root; /* holds the floated picture */
  padding: 20px 24px 22px;
  border: 1px solid var(--accent-line);
}
.acm-hp-card:hover {
  border-color: #cfd3f2;
  box-shadow: var(--sh-card-hover);
}
.acm-hp .acm-hp-card__img {
  position: relative;
  float: right;
  width: 176px;
  margin: 2px 0 10px 22px;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--acm-placeholder);
}
.acm-hp-card__img img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.acm-hp-card__img:hover img {
  transform: scale(1.05);
}
.acm-hp-card__img:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.acm-hp-card__zoom {
  position: absolute;
  right: 7px;
  bottom: 7px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--acm-ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: background-color 0.2s, color 0.2s;
}
.acm-hp-card__img:hover .acm-hp-card__zoom {
  background: var(--accent);
  color: #fff;
}
/* the year inside the card: phones only (the year column is gone there) */
.acm-hp-card__year {
  display: none;
}
.acm-hp .acm-hp-card__title {
  margin: 0 0 8px;
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: normal;
  text-transform: none;
  color: var(--acm-ink);
}
.acm-hp-card__text {
  font-size: 15.5px;
  color: #444;
}
.acm-hp-card__text p {
  margin: 0 0 0.8em;
}
.acm-hp-card__text p:last-child {
  margin-bottom: 0;
}

@media (max-width: 767px) {
  .acm-hp {
    --hp-rail: 26px;
  }
  .acm-hp-years {
    gap: 6px;
    margin-bottom: 32px;
  }
  .acm-hp-line::before {
    left: calc(var(--hp-rail) / 2 - 1px);
  }
  .acm-hp-item {
    grid-template-columns: var(--hp-rail) minmax(0, 1fr);
  }
  .acm-hp-item__year {
    display: none;
  }
  .acm-hp-item__dot {
    justify-self: start;
    margin-left: calc(var(--hp-rail) / 2 - 8px);
    margin-top: 22px;
  }
  .acm-hp-item--same .acm-hp-item__dot {
    margin-left: calc(var(--hp-rail) / 2 - 5px);
    margin-top: 25px;
  }
  .acm-hp-card {
    margin-left: 6px;
    padding: 16px 16px 18px;
  }
  .acm-hp .acm-hp-card__img {
    width: 112px;
    margin: 2px 0 8px 14px;
  }
  .acm-hp-card__year {
    display: block;
    margin-bottom: 4px;
    font-family: var(--font-head);
    font-size: 14px;
    font-weight: 800;
    color: var(--accent);
  }
  .acm-hp .acm-hp-card__title {
    font-size: 16.5px;
  }
  .acm-hp-card__text {
    font-size: 15px;
  }
}
