/* --------- Timeline block (blocks/timeline, blocks/timeline-event) --------- */

/* Drawn for navy: the text takes the section's colour, the years and
   outlines are yellow. view.js hands the card width and the gap to Splide. */
.timeline {
  --timeline-gap: 16px;
  --timeline-card-width: min(352px, 80vw);
}

.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--wp--preset--spacing--40);
  margin-bottom: var(--wp--preset--spacing--60);
}

.timeline .timeline-heading {
  margin: 0;
  color: inherit;
  font-size: var(--wp--preset--font-size--xxxl);
  line-height: 1.1;
}

.timeline-arrows {
  display: flex;
  flex: none;
  gap: 4px;
  margin-left: auto;
}

.timeline .timeline-arrow {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: inherit;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.timeline .timeline-arrow:hover:not(:disabled) {
  opacity: 0.6;
}

.timeline .timeline-arrow:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.timeline .timeline-arrow:disabled {
  opacity: 0.25;
  cursor: default;
}

.timeline .splide__arrow--next svg {
  transform: scaleX(-1);
}

/* The row runs on past the content to the right edge of the window, where
   the next card is cut (the mockup's). The slider's own rules are in
   assets/libs/splide/splide-base.css. */
.timeline .splide__track {
  margin-right: calc(50% - 50vw);
}

/* 50vw counts the scrollbar, so the row reaches a little past the window:
   without this the page scrolls sideways. */
.wp-block-group:has(> .timeline) {
  overflow-x: clip;
}

.timeline .splide__list {
  gap: var(--timeline-gap);
}

.timeline .splide__slide {
  flex-basis: var(--timeline-card-width);
}

/* --------- An event --------- */

.timeline-event {
  display: flex;
  flex-direction: column;
  gap: var(--wp--preset--spacing--40);
  padding: var(--wp--preset--spacing--60) var(--wp--preset--spacing--50) var(--wp--preset--spacing--60) var(--wp--preset--spacing--60);
  border: 1px solid var(--wp--preset--color--secondary);
  border-radius: 24px;
}

.timeline .timeline-year {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--wp--preset--spacing--30);
  margin: 0;
  color: var(--wp--preset--color--secondary);
  font-size: var(--wp--preset--font-size--large);
  line-height: 1.2;
}

.timeline-year svg {
  flex: none;
}

.timeline .timeline-text {
  margin: 0;
  font-size: var(--wp--preset--font-size--small);
  font-weight: 500;
  line-height: 1.4;
}

/* --------- In the editor --------- */

/* No slider there: the events wrap into rows. */
.timeline-editor .timeline-list {
  flex-wrap: wrap;
}

.timeline-editor .timeline-event {
  flex: 0 0 var(--timeline-card-width);
}
