/**
 * Itinéraire d'une fiche circuit.
 *
 * La carte à gauche, collante ; le programme à droite, sur un fil vertical en
 * tirets or ponctué d'un point par journée.
 */

.tc-trip-itinerary__grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 56px;
  align-items: start;
}

.tc-trip-itinerary__grid--single {
  grid-template-columns: minmax(0, 760px);
  justify-content: center;
}

.tc-trip-itinerary__map {
  position: sticky;
  top: calc(var(--tc-trip-sticky) + 8px);
}

/* --- Programme ------------------------------------------------------------- */

.tc-trip-program {
  position: relative;
  margin: 0;
  padding: 0 0 0 40px;
  list-style: none;
}

.tc-trip-program::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 14px;
  bottom: 14px;
  border-left: 2px dashed var(--tc-primary);
}

.tc-trip-day {
  position: relative;
  margin-bottom: 52px;
  scroll-margin-top: calc(var(--tc-trip-sticky) + 20px);
}

.tc-trip-day:last-child {
  margin-bottom: 0;
}

/* Le point sur le fil, cerclé de la couleur du fond pour se détacher. */
.tc-trip-day::before {
  content: "";
  position: absolute;
  left: -40px;
  top: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--tc-primary);
  box-shadow: 0 0 0 4px var(--tc-surface-soft);
}

.tc-trip-band--white .tc-trip-day::before {
  box-shadow: 0 0 0 4px var(--tc-surface);
}

.tc-trip-day__title {
  margin: 0 0 12px;
  font-size: var(--tc-fs-xl);
  font-weight: 500;
  line-height: 1.3;
  color: var(--tc-ink);
  transition: color 400ms ease;
}

.tc-trip-day__title span {
  font-weight: 800;
}

/* La journée atteinte depuis la carte s'éclaire un instant. */
.tc-trip-day.is-target .tc-trip-day__title {
  color: var(--tc-primary-strong);
}

.tc-trip-day__text {
  margin: 0 0 12px;
  font-size: var(--tc-fs-md);
  line-height: 1.65;
  color: var(--tc-ink-soft);
}

.tc-trip-day__text > :first-child {
  margin-top: 0;
}

.tc-trip-day__text > :last-child {
  margin-bottom: 0;
}

.tc-trip-day__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--tc-fs-sm);
  font-weight: 600;
  color: var(--tc-ink);
}

.tc-trip-day__facts li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tc-trip-day__facts svg {
  flex: none;
  color: var(--tc-primary-strong);
}

/* --- Photos du jour -------------------------------------------------------- */

.tc-trip-gallery {
  position: relative;
  width: min(405px, 100%);
  aspect-ratio: 4 / 3;
  margin: 18px 0 16px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--tc-border);
}

.tc-trip-gallery__track {
  display: flex;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.tc-trip-gallery__track::-webkit-scrollbar {
  display: none;
}

.tc-trip-gallery__track:focus-visible {
  outline-offset: -3px;
}

.tc-trip-gallery__track li {
  flex: 0 0 100%;
  scroll-snap-align: start;
}

.tc-trip-gallery__track img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tc-trip-gallery__arrow {
  position: absolute;
  bottom: 10px;
  left: 10px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .94);
  color: var(--tc-ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
  cursor: pointer;
  transition: opacity 160ms ease;
}

.tc-trip-gallery__arrow--next {
  left: auto;
  right: 10px;
}

.tc-trip-gallery__arrow--next svg {
  transform: scaleX(-1);
}

.tc-trip-gallery__arrow:disabled {
  opacity: .4;
  cursor: default;
}

/* --- Carte du trajet ------------------------------------------------------- */

.tc-trip-map {
  position: relative;
  height: clamp(560px, calc(100vh - 116px), 760px);
  overflow: hidden;
  border: 1px solid var(--tc-border);
  border-radius: 16px;
  background: var(--tc-surface-soft);
  font-family: var(--tc-sans);
}

.tc-trip-map .mapboxgl-ctrl-group {
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}

.tc-trip-map .mapboxgl-ctrl-group button {
  width: 32px;
  height: 32px;
}

.tc-trip-map .mapboxgl-ctrl-attrib {
  font-size: 10px;
}

/* La bulle : la photo de la journée, son numéro, son titre, le lien vers elle. */
.tc-trip-map .mapboxgl-popup-content {
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
  font-family: var(--tc-sans);
}

/* La croix, dessinée en fond et non en glyphe : centrée partout. */
.tc-trip-map .mapboxgl-popup-close-button {
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%232A2C29' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M4 4l8 8M12 4l-8 8'/%3E%3C/svg%3E") center / 12px 12px no-repeat;
  color: transparent;
  font-size: 0;
  line-height: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
}

.tc-trip-map .mapboxgl-popup-close-button:hover {
  background-color: #FFFFFF;
}

.tc-trip-map__bubble {
  width: 220px;
}

.tc-trip-map__bubble img {
  display: block;
  width: 100%;
  height: 110px;
  object-fit: cover;
}

.tc-trip-map__bubble-text {
  padding: 10px 12px 12px;
}

.tc-trip-map__bubble-day {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--tc-primary-strong);
}

.tc-trip-map__bubble-title {
  display: block;
  margin: 3px 0 8px;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--tc-ink);
}

.tc-trip-map__bubble a {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--tc-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --- Réactif --------------------------------------------------------------- */

@media (max-width: 1000px) {
  /* Une colonne : la carte au-dessus du programme, plus basse, sans coller. */
  .tc-trip-itinerary__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .tc-trip-itinerary__map {
    position: static;
  }

  .tc-trip-map {
    height: 440px;
  }
}

@media (max-width: 700px) {
  .tc-trip-map {
    height: 360px;
  }

  .tc-trip-program {
    padding-left: 30px;
  }

  .tc-trip-program::before {
    left: 5px;
  }

  .tc-trip-day {
    margin-bottom: 40px;
  }

  .tc-trip-day::before {
    left: -30px;
    top: 6px;
    width: 14px;
    height: 14px;
  }

  .tc-trip-gallery {
    aspect-ratio: 16 / 10;
  }
}
