/* Timeline — a trajectory plot. Gantt rows as vector segments,
   markers as telemetry gridlines. Inherits the observatory system. */

.timeline-page { padding: 64px 48px 96px; }
.timeline-head { margin-bottom: 40px; }

.timeline-mobile { display: none; }

.timeline-container {
  display: grid;
  grid-template-columns: 320px minmax(400px, 1fr) 220px;
  gap: 0;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  min-height: 400px;
  overflow: hidden;
}

/* ---- task pane (left) ---- */
.task-pane { border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.task-header {
  display: grid; grid-template-columns: 24px 1fr 90px;
  gap: 8px;
  align-items: center;
  padding: 0 18px;
  height: 56px; /* must match .gantt-header so rows line up */
  font-family: var(--font-mono);
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--ink-mute);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--line);
}
.task-list { flex: 1; }
.task-row {
  display: grid; grid-template-columns: 24px 1fr 90px;
  gap: 8px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  align-items: center;
  min-height: 37px;
}
.task-row.is-group {
  font-weight: 500;
  background: var(--bg-raised);
  letter-spacing: 0.01em;
}
.task-row.is-subtask .task-name { color: var(--ink-soft); font-size: 13px; }
.task-name { overflow: hidden; min-width: 0; }
.task-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-check-cell { display: flex; align-items: center; justify-content: center; }

.task-check {
  appearance: none;
  width: 16px; height: 16px;
  border: 1px solid var(--line-bright);
  background: var(--bg);
  border-radius: 2px;
  padding: 0;
  cursor: pointer;
  color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), color 0.3s var(--ease);
}
.task-check svg { width: 11px; height: 11px; display: block; }
.task-check:hover:not(.readonly) { border-color: var(--accent-dim); }
.task-check.checked {
  background: rgba(236, 202, 140, 0.16);
  border-color: var(--accent-dim);
  color: var(--accent);
}
.task-check.readonly { cursor: default; opacity: 0.4; }
.task-check.readonly:hover { border-color: var(--line-bright); }

.check-attribution {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  margin-top: 3px;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}
.check-attribution[hidden] { display: none; }

.task-status {
  font-family: var(--font-mono);
  font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 3px 9px; border-radius: 2px; text-align: center;
  justify-self: end;
  background: var(--bg-raised); color: var(--ink-mute);
  border: 1px solid var(--line);
}
.task-status.s-done    { color: #8fb89a; border-color: rgba(143, 184, 154, 0.3); }
.task-status.s-active  { color: var(--accent); border-color: var(--accent-deep); }
.task-status.s-pending { color: var(--ink-mute); }
.task-status.s-blocked { color: var(--warn); border-color: rgba(207, 128, 100, 0.34); }

/* ---- gantt pane (middle) ---- */
/* The pane scrolls horizontally; header + rows share an explicit pixel width
   set inline by timeline.js (one column per day). */
.gantt-pane {
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
}
.gantt-header {
  position: relative;
  height: 56px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.gantt-header .month-row,
.gantt-header .day-row {
  position: absolute;
  left: 0; right: 0;
  height: 28px;
}
.gantt-header .month-row { top: 0; border-bottom: 1px solid var(--line); }
.gantt-header .day-row { top: 28px; }
.month-cell {
  position: absolute; top: 0; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-soft);
  border-right: 1px solid var(--line);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.day-cell {
  position: absolute; top: 0; height: 28px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1px;
  border-right: 1px solid var(--line);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.day-cell .dow {
  font-size: 8.5px;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
  opacity: 0.7;
  line-height: 1;
}
.day-cell .dom {
  font-size: 10.5px;
  color: var(--ink-soft);
  line-height: 1;
}
.day-cell.is-weekend .dom,
.day-cell.is-weekend .dow { opacity: 0.45; }
.day-cell.is-today .dom { color: var(--accent); font-weight: 500; }
.day-cell.is-today .dow { color: var(--accent-dim); opacity: 0.9; }

.gantt-body { position: relative; flex: 1; min-height: 0; }
.gantt-rows { position: relative; }
.gantt-row {
  height: 37px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.gantt-row.is-group { background: var(--bg-raised); }

.weekend-stripe {
  position: absolute;
  top: 0; bottom: 0;
  background: rgba(236, 202, 140, 0.022);
  pointer-events: none;
  z-index: 0;
}
.today-line {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px; margin-left: -0.5px;
  background: var(--accent);
  opacity: 0.55;
  pointer-events: none;
  z-index: 2;
}

.bar {
  position: absolute;
  top: 8px; height: 21px;
  border-radius: 2px;
  border-left: 2px solid currentColor;
  cursor: pointer;
  transition: filter 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.bar:hover {
  filter: brightness(1.18);
  box-shadow: 0 0 0 1px currentColor inset;
}
.task-row { cursor: pointer; }
.task-row:hover { background: rgba(236, 202, 140, 0.04); }
.task-row.is-group:hover { background: var(--bg-raised); filter: brightness(1.1); }
.bar.cat-logistics { background: rgba(109, 136, 173, 0.2);  color: #8ba4c6; }
.bar.cat-training  { background: rgba(109, 154, 126, 0.2);  color: #8fb89a; }
.bar.cat-content   { background: rgba(190, 150, 100, 0.2);  color: #cba776; }
.bar.cat-travel    { background: rgba(143, 125, 175, 0.2);  color: #a895c4; }
.bar.cat-prep      { background: rgba(90, 151, 143, 0.2);   color: #79b3aa; }
.bar.s-pending     { opacity: 0.5; }
.bar.s-done        { opacity: 0.78; }
.bar.s-blocked     { background: rgba(207, 128, 100, 0.2) !important; color: var(--warn) !important; }

/* ---- marker overlay — telemetry gridlines ---- */
.marker-layer {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
}
.marker { position: absolute; top: 0; bottom: 0; width: 0; }
.marker-line { position: absolute; top: 0; bottom: 0; width: 1px; margin-left: -0.5px; }
.marker.m-deadline  .marker-line { background: var(--warn); opacity: 0.7; }
.marker.m-milestone .marker-line { background: var(--accent); width: 2px; margin-left: -1px; opacity: 0.8; }
.marker.m-holiday   .marker-line { background: repeating-linear-gradient(0deg, var(--twilight) 0, var(--twilight) 4px, transparent 4px, transparent 9px); width: 1px; }
.marker.m-event     .marker-line { background: var(--accent-dim); opacity: 0.55; }
.marker-cap {
  position: absolute;
  top: 5px; left: 0;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  background: var(--bg-raised);
  border: 1px solid var(--line-bright);
  color: var(--ink-soft);
  font-size: 9px;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 2px;
  white-space: nowrap;
  text-transform: uppercase;
}
.marker.m-deadline  .marker-cap { color: var(--warn); border-color: rgba(207, 128, 100, 0.4); }
.marker.m-milestone .marker-cap { color: var(--accent); border-color: var(--accent-deep); }
.marker.m-holiday   .marker-cap { color: var(--ink-mute); }
.marker.m-event     .marker-cap { color: var(--accent-dim); }

/* ---- legend pane (right) ---- */
.legend-pane {
  border-left: 1px solid var(--line);
  background: var(--bg-raised);
  padding: 18px;
  overflow-y: auto;
}
.legend-pane h3 {
  font-family: var(--font-mono);
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--ink-mute); margin: 0 0 14px;
}
.legend-item {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.legend-item:last-child { border-bottom: none; }
.legend-swatch {
  flex: 0 0 3px;
  height: 24px;
  margin-top: 1px;
}
.legend-swatch.m-deadline  { background: var(--warn); }
.legend-swatch.m-milestone { background: var(--accent); }
.legend-swatch.m-holiday   { background: repeating-linear-gradient(0deg, var(--twilight) 0, var(--twilight) 3px, transparent 3px, transparent 6px); }
.legend-swatch.m-event     { background: var(--accent-dim); }
.legend-meta {
  font-family: var(--font-mono);
  color: var(--ink-mute); font-size: 10.5px; margin-top: 3px;
  font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
}
.legend-label { font-weight: 500; }

.loading {
  font-family: var(--font-mono);
  padding: 28px 0; color: var(--ink-mute); font-size: 12px;
  letter-spacing: 0.1em; text-transform: uppercase;
}

/* ---- mobile cards ---- */
.mobile-markers {
  padding: 18px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  margin-bottom: 36px;
}
.mobile-markers h3 {
  font-family: var(--font-mono);
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--ink-mute); margin: 0 0 14px;
}
.mobile-marker-item {
  display: flex; gap: 11px; align-items: baseline;
  padding: 9px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}
.mobile-marker-item:last-child { border-bottom: none; }
.mobile-marker-item .date {
  font-family: var(--font-mono);
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
  flex: 0 0 88px;
  font-size: 11.5px;
}
.mobile-marker-item .badge {
  font-family: var(--font-mono);
  font-size: 8.5px;
  padding: 2px 6px;
  border-radius: 2px;
  letter-spacing: 0.07em;
  flex: 0 0 auto;
  text-transform: uppercase;
  background: var(--bg-raised);
  border: 1px solid var(--line-bright);
  color: var(--ink-soft);
}
.mobile-marker-item .badge.m-deadline  { color: var(--warn); }
.mobile-marker-item .badge.m-milestone { color: var(--accent); }
.mobile-marker-item .badge.m-holiday   { color: var(--ink-mute); }
.mobile-marker-item .badge.m-event     { color: var(--accent-dim); }
.mobile-marker-item .label { flex: 1; }

.mobile-group-header {
  font-family: var(--font-mono);
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--accent-dim);
  margin: 32px 0 12px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}
.mobile-group-header:first-child { margin-top: 0; }

.mobile-task {
  padding: 14px 16px;
  border: 1px solid var(--line);
  margin-bottom: 8px;
  background: var(--bg-panel);
}
.mobile-task .head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 5px;
}
.mobile-task .head-left {
  display: flex; align-items: center; gap: 10px;
  flex: 1; min-width: 0;
}
.mobile-task .name {
  font-size: 15px; font-weight: 400;
  flex: 1; line-height: 1.35; min-width: 0;
}
.mobile-task .status-pill {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 2px;
  flex: 0 0 auto;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--ink-mute);
}
.mobile-task .status-pill.s-done    { color: #8fb89a; border-color: rgba(143, 184, 154, 0.3); }
.mobile-task .status-pill.s-active  { color: var(--accent); border-color: var(--accent-deep); }
.mobile-task .status-pill.s-pending { color: var(--ink-mute); }
.mobile-task .status-pill.s-blocked { color: var(--warn); border-color: rgba(207, 128, 100, 0.34); }
.mobile-task .dates {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
}
.mobile-task .progress {
  height: 2px;
  background: var(--line);
  margin-top: 10px;
  overflow: hidden;
}
.mobile-task .progress-bar {
  height: 100%;
  background: var(--accent-dim);
  transition: width 0.5s var(--ease);
}
.mobile-task .progress-bar.s-blocked { background: var(--warn); }
.mobile-task .progress-bar.s-done    { background: #8fb89a; }
.mobile-task .progress-bar.s-pending { background: var(--ink-mute); }

@media (max-width: 768px) {
  .timeline-page { padding: 48px 22px 72px; }
  .timeline-container { display: none; }
  .timeline-mobile { display: block; }
}

/* ---- bar hover tooltip ---- */
.bar-tip {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  background: var(--bg-panel);
  border: 1px solid var(--line-bright);
  border-radius: 3px;
  padding: 9px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink);
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.15s var(--ease);
}
.bar-tip.is-visible { opacity: 1; }
.bar-tip .tip-name {
  font-family: var(--font-sans);
  font-size: 13px;
  letter-spacing: 0.005em;
  color: var(--ink);
  margin-bottom: 4px;
}
.bar-tip .tip-meta {
  color: var(--ink-mute);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.bar-tip .tip-meta .sep { padding: 0 6px; color: var(--line-bright); }

/* ---- read-only task detail panel (everyone) ---- */
.detail-backdrop {
  position: fixed; inset: 0;
  z-index: 19;
  background: rgba(5, 7, 11, 0.62);
  -webkit-backdrop-filter: blur(2px);
          backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 32px;
  animation: detail-fade 0.2s var(--ease);
}
@keyframes detail-fade { from { opacity: 0; } to { opacity: 1; } }
.detail-modal {
  background: var(--bg-panel);
  border: 1px solid var(--line-bright);
  border-radius: 4px;
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.detail-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-raised);
}
.detail-kicker {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent-dim);
}
.detail-close {
  background: none; border: 1px solid var(--line-bright);
  color: var(--ink-soft);
  width: 28px; height: 28px; border-radius: 2px;
  font-size: 14px; line-height: 1; cursor: pointer;
}
.detail-close:hover { border-color: var(--accent-deep); color: var(--ink); }
.detail-body { padding: 22px 24px 26px; overflow-y: auto; }
.detail-title { font-size: 20px; font-weight: 400; margin: 0 0 6px; line-height: 1.3; }
.detail-status-row { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.detail-status-row .task-status { justify-self: auto; }
.detail-grid {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 8px 18px;
  margin-bottom: 18px;
}
.detail-grid dt {
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-mute);
  padding-top: 2px;
}
.detail-grid dd {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.detail-section-title {
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-mute);
  margin: 18px 0 8px;
  padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.detail-notes {
  white-space: pre-wrap;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.detail-notes-empty {
  font-family: var(--font-mono);
  font-size: 10.5px; color: var(--ink-mute);
  font-style: italic;
}
.detail-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 22px;
}
.detail-actions .detail-btn {
  background: rgba(236, 202, 140, 0.06);
  border: 1px solid var(--accent-deep);
  color: var(--accent);
  padding: 8px 16px;
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  cursor: pointer;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease);
}
.detail-actions .detail-btn:hover { background: rgba(236, 202, 140, 0.12); border-color: var(--accent); }
