/* Projects Overview
   ========================================================================== */

/* Timeline */
.timeline-container {
  padding-block-end: var(--block-space);
}

.timeline {
  --month-width: 6rem;
  --row-height: 4rem;
  --row-gap: 0.5rem;

  display: grid;
  grid-template-columns: repeat(var(--month-count), var(--month-width));
  min-width: calc(var(--month-count) * var(--month-width));
}

.timeline__header {
  display: contents;
}

.timeline__month-header {
  position: sticky;
  top: 0;
  background: var(--color-bg);
  padding: var(--block-space-half) var(--inline-space-half);
  border-left: 1px dashed var(--color-gray);
  font-size: var(--font-small-responsive);
  font-weight: 500;
  color: var(--color-ink-muted);
  text-align: center;
  z-index: 1;
}

.timeline__month-header--current {
  color: var(--color-ink);
  font-weight: 600;
  background: color-mix(in oklch, var(--color-blue-bright) 8%, var(--color-bg));
}

.timeline__body {
  display: grid;
  grid-template-columns: repeat(var(--month-count), var(--month-width));
  grid-column: 1 / -1;
  gap: var(--row-gap);
  padding-block: var(--block-space-half);
  overflow: visible;
  position: relative;
}

/* Dotted vertical lines at each month boundary - aligned with header borders */
.timeline__body::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: repeating-linear-gradient(
    to right,
    var(--color-gray) 0 1px,
    transparent 1px var(--month-width)
  );
  -webkit-mask-image: repeating-linear-gradient(
    to bottom,
    black 0 3px,
    transparent 3px 6px
  );
  mask-image: repeating-linear-gradient(
    to bottom,
    black 0 3px,
    transparent 3px 6px
  );
}

/* The actual bar for a project */
.timeline__bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--inline-space);
  min-height: var(--row-height);
  border-radius: var(--border-radius);
  text-decoration: none;
  color: var(--color-ink);
  transition: filter 150ms ease;
  overflow: visible;

  &:hover {
    filter: brightness(0.95);
  }
}

.timeline__bar--blue-muted {
  background: oklch(96% 0.01 255);
  border: 1px solid oklch(88% 0.03 255);

  html[data-theme="dark"] & { background: oklch(16% 0.01 255); border-color: oklch(22% 0.03 255); }
  @media (prefers-color-scheme: dark) { html:not([data-theme]) & { background: oklch(16% 0.01 255); border-color: oklch(22% 0.03 255); } }
}

.timeline__bar--blue-light {
  background: oklch(92% 0.03 255);
  border: 1px solid oklch(82% 0.06 255);

  html[data-theme="dark"] & { background: oklch(22% 0.03 255); border-color: oklch(30% 0.06 255); }
  @media (prefers-color-scheme: dark) { html:not([data-theme]) & { background: oklch(22% 0.03 255); border-color: oklch(30% 0.06 255); } }
}

.timeline__bar--blue-vivid {
  background: oklch(80% 0.08 255);
  border: 1px solid oklch(68% 0.12 255);

  html[data-theme="dark"] & { background: oklch(30% 0.06 255); border-color: oklch(40% 0.1 255); }
  @media (prefers-color-scheme: dark) { html:not([data-theme]) & { background: oklch(30% 0.06 255); border-color: oklch(40% 0.1 255); } }
}

.timeline__bar--blue-deep {
  background: oklch(68% 0.12 255);
  border: 1px solid oklch(55% 0.15 255);

  html[data-theme="dark"] & { background: oklch(38% 0.09 255); border-color: oklch(48% 0.12 255); }
  @media (prefers-color-scheme: dark) { html:not([data-theme]) & { background: oklch(38% 0.09 255); border-color: oklch(48% 0.12 255); } }
}

/* Sticky content inside the bar - no vertical padding, just content height */
.timeline__bar-content {
  position: sticky;
  left: 0;
  display: flex;
  align-items: center;
  gap: var(--inline-space);
  padding-inline: var(--inline-space);
  background: inherit;
  z-index: 3;
}

/* Name text - inherits bar background to cover milestone lines */
.timeline__bar-name {
  font-size: var(--font-small-responsive);
  font-weight: 500;
  white-space: nowrap;
  background: inherit;
  padding-inline: 0.3em;
}

.timeline__bar-link {
  color: inherit;
  text-decoration: none;

  &:hover {
    text-decoration: underline;
  }
}

/* Milestones with vertical dotted lines */
.timeline__milestones {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

/* Dotted line - rendered first (behind labels) */
.timeline__milestone-line {
  position: absolute;
  left: var(--milestone-position, 0);
  top: 0;
  bottom: 0;
  border-left: 2px dashed var(--color-gray-dark);
}

/* Label wrapper - rendered second (in front of lines) */
.timeline__milestone-label-wrapper {
  position: absolute;
  left: var(--milestone-position, 0);
  top: 0;
  bottom: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.timeline__milestone-label-wrapper--top {
  justify-content: flex-start;
  padding-top: 0.25rem;
}

.timeline__milestone-label-wrapper--bottom {
  justify-content: flex-end;
  padding-bottom: 0.25rem;
}

/* Milestone label */
.timeline__milestone-label {
  background: var(--color-bg);
  padding: 0.1em 0.4em;
  font-size: 0.55rem;
  font-weight: 500;
  color: var(--color-ink-muted);
  white-space: nowrap;
  border-radius: 0.25em;
  border: 1px solid var(--color-gray);
  pointer-events: auto;

  &:hover {
    color: var(--color-ink);
  }
}

.timeline__card--unscheduled {
  max-width: 32rem;
  border: 2px dashed var(--color-gray);
  border-radius: var(--border-radius);
}

.timeline__card-name {
  font-size: var(--font-small-responsive);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline__unscheduled {
  padding-block-start: var(--block-space);
}
