.gallery-modern {
  --gm-bg: #f3f5fb;
  --gm-surface: rgba(255, 255, 255, 0.9);
  --gm-border: rgba(24, 41, 104, 0.1);
  --gm-primary: #182968;
  --gm-primary-soft: rgba(24, 41, 104, 0.08);
  --gm-text: #24324d;
  --gm-text-muted: #5e6f8d;
  --gm-accent: #c72c30;
  --gm-radius-lg: 22px;
  --gm-radius-md: 18px;
  --gm-shadow-md: 0 14px 36px rgba(24, 41, 104, 0.1);
  --gm-shadow-sm: 0 4px 16px rgba(24, 41, 104, 0.08);
  margin-top: 40px;
}

/* ==============================
   Horizontal timeline with track
   ============================== */
.gallery-modern__timeline {
  margin-bottom: 48px;
  padding: 0 40px;
}

.gallery-modern__timeline-track {
  position: relative;
  height: 72px;
  display: flex;
  align-items: center;
}

/* Horizontal line */
.gallery-modern__timeline-track::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gm-border), rgba(24, 41, 104, 0.18), var(--gm-border));
  border-radius: 2px;
  transform: translateY(-50%);
}

/* Decorative end caps */
.gallery-modern__timeline-track::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -16px;
  width: 8px;
  height: 8px;
  border-top: 2px solid rgba(24, 41, 104, 0.25);
  border-right: 2px solid rgba(24, 41, 104, 0.25);
  transform: translateY(-50%) rotate(45deg);
}

.gallery-modern__timeline-point {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transform: translateX(-50%);
  z-index: 1;
  transition: transform 0.3s;
}

.gallery-modern__timeline-point:hover {
  transform: translateX(-50%) scale(1.05);
}

/* Dot on the track */
.gallery-modern__timeline-dot {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid rgba(24, 41, 104, 0.25);
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(24, 41, 104, 0.1);
  flex-shrink: 0;
}

.gallery-modern__timeline-point--active .gallery-modern__timeline-dot {
  width: 20px;
  height: 20px;
  background: var(--gm-primary);
  border-color: var(--gm-primary);
  box-shadow: 0 0 0 6px rgba(24, 41, 104, 0.12), 0 4px 12px rgba(24, 41, 104, 0.2);
}

.gallery-modern__timeline-point:hover:not(.gallery-modern__timeline-point--active) .gallery-modern__timeline-dot {
  border-color: var(--gm-primary);
  background: rgba(24, 41, 104, 0.08);
}

/* Year label under the dot */
.gallery-modern__timeline-label {
  display: block;
  margin-top: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--gm-text-muted);
  white-space: nowrap;
  transition: all 0.3s;
}

.gallery-modern__timeline-point--active .gallery-modern__timeline-label {
  font-size: 20px;
  font-weight: 800;
  color: var(--gm-primary);
  margin-top: 8px;
}

.gallery-modern__timeline-point:hover:not(.gallery-modern__timeline-point--active) .gallery-modern__timeline-label {
  color: var(--gm-primary);
}

/* ---- Grids ---- */
.gallery-modern__grid-wrap {
  position: relative;
}

.gallery-modern__grid {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  animation: gmFadeIn 0.4s ease;
}

.gallery-modern__grid--active {
  display: grid;
}

@keyframes gmFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Card ---- */
.gallery-modern__card {
  position: relative;
  border-radius: var(--gm-radius-md);
  overflow: hidden;
  background: var(--gm-surface);
  border: 1px solid var(--gm-border);
  box-shadow: var(--gm-shadow-sm);
  aspect-ratio: 3 / 4;
  transition: box-shadow 0.3s, transform 0.3s;
}

.gallery-modern__card:hover {
  box-shadow: var(--gm-shadow-md);
  transform: translateY(-4px);
}

/* Photo */
.gallery-modern__card-photo-wrap {
  position: absolute;
  inset: 0;
}

.gallery-modern__card-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

/* Gradient overlay for name readability */
.gallery-modern__card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 55%;
  background: linear-gradient(0deg, rgba(24, 41, 104, 0.82) 0%, rgba(24, 41, 104, 0.4) 50%, transparent 100%);
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.3s;
}

/* Name body (always visible) */
.gallery-modern__card-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 20px;
  z-index: 2;
  transition: transform 0.3s, opacity 0.3s;
}

.gallery-modern__card-surname {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.02em;
}

.gallery-modern__card-name {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  margin-top: 2px;
}

/* Hover info overlay */
.gallery-modern__card-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 20px;
  background: rgba(24, 41, 104, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 3;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}

.gallery-modern__card:hover .gallery-modern__card-info {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.gallery-modern__card:hover .gallery-modern__card-body {
  opacity: 0;
  transform: translateY(-8px);
}

.gallery-modern__card-role-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.gallery-modern__card-role-text {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  line-height: 1.45;
  margin-top: 6px;
}

/* ---- Responsive ---- */

/* Tablet */
@media (max-width: 1139px) {
  .gallery-modern__grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }

  .gallery-modern__timeline {
    padding: 0 30px;
    margin-bottom: 40px;
  }
}

/* Mobile */
@media (max-width: 767px) {
  .gallery-modern__timeline {
    padding: 0 20px;
    margin-bottom: 32px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .gallery-modern__timeline::-webkit-scrollbar {
    display: none;
  }

  .gallery-modern__timeline-track {
    min-width: 400px;
    height: 64px;
  }

  .gallery-modern__timeline-label {
    font-size: 13px;
  }

  .gallery-modern__timeline-point--active .gallery-modern__timeline-label {
    font-size: 17px;
  }

  .gallery-modern__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .gallery-modern__card-name {
    font-size: 18px;
  }

  .gallery-modern__card-body {
    padding: 14px;
  }

  .gallery-modern__card-info {
    padding: 14px;
  }

  .gallery-modern__card-role-text {
    font-size: 13px;
  }
}

/* Small mobile */
@media (max-width: 479px) {
  .gallery-modern__grid {
    grid-template-columns: 1fr;
    gap: 16px;
    max-width: 320px;
    margin: 0 auto;
  }
}
