/**
 * Mapa de vida (fitxa del brigadista).
 */

/* La llegenda estàtica antiga la substitueix la interactiva del mapa. */
body.sm-life-active .llegenda-mapa-vida {
  display: none !important;
}

.sm-life {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--sm-line);
  box-shadow: var(--sm-shadow);
  background: var(--sm-surface);
  color: var(--sm-ink);
}
.sm-life #brigadista-map {
  margin: 0 !important;
  height: min(64vh, 600px);
  min-height: 360px;
  border-radius: 0;
}
.sm-life.is-fullscreen {
  display: flex;
  flex-direction: column;
  border-radius: 0;
}
.sm-life.is-fullscreen #brigadista-map {
  flex: 1;
  height: auto;
}

/* Punts ----------------------------------------------------------------- */
.sm-life-icon {
  background: none;
}
.sm-life-pin {
  position: relative;
  display: block;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--c) var(--i, none) center / 58% no-repeat;
  border: 2.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .25), 0 2px 6px rgba(0, 0, 0, .3);
  box-sizing: border-box;
  transition: transform .15s ease-out;
}
.sm-life-icon:hover .sm-life-pin {
  transform: scale(1.15);
}
.sm-life-pin b {
  position: absolute;
  top: -8px;
  right: -9px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--sm-ink);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
  font-variant-numeric: tabular-nums;
}

/* Recorregut ------------------------------------------------------------ */
.sm-life-comet {
  background: none;
}
.sm-life-comet span {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--c);
  box-sizing: border-box;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--c) 25%, transparent), 0 2px 6px rgba(0, 0, 0, .35);
}
.sm-life-year {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 800;
  transform: translate(-50%, -8px);
  padding: 4px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--sm-shadow);
  font-size: 30px;
  font-weight: 700;
  color: var(--sm-ink);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}
.sm-life-year.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Popups ---------------------------------------------------------------- */
.sm-life-popup__step {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--sm-soft);
}
.sm-life-popup__event + .sm-life-popup__event {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--sm-line);
}
.sm-life-popup__type {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 2px;
  font-size: 12px;
  color: var(--sm-soft);
}
.sm-life-popup__type::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c, var(--sm-brand));
}
.sm-life-popup strong {
  display: block;
  font-size: 15px;
  line-height: 1.3;
}
.sm-life-popup strong a {
  color: var(--sm-ink) !important;
  text-decoration: none !important;
}
.sm-life-popup strong a:hover {
  color: var(--sm-brand-700) !important;
  text-decoration: underline !important;
}
.sm-life-popup__date {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: var(--sm-soft);
}

/* Línia de temps -------------------------------------------------------- */
.sm-life-timeline {
  border-top: 1px solid var(--sm-line);
  background: var(--sm-bg);
  padding: 14px 16px 12px;
}
.sm-life-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}
.sm-life-play {
  gap: 8px;
}
.sm-life-play__icon {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent currentColor;
}
.sm-life-play.is-playing .sm-life-play__icon {
  width: 10px;
  height: 12px;
  border: 0;
  border-left: 3.5px solid currentColor;
  border-right: 3.5px solid currentColor;
}
.sm-life-note {
  margin: 0 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--sm-soft);
}
.sm-life-note__solid,
.sm-life-note__dash {
  width: 22px;
  height: 0;
  border-top: 3px solid #5C6FB0;
  margin-left: 8px;
}
.sm-life-note__dash {
  border-top-style: dotted;
}
.sm-life-steps {
  list-style: none;
  display: flex;
  gap: 4px;
  margin: 12px 0 0;
  padding: 0 0 6px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.sm-life-steps li {
  flex: 0 0 auto;
  scroll-snap-align: center;
}
.sm-life-step {
  display: grid;
  grid-template-columns: auto;
  justify-items: start;
  gap: 2px;
  width: 150px;
  padding: 8px 10px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  font: inherit;
  text-align: left;
  color: var(--sm-ink);
  cursor: pointer;
  position: relative;
}
.sm-life-step:hover {
  background: #fff;
  box-shadow: var(--sm-shadow-sm);
}
.sm-life-step__year {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.sm-life-step__year abbr {
  text-decoration: none;
  color: var(--sm-soft);
  font-weight: 600;
}
.sm-life-step__dot {
  position: relative;
  width: 100%;
  height: 12px;
  margin: 4px 0;
}
.sm-life-step__dot::before {
  content: "";
  position: absolute;
  left: 0;
  right: -14px;
  top: 5px;
  height: 3px;
  border-radius: 2px;
  background: var(--t);
  opacity: .35;
}
.sm-life-steps li:last-child .sm-life-step__dot::before {
  right: auto;
  width: 12px;
}
.sm-life-step__dot::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 2px #fff;
}
.sm-life-step__type {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--sm-soft);
}
.sm-life-step__name {
  font-size: 13px;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sm-life-step__name small {
  color: var(--sm-soft);
}
.sm-life-step.is-past .sm-life-step__dot::before {
  opacity: 1;
}
.sm-life-step.is-current {
  background: #fff;
  box-shadow: inset 0 -3px 0 var(--c), var(--sm-shadow-sm);
}
.sm-life-step.is-current .sm-life-step__dot::after {
  box-shadow: 0 0 0 2px #fff, 0 0 0 5px color-mix(in srgb, var(--c) 35%, transparent);
}

@media (max-width: 700px) {
  .sm-life-note {
    margin-left: 0;
    width: 100%;
  }
  .sm-life #brigadista-map {
    height: 56vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sm-life-year,
  .sm-life-pin {
    transition: none;
  }
}
