/* Timeline: a marker on a line for each event, its title, time and description beside it
   (vertical) or under it (horizontal). Status colours the steps of a process: complete and
   current solid, upcoming hollow. */

@layer runeui.components {
  [data-slot="timeline"] { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }

  [data-slot="timeline-item"] {
    --marker: 1.5rem;
    position: relative;
    display: grid;
    grid-template-columns: var(--marker) 1fr;
    column-gap: 0.75rem;
    padding-bottom: 1.5rem;
    border-radius: var(--ui-radius-sm);
    outline: none;
  }

  [data-slot="timeline-item"][data-last] { padding-bottom: 0; }
  [data-slot="timeline-item"]:focus-visible { box-shadow: var(--ui-focus-ring); }

  [data-slot="timeline-marker"] {
    z-index: 1;
    display: grid;
    grid-column: 1;
    grid-row: 1;
    place-items: center;
    width: var(--marker);
    height: var(--marker);
    border: 1px solid var(--border);
    border-radius: var(--ui-radius-full);
    background: var(--background);
    color: var(--muted-foreground);
  }

  [data-slot="timeline-marker"]:empty::after { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--muted-foreground); }
  [data-slot="timeline-marker"] .ui-icon { width: 0.875rem; height: 0.875rem; }
  [data-slot="timeline-marker"]:is([data-complete], [data-current]) { border-color: var(--primary); background: var(--primary); color: var(--primary-foreground); }
  [data-slot="timeline-marker"]:is([data-complete], [data-current]):empty::after { background: var(--primary-foreground); }
  [data-slot="timeline-marker"][data-current] { box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 15%, transparent); }
  [data-slot="timeline-marker"][data-upcoming]:empty::after { background: transparent; }

  [data-slot="timeline-connector"] {
    position: absolute;
    top: var(--marker);
    bottom: 0;
    inset-inline-start: calc(var(--marker) / 2 - 0.5px);
    width: 1px;
    background: var(--border);
  }

  [data-slot="timeline-item"][data-last] [data-slot="timeline-connector"] { display: none; }
  [data-slot="timeline-connector"][data-complete] { background: var(--primary); }

  [data-slot="timeline-body"] { display: flex; flex-direction: column; gap: 0.125rem; grid-column: 2; min-width: 0; padding-top: 0.125rem; }
  [data-slot="timeline-title"] { font-weight: 500; line-height: 1.25rem; }
  [data-slot="timeline-time"] { color: var(--muted-foreground); font-size: var(--ui-text-xs); }
  [data-slot="timeline-description"] { color: var(--muted-foreground); font-size: var(--ui-text-sm); }
  [data-slot="timeline-title"][data-upcoming] { color: var(--muted-foreground); font-weight: 400; }

  /* Horizontal: steps across, the line running from each marker to the next. */
  [data-slot="timeline"][data-orientation="horizontal"] { flex-direction: row; width: 100%; }
  [data-slot="timeline"][data-orientation="horizontal"] [data-slot="timeline-item"] { flex: 1; grid-template-columns: 1fr; row-gap: 0.5rem; padding: 0 1rem 0 0; }
  [data-slot="timeline"][data-orientation="horizontal"] [data-slot="timeline-connector"] { top: calc(var(--marker) / 2 - 0.5px); bottom: auto; left: calc(var(--marker) + 0.5rem); right: 0.5rem; width: auto; height: 1px; }
  [data-slot="timeline"][data-orientation="horizontal"] [data-slot="timeline-body"] { grid-column: 1; grid-row: 2; }
}
