@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

/* CodePen Environment Wrapper */
.timeline-codepen-wrapper {
  background: var(--background-light, #f8f9fa);
  min-height: 520px;
  display: grid;
  place-items: center;
  font-family: var(--nav-font, "Poppins", sans-serif);
  border-radius: var(--radius-xl, 1rem);
  padding: 2rem;
  margin: 2rem 0;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-light, rgba(0, 0, 0, 0.08));
}

/* Timeline container styling */
.timeline-container {
  display: flex;
  gap: 33.5px;
  width: 100%;
  height: 420px; /* 3x higher for better visibility */
  justify-content: center;
  font-weight: 900;
  font-size: 67px;
  position: absolute;
  top: 66%;
  left: 50%;
  transform: translate(-50%, -50%) scale(var(--timeline-scale, .68));
  transform-origin: center;
}

/* Individual timeline point styling */
.timeline-point {
  transition-duration: var(--transition-slow, 0.5s);
  border-radius: 50%;
  background: var(--background-white, #ffffff);
  box-shadow: 13.4px 13.4px 40.2px rgba(255, 255, 255, 0.8), -13.4px -13.4px 40.2px rgba(255, 255, 255, 0.4);
  display: grid;
  place-items: center;
  width: 134px;
  height: 134px;
  position: relative;
  color: var(--color);
  border: 3px solid var(--color);
}

.timeline-point::before {
  content: "";
  width: 200px;
  height: 200px;
  z-index: -1;
  border-radius: 50%;
  position: absolute;
  background: conic-gradient(
    var(--color) var(--angle),
    transparent 0deg 360deg
  );
  animation: rotateBorder 1s linear var(--delay) forwards;
}

.timeline-point:nth-child(odd)::before {
  transform: rotate(-90deg);
}

.timeline-point:nth-child(even)::before {
  transform: rotate(90deg) scaleY(-1);
}

/* Custom property for angle */
@property --angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

/* Common styling for timeline points */
.timeline-point:nth-child(1) {
  --color: var(--secondary-color, #ff6b35); /* Secondary orange */
  --delay: 0s;
}

.timeline-point:nth-child(2) {
  --color: var(--secondary-color, #ff6b35); /* Secondary orange */
  --delay: 1s;
}

.timeline-point:nth-child(3) {
  --color: var(--secondary-color, #ff6b35); /* Secondary orange */
  --delay: 2s;
}

.timeline-point:nth-child(4) {
  --color: var(--secondary-color, #ff6b35); /* Secondary orange */
  --delay: 3s;
}

.timeline-point:nth-child(5) {
  --color: var(--secondary-color, #ff6b35); /* Secondary orange */
  --delay: 4s;
}

/* Popup styling */
.popup {
  width: 321.6px;
  height: auto;
  max-height: 0;
  background-color: var(--color);
  display: grid;
  grid-template-columns: 16% 84%;
  position: absolute;
  color: var(--text-light, #ffffff);
  border-radius: var(--radius-xl, 1rem);

  transform-origin: bottom bottom;
  animation: expandPopup 0.5s linear calc(var(--delay) + 0.5s) forwards;
}

.timeline-point:nth-child(odd) .popup {
  bottom: 221.1px;
}

.timeline-point:nth-child(even) .popup {
  top: 221.1px;
}

/* Popup number styling */
.popup-number {
  grid-row: span 2;
  display: grid;
  font-size: 2rem;
  font-weight: bold;
  place-items: center;
  cursor: auto;
  animation: fadeIn 0.5s linear calc(var(--delay) + 0.7s) forwards;
  opacity: 0;
  height: 100%;
}

/* Popup title styling */
.popup-title {
  color: var(--color);
  padding-bottom: 6.7px;
  font-size: 20.1px;
  font-weight: 700;
  font-family: var(--heading-font, "Montserrat", sans-serif);
}

/* Popup details styling */
.popup-details {
  padding: 20.1px;
  background-color: rgba(255, 255, 255, 1);
  border-radius: var(--radius-lg, 0.75rem);
  opacity: 0;
  font-weight: 500;
  user-select: none;
  cursor: auto;
  overflow: hidden;
  font-size: 0.8rem;
  text-align: center;
  margin: 3.35px;
  color: var(--secondary-color, #ff6b35);
  animation: fadeIn 0.5s linear calc(var(--delay) + 0.7s) forwards;
}

.popup::before {
  content: "";
  width: 6.7px;
  height: 0;
  border-radius: 20px;
  background-color: var(--color);
  position: absolute;
  left: 50%;
  top: -41.9px;
  display: flex;
  animation: drawLine 0.5s linear var(--delay) forwards;
}

.timeline-point:nth-child(odd) .popup:before {
  top: calc(100% + 47px);
  transform: rotateX(180deg);
  transform-origin: top;
}

/* Hover effect for timeline points */
.timeline-point:hover {
  background: var(--color);
  color: var(--text-light, #ffffff);
}

/* Animation for border rotation */
@keyframes rotateBorder {
  from {
    --angle: 0deg;
  }

  to {
    --angle: 180deg;
  }
}

/* Animation for popup expansion */
@keyframes expandPopup {
  0% {
    max-height: 0;
  }

  100% {
    max-height: 200px;
  }
}

/* Animation for line drawing */
@keyframes drawLine {
  0% {
    height: 0%;
    opacity: 0;
  }

  100% {
    height: 33.5px;
    opacity: 1;
  }
}

/* Animation for fade-in effect */
@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

/* History Timeline */
.history-timeline {
  max-width: 800px;
  margin: 0 auto;
}

.timeline-item {
  display: flex;
  margin-bottom: 2rem;
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 120px;
  top: 0;
  bottom: -2rem;
  width: 2px;
  background: var(--secondary-color, #ff6b35);
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-date {
  min-width: 120px;
  font-weight: 600;
  color: var(--secondary-color, #ff6b35);
  font-size: 0.9rem;
  padding-right: 1rem;
}

.timeline-content {
  flex: 1;
}

.timeline-content h4 {
  color: #2c3e50;
  margin-bottom: 0.5rem;
}

/* Comprehensive Timeline */
.comprehensive-timeline {
  max-width: 1000px;
  margin: 0 auto;
  position: relative;
  z-index: 0; /* ensure timeline sits below overlaying elements like navigation */
}

.comprehensive-timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--secondary-color, #ff6b35);
  transform: translateX(-50%);
  z-index: 1;
}

.timeline-item {
  display: flex;
  margin-bottom: 4rem;
  position: relative;
  z-index: 2;
}

.timeline-item:nth-child(even) {
  flex-direction: row-reverse;
  text-align: right;
}

.timeline-marker {
  flex-shrink: 0;
  width: 120px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.timeline-marker .year {
  background: var(--secondary-color, #ff6b35);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
  border: 3px solid rgba(255, 255, 255, 0.9);
}

.timeline-marker::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: var(--secondary-color, #ff6b35);
  border-radius: 50%;
  border: 4px solid white;
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.3);
  z-index: 3;
}

.timeline-item:nth-child(even) .timeline-marker::after {
  right: -30px;
}

.timeline-item:nth-child(odd) .timeline-marker::after {
  left: -30px;
}

.timeline-content {
  flex: 1;
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  border: 1px solid #e9ecef;
  margin: 0 2rem;
}

.timeline-item:nth-child(even) .timeline-content {
  text-align: left;
}

.timeline-content h3 {
  color: #2c3e50;
  margin-bottom: 0.75rem;
  font-size: 1.4rem;
}

.timeline-content strong {
  color: var(--secondary-color, #ff6b35);
  font-weight: 600;
}

.cultural-details {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid #f8f9fa;
}

.cultural-details h4 {
  color: #495057;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.cultural-details ul {
  list-style: none;
  padding: 0;
}

.cultural-details li {
  padding: 0.5rem 0;
  padding-left: 1.5rem;
  position: relative;
  color: #6c757d;
}

.cultural-details li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--secondary-color, #ff6b35);
  font-weight: bold;
}

/* Cultural Traditions Grid */
.tradition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

.tradition-card {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  border: 1px solid #e9ecef;
}

.tradition-card h3 {
  color: #2c3e50;
  margin-bottom: 1.5rem;
  font-size: 1.3rem;
  text-align: center;
}

.tradition-content h4 {
  color: var(--secondary-color, #ff6b35);
  margin: 1.5rem 0 0.75rem 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.tradition-content p {
  color: #6c757d;
  line-height: 1.6;
  margin-bottom: 1rem;
}

/* Timeline CTA */
.timeline-cta {
  text-align: center;
  margin-top: 3rem;
  padding: 2rem 0;
}

.timeline-cta .btn {
  background: var(--secondary-color, #ff6b35);
  color: white;
  padding: 15px 30px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1.1rem;
  text-decoration: none;
  transition: all 0.3s ease;
  display: inline-block;
  border: none;
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.timeline-cta .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
  color: white;
}

@media (max-width: 1050px) {
  body {
    height: auto;
    display: block;
  }
  .timeline-container {
    flex-direction: column;
    height: auto;
    width: 100%;
    padding: 100px 0px;
  }

  .timeline-point {
    height: 134px;
    flex-shrink: 0;
    left: calc(-321px / 2);
    margin: 0px auto;
    position: relative;
  }

  .timeline-point:nth-child(odd)::before {
    transform: rotate(0deg);
  }

  .timeline-point:nth-child(even)::before {
    transform: rotate(0deg) scaleX(-1);
  }

  .timeline-point .popup:before {
    display: none;
  }

  .timeline-point:nth-child(odd) .popup {
    bottom: auto;
    right: -370.1px;
  }

  .timeline-point:nth-child(even) .popup {
    top: auto;
    right: -370.1px;
  }
}
