﻿/*
    The Gantt chart. Global rather than scoped because the chart lives in this shared library and
    is drawn by pages in both tiers; the `gantt-` prefix keeps it out of everything else's way.

    Bars are positioned in pixels by the component — it owns the calendar maths. This file owns
    everything else.
*/
.gantt {
  border: 1px solid var(--gantt-grid);
  border-radius: var(--btn-radius);
  overflow: hidden;
}
.gantt-empty {
  padding: var(--space-5);
  color: var(--mid);
  font-size: var(--text-sm);
}
.gantt-scroll {
  overflow-x: auto;
  overflow-y: hidden;
}
.gantt-canvas {
  position: relative;
  min-width: 100%;
}
/* One line down the whole chart, drawn under the ruler rather than through it. */
.gantt-today {
  position: absolute;
  top: var(--gantt-header-height);
  bottom: 0;
  width: 0;
  border-left: 1px dashed var(--mint);
  z-index: 2;
  pointer-events: none;
}
.gantt-header {
  display: flex;
  height: var(--gantt-header-height);
  background: var(--gantt-header-bg);
  border-bottom: 1px solid var(--gantt-grid);
  position: sticky;
  top: 0;
  z-index: 3;
}
.gantt-header-label {
  flex: none;
  display: flex;
  align-items: center;
  padding-left: var(--space-3);
  border-right: 1px solid var(--gantt-grid);
  background: var(--gantt-header-bg);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mid);
  position: sticky;
  left: 0;
  z-index: 4;
}
.gantt-header-weeks {
  display: flex;
  flex: 1;
}
.gantt-header-week {
  flex: none;
  box-sizing: border-box;
  border-left: 1px solid var(--gantt-grid);
  padding-left: var(--space-1);
  font-size: 10px;
  line-height: var(--gantt-header-height);
  color: var(--mid);
  white-space: nowrap;
  overflow: hidden;
}
.gantt-row {
  display: flex;
  height: var(--gantt-row-height);
  border-bottom: 1px solid var(--gantt-grid);
}
.gantt-row--child {
  height: 28px;
}
.gantt-row-label {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  box-sizing: border-box;
  padding-right: var(--space-2);
  border-right: 1px solid var(--gantt-grid);
  background: var(--gantt-label-bg);
  position: sticky;
  left: 0;
  z-index: 2;
  font-size: var(--text-sm);
}
.gantt-row--child .gantt-row-label {
  padding-left: 34px;
  font-size: var(--text-xs);
  color: var(--gray-700);
}
.gantt .gantt-row-label .gantt-toggle {
  flex: none;
  width: 16px;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--mint);
  font-size: var(--text-xs);
  cursor: pointer;
}
.gantt .gantt-row-label .gantt-toggle--none {
  cursor: default;
}
.gantt-row-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.gantt .gantt-row-label .gantt-row-name--link {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--mint-dark);
  font-weight: 600;
  font-size: inherit;
  cursor: pointer;
}
.gantt .gantt-row-label .gantt-row-name--link:hover {
  text-decoration: underline;
}
.gantt-row-note {
  flex: none;
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-xs);
  color: var(--muted);
}
/* Week columns drawn behind the bars, so a row reads against the calendar. */
.gantt-row-bars {
  flex: none;
  position: relative;
  background-image: linear-gradient(to right, var(--gantt-grid) 0 1px, transparent 1px);
  background-repeat: repeat-x;
}
.gantt-bar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 12px;
  border-radius: var(--micro-radius);
  background: var(--gantt-track);
  overflow: hidden;
}
.gantt-row--child .gantt-bar {
  height: 10px;
}
/* The program, drawn behind the actual so the slip is visible rather than described. */
.gantt-bar--shadow {
  height: 6px;
  background: var(--gantt-shadow);
  z-index: 0;
}
.gantt-bar--done {
  background: var(--green);
}
.gantt-bar--active {
  background: var(--mint);
}
.gantt-bar--future {
  background: var(--gantt-track);
}
.gantt-bar--blocked {
  background: var(--red);
}
.gantt-bar--hold {
  background: var(--purple);
}
.gantt-bar-fill {
  height: 100%;
  background: var(--mint);
  border-radius: var(--micro-radius) 0 0 var(--micro-radius);
}
.gantt-bar-trailing {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--mid);
  white-space: nowrap;
}
.gantt-bar-trailing--behind {
  color: var(--amber);
  font-weight: 700;
}
.gantt-bar-trailing--ahead {
  color: var(--green);
  font-weight: 700;
}
/* The filter strip above a chart. */
.gantt-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.gantt-filters__spacer {
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--mid);
}
.gantt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-3);
  font-size: var(--text-xs);
  color: var(--mid);
}
.gantt-legend__item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.gantt-legend__swatch {
  width: 14px;
  height: 7px;
  border-radius: var(--micro-radius);
}
/* Fill modifiers. The bar is a neutral track; the fill is what carries meaning, so red stays
   reserved for "there is a definite problem" rather than colouring a whole build. */
.gantt-bar-fill--behind {
  background: var(--amber);
}
.gantt-bar-fill--blocked {
  background: var(--red);
}
/* Dragging. The bar has to keep its own vertical centring while it moves, so the script restates
   both axes of the transform rather than only the horizontal one. */
.gantt-bar--draggable {
  cursor: grab;
  touch-action: none;
}
.gantt-bar--dragging {
  cursor: grabbing;
  z-index: 6;
  overflow: visible;
  box-shadow: 0 0 0 1px var(--mint-dark), 0 2px 6px rgba(0, 0, 0, 0.25);
}
/* How far the bar has been dragged, read off the bar itself rather than a status line elsewhere. */
.gantt-bar--dragging[data-drag-days]::after {
  content: attr(data-drag-days);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: var(--space-2);
  padding: 1px var(--space-1);
  border-radius: var(--micro-radius);
  background: var(--mint-dark);
  color: var(--white);
  font-size: 10px;
  white-space: nowrap;
}
/* More of a shared resource wanted than exists — the bar is outlined rather than recoloured, so it
   keeps saying whatever it already said about progress. */
.gantt-bar--overloaded {
  outline: 2px solid var(--red);
  outline-offset: 1px;
}
.gantt-note--drag {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--mid);
}
/* A finished step. Its dates are fixed, so it is drawn as settled rather than merely coloured —
   flat, slightly inset, and with no grab cursor, so it is obvious why it will not move. */
.gantt-bar--locked {
  cursor: default;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}
.gantt-row-bars .gantt-bar--locked::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0 2px, transparent 2px 5px);
  pointer-events: none;
}
/* Dependency links. Thin and quiet on purpose: a hold point can hold up thirty steps, and thirty
   heavy lines would bury the bars they are about. */
.gantt-links {
  position: absolute;
  top: 0;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
}
.gantt-link {
  fill: none;
  stroke: var(--mid);
  stroke-width: 1;
  opacity: 0.35;
}