* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  -webkit-text-size-adjust: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  padding-top: 6rem;
  padding: 2rem;
}

.timeline-container {
  width: 100%;
  max-width: 1100px;
  padding-top: 6rem;
}

h1 {
  text-align: center;
  font-size: 3.5rem;
  margin-bottom: 14rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #f1f5f9;
  animation: flourishIn 1.2s cubic-bezier(0.22, 1, 0.36, 1) both;
  filter: drop-shadow(0 0 16px rgba(148, 163, 184, 0.15));
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes flourishIn {
  0% {
    opacity: 0;
    letter-spacing: 0.3em;
    transform: translateY(-20px) scale(0.9);
    filter: drop-shadow(0 0 0 rgba(148, 163, 184, 0)) blur(8px);
  }
  60% {
    opacity: 1;
    transform: translateY(4px) scale(1.02);
  }
  100% {
    opacity: 1;
    letter-spacing: 0.05em;
    transform: translateY(0) scale(1);
    filter: drop-shadow(0 0 16px rgba(148, 163, 184, 0.15)) blur(0);
  }
}

.mobile-hint {
  display: none;
}

.mobile-chevrons {
  display: none;
}

.timeline {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 1rem;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #7dd3fc, #38bdf8, #0ea5e9, transparent);
  transform: translateY(-50%);
  z-index: 0;
}

.timeline-item {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
}

.timeline-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #7dd3fc;
  border: 3px solid #0f172a;
  box-shadow: 0 0 0 3px #7dd3fc;
  transition: transform 0.3s, box-shadow 0.3s;
}

.timeline-item:nth-child(2) .timeline-dot {
  background: #38bdf8;
  box-shadow: 0 0 0 3px #38bdf8;
}

.timeline-item:nth-child(3) .timeline-dot {
  background: #0ea5e9;
  box-shadow: 0 0 0 3px #0ea5e9;
}

.timeline-item:nth-child(4) .timeline-dot {
  background: #0284c7;
  box-shadow: 0 0 0 3px #0284c7;
}

.timeline-item:nth-child(5) .timeline-dot {
  background: #0369a1;
  box-shadow: 0 0 0 3px #0369a1;
}

.timeline-item:hover .timeline-dot {
  transform: scale(1.4);
}

.timeline-item:hover {
  z-index: 100;
}

.timeline-tooltip {
  position: absolute;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #cbd5e1;
  white-space: normal;
  width: max-content;
  max-width: 400px;
  display: none;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  text-align: left;
}

.timeline-item:nth-child(odd) .timeline-tooltip {
  top: calc(100% + 1.5rem);
}

.timeline-item:first-child .timeline-tooltip {
  left: 0;
}

.timeline-item:nth-child(even) .timeline-tooltip {
  bottom: calc(100% + 1.5rem);
}

.timeline-item:hover .timeline-tooltip {
  display: block;
}

.timeline-content {
  position: absolute;
  text-align: center;
  white-space: nowrap;
  transition: transform 0.3s;
}

.timeline-item:nth-child(odd) .timeline-content {
  bottom: calc(100% + 1.5rem);
}

.timeline-item:nth-child(even) .timeline-content {
  top: calc(100% + 1.5rem);
}

.timeline-item:hover .timeline-content {
  transform: translateY(-3px);
}

.timeline-item:nth-child(even):hover .timeline-content {
  transform: translateY(3px);
}

.timeline-years {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  margin-top: 0.3rem;
  color: #94a3b8;
}

.timeline-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: #f1f5f9;
}

.timeline-sub {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.25rem;
  line-height: 1.5;
}

.timeline-logo {
  height: 28px;
  width: auto;
  margin-bottom: 0.2rem;
  opacity: 0.85;
  filter: brightness(0) invert(1);
  transition: opacity 0.3s;
}

.timeline-logo-lg {
  height: 42px;
}

.timeline-item:hover .timeline-logo {
  opacity: 1;
}

.timeline-chevrons {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  margin-left: -0.5rem;
}

.resume-dropdown {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
}

.pdf-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: background 0.2s;
}

.pdf-btn:hover {
  background: #334155;
}

.dropdown-chevron {
  transition: transform 0.2s;
}

.resume-dropdown.open .dropdown-chevron {
  transform: rotate(180deg);
}

.resume-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  overflow: hidden;
  min-width: 100%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.resume-dropdown.open .resume-dropdown-menu {
  display: block;
}

.resume-dropdown-menu button {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: #cbd5e1;
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}

.resume-dropdown-menu button:hover {
  background: #334155;
}

.pdf-hint {
  position: fixed;
  top: 3.6rem;
  right: 3rem;
  z-index: 999;
  pointer-events: none;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  transform: rotate(-4deg);
  transform-origin: bottom left;
}

.pdf-hint span {
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  color: #64748b;
  margin-bottom: 4px;
  white-space: nowrap;
}

@media print {
  .resume-dropdown { display: none; }
  .pdf-hint { display: none; }
}

@media (max-width: 768px) {
  .pdf-hint { display: none; }
}

@media (max-width: 768px) {
  body {
    padding: 1.5rem;
  }

  .timeline-container {
    padding-top: 2rem;
  }

  h1 {
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
  }

  .mobile-hint {
    display: block;
    text-align: center;
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 2.5rem;
  }

  .timeline {
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 0;
    padding: 0 0 0 2rem;
  }

  .timeline::before {
    top: 0;
    bottom: 0;
    left: 2rem;
    right: auto;
    width: 2px;
    height: 100%;
    transform: none;
    background: linear-gradient(180deg, #0369a1, #0ea5e9, #7dd3fc);
  }

  .timeline-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 1.25rem 0 1.25rem 1.5rem;
    position: relative;
  }

  .timeline-dot {
    position: absolute;
    left: -1.5rem;
    top: 1.4rem;
    transform: translateX(-55%);
    width: 14px;
    height: 14px;
  }

  .timeline-content {
    position: static;
    text-align: left;
    white-space: normal;
  }

  .timeline-item:nth-child(odd) .timeline-content,
  .timeline-item:nth-child(even) .timeline-content {
    top: auto;
    bottom: auto;
  }

  .timeline-item:nth-child(even) .timeline-years {
    order: 0;
    margin-top: 0.3rem;
    margin-bottom: 0;
  }

  .timeline-item:hover .timeline-content,
  .timeline-item:nth-child(even):hover .timeline-content {
    transform: none;
  }

  .timeline-item:hover .timeline-dot {
    transform: translateX(-50%) scale(1.3);
  }

  .timeline-logo {
    height: 22px;
  }

  .timeline-label {
    font-size: 1rem;
  }

  .timeline-sub {
    font-size: 0.8rem;
  }

  .timeline-tooltip,
  .timeline-item:nth-child(odd) .timeline-tooltip,
  .timeline-item:nth-child(even) .timeline-tooltip {
    position: static;
    display: none;
    margin-top: 0.5rem;
    width: auto;
    max-width: 100%;
  }

  .timeline-item:hover .timeline-tooltip {
    display: block;
  }

  .timeline-chevrons {
    display: none;
  }

  .mobile-chevrons {
    display: flex;
    justify-content: flex-start;
    padding-left: calc(2rem - 11px);
    margin-bottom: 0;
  }

  .timeline-item .timeline-content[style] {
    left: auto !important;
    transform: none !important;
  }

  .timeline-item:last-of-type {
    align-items: flex-start;
  }

}

/* Fork items - personal milestones */

/* Hide the real dot — SVG circle at the fork endpoint replaces it */
.timeline-item.timeline-fork .timeline-dot {
  opacity: 0;
  pointer-events: none;
}

/* Content anchored below the bend dot; depth and x-offset vary per item */
.timeline-item.timeline-fork .timeline-content {
  top: calc(50% + var(--fork-depth) * 1px + 18px);
  bottom: auto;
  left: calc(50% + var(--fork-x, 14) * 1px);
  transform: translateX(-50%);
}

.timeline-item.timeline-fork:hover .timeline-content {
  transform: translateX(-50%) translateY(3px);
}

.timeline-item.timeline-fork .timeline-tooltip {
  top: calc(50% + var(--fork-depth) * 1px + 64px);
  bottom: auto;
  left: calc(50% + var(--fork-x, 14) * 1px);
  transform: translateX(-50%);
}

.timeline-item.timeline-fork::after {
  content: none;
}

/* SVG positioned so its (0,0) aligns with the junction on the main line.
   Width/height are set dynamically by JS based on forkDepth. */
.timeline-fork-svg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-2px, -2px);
  overflow: visible;
  z-index: 2;
  pointer-events: none;
}

/* Horizontal arm extending from the bend dot to the right edge of the timeline */
.fork-arm {
  position: absolute;
  height: 24px;
  right: 1rem;
  overflow: visible;
  z-index: 1;
  pointer-events: none;
}

.fork-arm::before {
  content: '';
  position: absolute;
  left: 0;
  right: 44px;
  height: 2.5px;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(90deg, var(--fork-color, #38bdf8), var(--fork-color-alpha, rgba(56, 189, 248, 0.6)));
  border-radius: 2px;
}

.fork-arm-chevrons {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

/* Mobile fork arm — L-shaped branch (right then up) */
.fork-arm-mobile {
  position: absolute;
  pointer-events: none;
  z-index: 2;
}

.fork-arm-mobile-label {
  position: absolute;
  top: 0;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 2px;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .timeline-fork-svg {
    display: none;
  }

  /* Restore real dot on mobile since SVG is hidden */
  .timeline-item.timeline-fork .timeline-dot {
    opacity: 1;
    background: var(--fork-color, #38bdf8);
    box-shadow: 0 0 0 3px var(--fork-color, #38bdf8);
  }

  /* Hide inline content — label/year shown on the branch arm instead */
  .timeline-item.timeline-fork .timeline-content {
    display: none;
  }

  .timeline-item.timeline-fork .timeline-tooltip {
    transform: none;
  }

  /* Remove the small bar stub — mobile arm handles the branch */
  .timeline-item.timeline-fork::after {
    content: none;
  }
}
