.timeline-section {
  position: relative;
  overflow: visible;
  padding: 80px 0;
  width: 100%;
  max-width: 100%;
}

input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.cards-container {
  --base-rotation: 0deg;
  --full-circle: 360deg;
  --radius: 40vw;
  --duration: 200ms;
  --cards-container-size: calc(var(--radius) * 2);
  --cards-container-padding: 2rem;
  --border-color: rgba(59, 130, 246, 0.2);
  --label-offset: calc(var(--radius) * -1 - 1rem);
  --label-size: 30px;
  --label-color: var(--muted);
  --label-color-hover: var(--accent);
  --label-line-h: 0;
  --label-line-h-current: 2rem;
  --label-dot-size: 10px;
  --title-top: 1.5rem;
  --title-offset-y: 30px;
  --info-top: 5rem;
  --info-width: min(70%, 500px);
  --info-offset-y: 30px;

  box-sizing: content-box;
  position: relative;
  margin: 5rem auto;
  width: var(--cards-container-size);
  max-width: 100%;
  height: var(--cards-container-size);
  padding: var(--cards-container-padding);
}

@media (min-width: 800px) {
  .cards-container {
    --radius: 30vw;
    --label-size: 40px;
    --label-dot-size: 15px;
    --label-line-h-current: 4rem;
    --title-top: 4rem;
    --info-top: 8rem;
  }
}

@media (min-width: 1200px) {
  .cards-container {
    --label-size: 50px;
    --border-color: var(--label-color);
  }
}

.cards {
  position: absolute;
  inset: var(--cards-container-padding);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  transition: transform 0.3s ease-in-out var(--duration);
  list-style: none;
  margin: 0;
  padding: 0;
}

.cards::before {
  content: '';
  position: absolute;
  inset: -80%;
  background: conic-gradient(
    from var(--glow-angle, 0deg),
    transparent 0%,
    transparent 20%,
    rgba(59, 130, 246, 0.05) 24%,
    rgba(59, 130, 246, 0.15) 27%,
    rgba(59, 130, 246, 0.3) 30%,
    rgba(34, 211, 238, 0.5) 33%,
    rgba(34, 211, 238, 0.6) 35%,
    rgba(34, 211, 238, 0.5) 37%,
    rgba(59, 130, 246, 0.3) 40%,
    rgba(59, 130, 246, 0.15) 43%,
    rgba(59, 130, 246, 0.05) 46%,
    transparent 50%,
    transparent 100%
  );
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  filter: blur(40px);
  opacity: 0.9;
  animation: none;
}

.cards::after {
  content: '';
  position: absolute;
  inset: -60%;
  background: conic-gradient(
    from var(--glow-angle, 0deg),
    transparent 0%,
    transparent 22%,
    rgba(34, 211, 238, 0.05) 26%,
    rgba(34, 211, 238, 0.12) 29%,
    rgba(34, 211, 238, 0.25) 32%,
    rgba(59, 130, 246, 0.4) 34%,
    rgba(59, 130, 246, 0.5) 35%,
    rgba(59, 130, 246, 0.4) 36%,
    rgba(34, 211, 238, 0.25) 38%,
    rgba(34, 211, 238, 0.12) 41%,
    rgba(34, 211, 238, 0.05) 44%,
    transparent 48%,
    transparent 100%
  );
  border-radius: 50%;
  pointer-events: none;
  z-index: -2;
  filter: blur(60px);
  opacity: 0.7;
}

.cards li {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  transform-origin: center;
  display: grid;
  place-content: center;
  transform: rotate(calc(var(--i) * 360deg / var(--items)));
  pointer-events: none;
}

.cards li > label {
  position: absolute;
  inset: 0;
  margin: auto;
  transform: translateY(var(--label-offset));
  width: var(--label-size);
  height: var(--label-size);
  cursor: pointer;
  pointer-events: initial;
  text-align: center;
  color: var(--label-color);
  font-size: clamp(0.8rem, 2.5vw + 0.04rem, 1rem);
  transition: var(--duration) ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cards li > label::before {
  content: '';
  position: absolute;
  top: var(--cards-container-padding);
  left: 50%;
  translate: -50% 0;
  width: var(--label-dot-size);
  height: var(--label-dot-size);
  aspect-ratio: 50%;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  transition: background-color var(--duration) ease-in-out;
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.3);
}

.cards li > label::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  translate: -50% 5px;
  width: 2px;
  height: var(--label-line-h);
  background: linear-gradient(180deg, var(--accent), transparent);
  transition: height 300ms ease-in-out var(--label-line-delay, 0ms);
}

.cards li > label:hover {
  --label-color: var(--label-color-hover);
}

.cards > li > h2,
.cards > li > p {
  position: absolute;
  left: 50%;
  text-align: center;
  transform: translate(-50%, 0);
  transform-origin: center;
}

.cards > li > h2 {
  top: var(--title-top);
  opacity: var(--title-opacity, 0);
  translate: 0 var(--title-offset-y);
  transition: var(--duration) ease-in-out var(--title-delay, 0ms);
  color: var(--accent);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
}

.cards > li > p {
  top: var(--info-top);
  margin: 0 auto;
  width: var(--info-width);
  z-index: 2;
  font-size: clamp(0.8rem, 2.5vw + 0.05rem, 0.9rem);
  text-align: left;
  text-wrap: pretty;
  opacity: var(--info-opacity, 0);
  transition: var(--duration) ease-in-out var(--info-delay, 0ms);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  pointer-events: var(--info-pointer, none);
  line-height: 1.6;
}

.cards > li > p:hover {
  border-color: var(--accent);
  box-shadow: 0 10px 50px rgba(34, 211, 238, 0.3);
}

li:has(input:checked) {
  --label-opacity: 1;
  --label-color: var(--label-color-hover);
  --label-line-h: var(--label-line-h-current);
  --label-line-delay: calc(var(--duration) * 2);
  --title-opacity: 1;
  --title-offset-y: 0;
  --title-delay: calc(var(--duration) * 3);
  --info-opacity: 1;
  --info-offset-y: 0;
  --info-delay: calc(var(--duration) * 4);
  --info-pointer: all;
}

.cards:has(input:checked) {
  transform: rotate(calc(var(--base-rotation) - (var(--index) * var(--full-circle) / var(--items))));
}

.cards:has(li:nth-child(1) > input:checked) { --index: 0; }
.cards:has(li:nth-child(2) > input:checked) { --index: 1; }
.cards:has(li:nth-child(3) > input:checked) { --index: 2; }
.cards:has(li:nth-child(4) > input:checked) { --index: 3; }
.cards:has(li:nth-child(5) > input:checked) { --index: 4; }
.cards:has(li:nth-child(6) > input:checked) { --index: 5; }
.cards:has(li:nth-child(7) > input:checked) { --index: 6; }
.cards:has(li:nth-child(8) > input:checked) { --index: 7; }
.cards:has(li:nth-child(9) > input:checked) { --index: 8; }
.cards:has(li:nth-child(10) > input:checked) { --index: 9; }
.cards:has(li:nth-child(11) > input:checked) { --index: 10; }
.cards:has(li:nth-child(12) > input:checked) { --index: 11; }
.cards:has(li:nth-child(13) > input:checked) { --index: 12; }
.cards:has(li:nth-child(14) > input:checked) { --index: 13; }
.cards:has(li:nth-child(15) > input:checked) { --index: 14; }
.cards:has(li:nth-child(16) > input:checked) { --index: 15; }
.cards:has(li:nth-child(17) > input:checked) { --index: 16; }
.cards:has(li:nth-child(18) > input:checked) { --index: 17; }
.cards:has(li:nth-child(19) > input:checked) { --index: 18; }
.cards:has(li:nth-child(20) > input:checked) { --index: 19; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 18, 32, 0.92);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease;
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.4s ease;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent);
  transform: rotate(90deg);
}

.modal-body {
  padding: 40px;
}

.modal-header {
  display: flex;
  gap: 24px;
  align-items: start;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.modal-company-logo {
  flex-shrink: 0;
}

.modal-company-logo img {
  width: 80px;
  height: 80px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.modal-title-group {
  flex: 1;
}

.modal-role {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.modal-company {
  color: var(--accent);
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 12px;
}

.modal-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.9rem;
}

.modal-description {
  margin-bottom: 32px;
  line-height: 1.8;
  color: var(--muted);
  white-space: pre-line;
}

.modal-description p {
  margin-bottom: 16px;
}

.modal-skills {
  margin-bottom: 32px;
}

.modal-skills h3 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--text);
}

.skills-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-tag {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.8rem;
  color: var(--muted);
  transition: all 0.3s ease;
}

.skill-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(34, 211, 238, 0.1);
}

.modal-extra {
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.modal-extra h3 {
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: var(--accent);
}

.modal-extra-role {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.modal-extra-period {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.modal-extra-description {
  color: var(--muted);
  line-height: 1.7;
  white-space: pre-line;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@media (max-width: 768px) {
  .cards-container {
    --radius: min(35vw, 200px);
    --cards-container-padding: 1rem;
    --label-size: 24px;
    --label-dot-size: 8px;
    --label-line-h-current: 1.5rem;
    --info-width: 85%;
    --title-top: 1rem;
    --info-top: 4rem;
    margin: 3rem auto;
  }

  .cards > li > p {
    padding: 16px;
    font-size: 0.75rem;
  }

  .modal-body {
    padding: 24px;
  }

  .modal-header {
    flex-direction: column;
    gap: 16px;
  }

  .modal-company-logo img {
    width: 60px;
    height: 60px;
  }

  .modal-role {
    font-size: 1.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cards,
  .cards li > label,
  .cards > li > h2,
  .cards > li > p {
    transition: none;
  }
}
