/* ============================================================================
   Company Milestones — image timeline with wireframe panels
   ============================================================================ */

.ms-journey {
  --ms-media-max-w: 28rem;   /* ~448px desktop media width */
  --ms-media-h: 17.5rem;     /* 280px fixed height — equal for all */
  --ms-media-radius: 0 48px 0 48px;
  background: #ffffff;
  padding-top: clamp(2.5rem, 5vw, 4rem);
  padding-bottom: clamp(3.5rem, 7vw, 5.5rem);
}

.ms-header {
  text-align: center;
  margin-bottom: clamp(2.5rem, 5vw, 3.75rem);
  max-width: 40rem;
  margin-left: auto;
  margin-right: auto;
}

.ms-header .section-label {
  justify-content: center;
  margin-bottom: 0.85rem;
}

.ms-header h2 {
  font-family: 'Sora', 'Inter', sans-serif;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--clr-black, #111);
  margin: 0;
  line-height: 1.15;
}

.ms-header p {
  margin: 1.1rem auto 0;
  font-size: clamp(0.95rem, 0.3vw + 0.9rem, 1.05rem);
  line-height: 1.7;
  color: var(--clr-text-body, #4A4A4A);
}

/* Timeline */
.ms-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(2.75rem, 5vw, 4.25rem);
  position: relative;
}

.ms-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.5rem minmax(0, 1.15fr);
  gap: clamp(1rem, 2.5vw, 2rem);
  align-items: center;
}

.ms-item--flip .ms-item__copy {
  order: 3;
  text-align: left;
}

.ms-item--flip .ms-item__spine {
  order: 2;
}

.ms-item--flip .ms-item__visual {
  order: 1;
}

.ms-item__copy {
  min-width: 0;
}

.ms-item:not(.ms-item--flip) .ms-item__copy {
  text-align: right;
}

.ms-item__year {
  display: inline-block;
  font-family: 'Sora', 'Inter', sans-serif;
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  color: var(--clr-black, #111);
  line-height: 1;
  letter-spacing: -0.03em;
  border-bottom: 3px solid var(--clr-primary, #e51a1a);
  padding-bottom: 0.4rem;
  margin-bottom: 0.9rem;
}

.ms-item__title {
  font-family: 'Sora', 'Inter', sans-serif;
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  font-weight: 700;
  color: var(--clr-black, #111);
  margin: 0 0 0.75rem;
  line-height: 1.3;
}

.ms-item__text {
  margin: 0;
  font-size: clamp(0.92rem, 0.2vw + 0.88rem, 1rem);
  line-height: 1.7;
  color: var(--clr-text-body, #4A4A4A);
  max-width: 36ch;
}

.ms-item:not(.ms-item--flip) .ms-item__text,
.ms-item:not(.ms-item--flip) .ms-item__tags {
  margin-left: auto;
}

.ms-item__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  list-style: none;
  margin: 1.1rem 0 0;
  padding: 0;
  max-width: 36ch;
}

.ms-item:not(.ms-item--flip) .ms-item__tags {
  justify-content: flex-end;
}

.ms-item__tags li {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--clr-primary, #e51a1a);
  background: var(--clr-primary-bg, rgba(229, 26, 26, 0.05));
  border: 1px solid var(--clr-primary-border, rgba(229, 26, 26, 0.15));
  padding: 0.45rem 0.75rem;
  min-height: 2.5rem;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm, 2px);
}

/* Spine */
.ms-item__spine {
  position: relative;
  align-self: stretch;
  display: flex;
  justify-content: center;
  min-height: 100%;
}

.ms-item__spine::before {
  content: "";
  position: absolute;
  top: -2rem;
  bottom: -2rem;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, var(--clr-border, #E5E5E5) 12%, var(--clr-border, #E5E5E5) 88%, transparent);
}

.ms-item:first-child .ms-item__spine::before {
  top: 50%;
}

.ms-item:last-child .ms-item__spine::before {
  bottom: 50%;
}

.ms-item__dot {
  position: relative;
  z-index: 1;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--clr-primary, #e51a1a);
  box-shadow: 0 0 0 4px rgba(229, 26, 26, 0.12);
  align-self: center;
  flex-shrink: 0;
}

/* Visual column — align panels toward the timeline spine */
.ms-item__visual {
  min-width: 0;
  width: 100%;
  display: flex;
}

.ms-item:not(.ms-item--flip) .ms-item__visual {
  justify-content: flex-start;
}

.ms-item--flip .ms-item__visual {
  justify-content: flex-end;
}

/* Wireframe image panel — uniform size for every milestone */
.ms-wireframe-panel {
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
  width: min(100%, var(--ms-media-max-w));
  height: var(--ms-media-h);
  background: #111;
  border: 1px solid var(--clr-border, #E5E5E5);
  border-radius: var(--ms-media-radius);
}

.ms-wireframe-panel__img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: grayscale(0.35) contrast(1.08) brightness(0.72);
  transition: transform 0.55s cubic-bezier(0.16, 1, 0.3, 1), filter 0.35s ease;
}

.ms-item:hover .ms-wireframe-panel__img,
.ms-item:focus-within .ms-wireframe-panel__img {
  transform: scale(1.04);
  filter: grayscale(0.15) contrast(1.1) brightness(0.78);
}

.ms-wireframe-panel__grid {
  position: absolute;
  inset: 0;
  z-index: 2;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}

.ms-wireframe-panel__frame {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.92);
  pointer-events: none;
}

.ms-wireframe-panel__frame svg {
  width: min(42%, 180px);
  height: auto;
  opacity: 0.88;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.35));
}

.ms-wireframe-panel__label {
  position: absolute;
  z-index: 4;
  left: 1rem;
  bottom: 1rem;
  font-family: 'Sora', 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(17, 17, 17, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 0.45rem 0.7rem;
  backdrop-filter: blur(6px);
}

/* Skeleton hide content while booting */
body.page-booting .ms-content {
  visibility: hidden;
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* Tablet — stack beside spine, full-width equal media */
@media (max-width: 900px) {
  .ms-journey {
    --ms-media-max-w: 100%;
    --ms-media-h: 15rem; /* 240px */
    --ms-media-radius: 0 32px 0 32px;
  }

  .ms-timeline {
    gap: clamp(2.25rem, 5vw, 3rem);
  }

  .ms-item,
  .ms-item--flip {
    grid-template-columns: 1.75rem minmax(0, 1fr);
    gap: 1rem 1.15rem;
  }

  .ms-item__spine {
    grid-row: 1 / span 2;
    order: 1 !important;
  }

  .ms-item__copy,
  .ms-item--flip .ms-item__copy {
    order: 2 !important;
    text-align: left;
    grid-column: 2;
  }

  .ms-item__visual,
  .ms-item--flip .ms-item__visual {
    order: 3 !important;
    grid-column: 2;
    justify-content: stretch;
  }

  .ms-wireframe-panel {
    width: 100%;
    flex: 1 1 auto;
  }

  .ms-item:not(.ms-item--flip) .ms-item__text,
  .ms-item:not(.ms-item--flip) .ms-item__tags {
    margin-left: 0;
  }

  .ms-item:not(.ms-item--flip) .ms-item__tags {
    justify-content: flex-start;
  }
}

/* Mobile — shorter equal height, touch-friendly spacing */
@media (max-width: 640px) {
  .ms-journey {
    --ms-media-h: 12.5rem; /* 200px */
    --ms-media-radius: 0 24px 0 24px;
  }

  .ms-timeline {
    gap: 2.25rem;
  }

  .ms-item,
  .ms-item--flip {
    gap: 0.85rem 1rem;
  }

  .ms-item__year {
    font-size: 1.75rem;
  }

  .ms-item__tags {
    gap: 0.5rem;
  }

  .ms-item__tags li {
    min-height: 2.75rem;
    padding: 0.5rem 0.85rem;
  }

  .ms-wireframe-panel__frame svg {
    width: min(48%, 140px);
  }

  .ms-wireframe-panel__label {
    font-size: 0.65rem;
    left: 0.75rem;
    bottom: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ms-wireframe-panel__img {
    transition: none;
  }

  .ms-item:hover .ms-wireframe-panel__img,
  .ms-item:focus-within .ms-wireframe-panel__img {
    transform: none;
  }
}
