/* ========== BASE ========== */
a {
  text-decoration: none;
  color: #1d1d1d;
}

.container {
  max-width: 1300px;
  overflow: hidden;
  padding: 0 40px;
  margin: 80px auto;
}

/* .container header { 
  text-align: center;
} */

/* ========== SLIDER ========== */
.timeline {
  display: flex;
  gap: 2rem;
  overflow-x: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 20px 10px 20px 15px;
  contain: layout style paint;
}

.timeline::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.timeline::-webkit-scrollbar-track {
  background: transparent;
}

.timeline::-webkit-scrollbar-thumb {
  background: var(--color50);
  border-radius: 4px;
}

.timeline::-webkit-scrollbar-thumb:hover {
  background: #FF5100;
}

.phase {
  padding: 24px;
  position: relative;
  min-width: 350px;
  max-width: 350px;
  scroll-snap-align: start;
  flex-shrink: 0;
  margin-bottom: 2rem;
  background-color: var(--bg-main);
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  /* background: linear-gradient(157deg, rgba(249, 249, 249, 1) 85%, rgba(186, 197, 209, 1) 100%); */
  transition: all 0.3s ease, opacity 0.5s ease;
}

.phase:hover {
  box-shadow: var(--box-shadow);
  transform: translateY(-2px);
}

/* Desktop only: add margin-left and padding for box-shadow visibility */
@media (min-width: 769px) {
  .timeline {
    padding-left: 20px;
  }

  .phase {
    margin-left: 10px;
    scroll-snap-align: none;
  }
}

.phase-header {
  cursor: pointer;
  display: flex;
  gap: 1rem;
}

.phase-number {
  display: inline-block;
  color: var(--color50);
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  letter-spacing: 0.5px;
}

.phase-title {
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  font-weight: 600;
  color: var(--text);
}

.phase-objective {
  font-size: 0.9375rem;
  color: var(--text-light);
}

.phase-thumbnail {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.phase-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.phase-description h3{
  margin-bottom: 16px;
}
.phase-description p{
  margin-bottom: 12px;
}
.phase-description ul {
  margin-bottom: 16px;
}
.phase-description li{
  font-weight: 300;
}
.phase-description span,
.phase-description h4 {
  font-weight: 600;
  font-size: 18px;
  display: block;
  margin-bottom: 12px;
}

.expand-indicator {
  right: 2rem;
  top: 2rem;
  margin-top: 16px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  transition: all 0.3s ease;
}

.expand-indicator::after {
  content: 'Read more';
  border-radius: 8px;
  padding: 8px 26px;
  font-size: 1rem;
  background-color: var(--color50);
  /* background: linear-gradient(90deg, #ee7203 0%, #d93b09 100.02%); */
  color: var(--color100);
}

/* ========== SLIDER NAVIGATION ========== */
.slider-nav {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  padding: 4px 0;
}

.nav-button {
  background: var(--color50);
  color: var(--color100);
  border: 1px solid var(--color50);
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  /* box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); */
  transition: all 0.3s ease;
}

.nav-button:hover {
  background: var(--color100);
  color: var(--color50);
  border: 1px solid var(--color50);
  transform: scale(1.1);
}

.nav-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ========== DETAIL VIEW ========== */
.detail-view {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  overflow-y: auto;
  padding: 40px 20px;
}

.detail-view.active {
  display: flex;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.overview-view.hidden {
  display: none;
}

.left {
  max-width: 600px;
}

.right {
  max-width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.detail-content {
  width: 100%;
  max-width: 1200px;
  max-height: 85vh;
  margin: 0 auto;
  background-color: var(--bg-main);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  position: relative;
  animation: scaleUp 0.3s ease;
  overflow: hidden;
}

.detail-content .popup-header {
  flex-shrink: 0;
  padding: 30px 30px 0 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.detail-content .popup-content {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 30px;
  flex-grow: 1;
  margin: 0;
  color: var(--text);
  line-height: 1.6;
}

.detail-inner {
  display: flex;
  /* align-items: center; */
  justify-content: space-between;
  gap: 3rem;
}

@keyframes scaleUp {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.detail-view img {
  width: 100%;
  max-width: 450px;
  margin-top: 10px;
  height: auto;
}

.detail-view ul {
  margin-left: 20px;
}

.phase-description {
  color: var(--text);
  line-height: 1.7;
}

.phase-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  margin: 24px 0 1.5rem;
  text-align: center;
}

.tag {
  padding: 0.375rem 0.875rem;
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary);
  border-radius: 20px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.back-button {
  background-color: var(--color50);
  color: var(--color100);
  border-radius: 8px;
  border: none;
  padding: 12px 24px;
  text-align: center;
  width: fit-content;
  cursor: pointer;
}

.back-button:hover {
  opacity: 0.9;
}

.close-button {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--color50);
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  line-height: 1;
}

.close-button:hover {
  background-color: #f0f0f0;
  color: #666;
}

#img1,
#detail-img1 {
  max-width: 50%;
}
img#img5 {
  border-radius: 50%;
}

/* ========== VIEW TRANSITIONS ========== */
::view-transition-group(change),
::view-transition-group(change2),
::view-transition-group(change3),
::view-transition-group(change4),
::view-transition-group(change5),
::view-transition-group(change6),
::view-transition-group(change7) {
  animation-duration: 1.5s;
}

#img1,
#detail-img1 {
  view-transition-name: change;
}
#img2,
#detail-img2 {
  view-transition-name: change2;
}
#img3,
#detail-img3 {
  view-transition-name: change3;
}
#img4,
#detail-img4 {
  view-transition-name: change4;
}
#img5,
#detail-img5 {
  view-transition-name: change5;
}
#img6,
#detail-img6 {
  view-transition-name: change6;
}
#img7,
#detail-img7 {
  view-transition-name: change7;
}

::view-transition-old(change),
::view-transition-new(change),
::view-transition-old(change2),
::view-transition-new(change2),
::view-transition-old(change3),
::view-transition-new(change3),
::view-transition-old(change4),
::view-transition-new(change4),
::view-transition-old(change5),
::view-transition-new(change5),
::view-transition-old(change6),
::view-transition-new(change6),
::view-transition-old(change7),
::view-transition-new(change7) {
  animation-duration: 0.2s;
  animation-timing-function: ease-in-out;
}

/* ========== RESPONSIVE ========== */
@media (min-width: 769px) {
  .detail-inner {
    flex-direction: row;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 20px;
  }

  .timeline {
    padding: 20px calc((100vw - 300px) / 2);
    margin: 0 -20px;
    gap: 16px;
  }

  .phase {
    min-width: 315px;
    max-width: 315px;
    scroll-snap-align: center;
    box-shadow: var(--box-shadow);
  }

  .nav-button {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .detail-view {
    height: auto;
    min-height: 100vh;
    padding: 20px 24px;
  }

  .detail-content {
    width: 100%;
  }

  .detail-content .popup-header {
    padding: 20px 20px 0 20px;
  }

  .detail-content .popup-content {
    padding: 20px;
  }

  .detail-inner {
    flex-direction: column;
    gap: 32px;
  }

  .left,
  .right {
    max-width: 100%;
    width: 100%;
  }

  .right {
    order: -1;
  }

  .detail-view img {
    max-width: 100%;
  }

  .back-button {
    width: 100%;
    padding: 14px 24px;
  }

  .slider-nav {
    margin: 0;
  }

  .close-button {
    font-size: 24px;
    width: 28px;
    height: 28px;
  }
}

@media (min-width: 768px) {
  .phase-thumbnail {
    width: 100px;
    height: 100px;
  }
}

@media (max-width: 480px) {
  .detail-content {
    padding: 24px 16px;
    gap: 24px;
  }
}
