/* The timeline sheet and the deadline runway strip. Stream G.
   Colours come from tokens.css only. Positions of marks are inline
   percentages from js/lib-timeline/model.js; this file only gives them a
   look. Status is never colour alone: bands are hatched, diamonds are filled
   or hollow, and every row says its status in words. */

/* --- Timeline ----------------------------------------------------------------- */

.tl { --lab-w: 200px; --row-h: 68px; display: flex; flex-direction: column; gap: 10px; height: 100%; min-height: 0; min-width: 0; }


/* Status colour for a row, a band or a diamond. */
.tl [data-status="drafting"] { --c: var(--pin-drafting); }
.tl [data-status="submitted"] { --c: var(--pin-submitted); }
.tl [data-status="waitlisted"] { --c: var(--st-waitlisted-fg); }
.tl [data-status="accepted"], .tl [data-status="delivered"] { --c: var(--pin-accepted); }
.tl [data-status="rejected"] { --c: var(--urgent); }
.tl [data-status="withdrawn"], .tl [data-status="none"] { --c: var(--muted); }
.tl [data-status="saved"] { --c: var(--pin-saved); }

.tl-bar { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 12px; }
.tl-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.tl-seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--ground); border-radius: 10px; }
.tl-seg[hidden], .tl-seg button[hidden] { display: none; }
.tl-seg button { border: 0; background: transparent; border-radius: 8px; color: var(--muted); padding: 0 12px; min-width: 44px; }
.tl-seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: inset 0 -3px 0 var(--accent); }

.tl-legend { border: 1px solid var(--line); border-radius: var(--radius); font-size: .85rem; }
.tl-legend[open] { flex-basis: 100%; order: 4; }
.tl-legend summary { min-height: 44px; display: flex; align-items: center; padding: 0 14px; cursor: pointer; }
.tl-legend ul { list-style: none; margin: 0; padding: 0 14px 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 16px; }
.tl-legend li { display: flex; align-items: center; gap: 10px; }

.tl-conflicts[hidden] { display: none; }
.tl-conflicts:has(details[open]) { flex-basis: 100%; order: 3; }
.tl-conflict-box { border: 1px solid var(--line); border-left: 4px solid var(--urgent); border-radius: var(--radius); padding: 0 12px; font-size: .9rem; }
.tl-conflict-box summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }
.tl-conflict-box ul { list-style: none; margin: 0; padding: 0 0 6px; display: grid; }
.tl-linkish { min-height: 44px; border: 0; background: transparent; color: var(--accent); text-align: left; padding: 4px 0; text-decoration: underline; }

/* The chart scrolls inside this box, both ways; nothing else on the page does. */
.tl-scroll { position: relative; flex: 1 1 260px; min-height: 200px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overscroll-behavior: contain; }
.tl-grid { position: relative; min-width: calc(var(--lab-w) + var(--lane-min, 600px) + 16px); }

.tl-axis, .tl-row { display: grid; grid-template-columns: var(--lab-w) minmax(var(--lane-min, 600px), 1fr); }
.tl-axis { position: sticky; top: 0; z-index: 6; height: 40px; background: var(--surface); border-bottom: 1px solid var(--line); }
.tl-axis-lab { position: sticky; left: 0; z-index: 7; display: flex; align-items: center; padding: 0 10px; background: var(--surface); color: var(--muted); font-size: .75rem; border-right: 1px solid var(--line); }
.tl-axis-lane, .tl-axis .tl-plot { height: 100%; }
.tl-tick { position: absolute; top: 4px; height: 16px; padding-left: 3px; border-left: 1px solid var(--muted); font: 500 12px/16px var(--font-mono); color: var(--muted); white-space: nowrap; }
.tl-today-label { position: absolute; top: 22px; height: 14px; padding-left: 4px; border-left: 2px solid var(--accent); font: 500 12px/14px var(--font-mono); color: var(--accent); white-space: nowrap; }

/* Gridlines, today and the too-late zone sit under the rows' marks. */
.tl-overlay { position: absolute; top: 0; bottom: 0; left: var(--lab-w); right: 0; z-index: 1; pointer-events: none; }
.tl-overlay .tl-plot { position: absolute; inset: 0 16px 0 0; margin: 0; height: auto; }
.tl-grid-line { position: absolute; top: 40px; bottom: 0; width: 1px; background: var(--line); }
.tl-today { position: absolute; top: 40px; bottom: 0; width: 2px; margin-left: -1px; background: var(--accent); }
.tl-late {
  position: absolute; top: 40px; bottom: 0; pointer-events: auto;
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--urgent) 22%, transparent) 0 1px, transparent 1px 7px), color-mix(in srgb, var(--urgent) 6%, transparent);
}

.tl-group-head { position: relative; z-index: 2; background: var(--ground); border-bottom: 1px solid var(--line); }
.tl-group-head h3 { position: sticky; left: 0; display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 8px 12px; font-size: .9rem; }
.tl-count { font: 500 .75rem var(--font-mono); padding: 0 8px; border-radius: 999px; background: var(--accent-tint); color: var(--accent); }
.tl-empty { position: sticky; left: 0; z-index: 2; width: max-content; max-width: min(34ch, calc(100vw - 80px)); margin: 0; padding: 12px; background: var(--surface); font-size: .9rem; }

.tl-rows { list-style: none; margin: 0; padding: 0; }
.tl-pick {
  position: sticky; left: 0; z-index: 3; display: block; width: 100%; height: var(--row-h); min-height: 44px; margin: 0; padding: 5px 8px 5px 10px;
  text-align: left; background: var(--surface); border: 0; border-left: 4px solid var(--c, var(--line)); border-bottom: 1px solid var(--line); border-radius: 0;
}
.tl-pick:hover { background: var(--accent-tint); border-color: var(--line); border-left-color: var(--c, var(--line)); }
.tl-row[data-selected="true"] .tl-pick { background: var(--accent-tint); box-shadow: inset 0 0 0 2px var(--accent); }
.tl-pick:focus-visible { outline-offset: -3px; }
.tl-name, .tl-sub { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.tl-name { -webkit-line-clamp: 2; font-weight: 600; font-size: .85rem; line-height: 1.25; }
.tl-sub { -webkit-line-clamp: 2; margin-top: 1px; color: var(--muted); font-size: .75rem; line-height: 1.25; }
.tl-warn { position: absolute; top: 3px; right: 6px; color: var(--urgent); font-size: .9rem; line-height: 1; }
.tl-pick.has-warn .tl-name { padding-right: 18px; }

.tl-lane { position: relative; z-index: 2; height: var(--row-h); border-bottom: 1px solid var(--line); }
.tl-row[data-selected="true"] .tl-lane { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.tl-plot { position: relative; height: 100%; margin-right: 16px; }

/* Marks. Vertical places in the 68 px row, one track each: reminders 3-16,
   the CFP bar 20-30 (its closing date is printed to its right), the event
   33-47, submissions 51-62. */
.tl-cfp {
  position: absolute; top: 21px; height: 10px; min-width: 8px; box-sizing: border-box;
  border: 1.5px solid var(--accent); border-radius: 5px;
  background: color-mix(in srgb, var(--accent) 30%, var(--surface));
}
.tl-cfp::after { content: ''; position: absolute; right: -2px; top: -4px; bottom: -4px; width: 3px; border-radius: 1px; background: var(--accent); }
.tl-cfp.is-closed { border-style: dashed; border-color: var(--muted); background: transparent; }
.tl-cfp.is-closed::after { background: var(--muted); }
.tl-cfp.is-future { background: var(--surface); }
.tl-cfp.clip-l { border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.tl-cfp.clip-l::before { content: '‹'; position: absolute; left: 2px; top: -7px; font: 600 18px/1 var(--font-sans); color: var(--accent); }
.tl-cfp.clip-r { border-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.tl-cfp.clip-r::after { display: none; }
.tl-cap { position: absolute; left: calc(100% + 6px); top: -3px; font: 500 12px/16px var(--font-mono); color: var(--text); white-space: nowrap; }
.tl-cap.flip { left: auto; right: calc(100% + 6px); }
.tl-cap.urgent { color: var(--urgent); font-weight: 700; }
.tl-cap.soon { color: var(--soon); font-weight: 700; }

.tl-event { position: absolute; top: 33px; height: 14px; box-sizing: border-box; border-radius: 7px; background: var(--text); }
.tl-row[data-status="accepted"] .tl-event, .tl-row[data-status="delivered"] .tl-event { background: var(--pin-accepted); }
.tl-event.clip-l { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.tl-event.clip-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }

.tl-band {
  position: absolute; box-sizing: border-box; border: 1px solid var(--c); border-radius: 2px;
  background: repeating-linear-gradient(135deg, var(--c) 0 2px, transparent 2px 6px), color-mix(in srgb, var(--c) 12%, transparent);
}
.tl-band.is-waiting { -webkit-mask-image: linear-gradient(to right, #000 55%, transparent); mask-image: linear-gradient(to right, #000 55%, transparent); }
.tl-band.is-overdue { border-style: dashed; }

.tl-dia { position: absolute; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; box-sizing: border-box; transform: rotate(45deg); background: var(--c); border: 2px solid var(--c); }
.tl-dia.is-expected { background: var(--surface); }
.tl-dia.is-organizer { background: var(--surface); border-style: dashed; border-color: var(--muted); }

.tl-rem { position: absolute; top: 3px; width: 2px; height: 13px; margin-left: -1px; background: var(--soon); }
.tl-rem::after { content: ''; position: absolute; left: 2px; top: 0; width: 8px; height: 6px; background: var(--soon); }

/* Each chip sits on the track of the mark it stands for, so it covers nothing else. */
.tl-edge {
  position: absolute; top: 25px; z-index: 2; transform: translateY(-50%); max-width: 70%; padding: 2px 8px; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted);
  font: 500 12px/1.4 var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tl-edge[data-kind="event"] { top: 40px; }
.tl-edge[data-kind="decision"], .tl-edge[data-kind="band"] { top: 57px; }
.tl-edge[data-kind="reminder"] { top: 9px; }
.tl-edge-l { left: 4px; }
.tl-edge-r { right: -12px; }

.tl-notes { margin: 0; font-size: .8rem; }
.tl-notes[hidden] { display: none; }

/* Details of the selected row, under the chart so it never scrolls away. */
.tl-detail { flex: none; max-height: 36%; overflow: auto; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.tl-d-grab { display: none; }
.tl-hint { margin: 0; font-size: .85rem; }
.tl-d-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; }
.tl-d-head h3 { margin: 0; font-size: 1rem; }
.tl-d-head p { margin: 0; font-size: .85rem; }
.tl-d-list, .tl-d-conflicts { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; font-size: .85rem; }
.tl-d-conflicts { color: var(--urgent); font-weight: 600; }
.tl-d-list li { display: flex; align-items: flex-start; gap: 10px; }
.tl-d-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tl-btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--accent); text-decoration: none; font-weight: 600; font-size: .9rem;
}
.tl-btn:hover { border-color: var(--accent); }
.tl-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* Little keys in the details list and the legend: the same shapes as the marks. */
.tl-kind { position: relative; flex: none; width: 18px; height: 18px; margin-top: 1px; }
.tl-kind::before { content: ''; position: absolute; box-sizing: border-box; }
.tl-kind-cfp::before { left: 0; top: 5px; width: 18px; height: 8px; border: 1.5px solid var(--accent); border-radius: 4px; background: color-mix(in srgb, var(--accent) 30%, var(--surface)); }
.tl-kind-band::before { left: 0; top: 5px; width: 18px; height: 8px; border: 1px solid var(--c); background: repeating-linear-gradient(135deg, var(--c) 0 2px, transparent 2px 6px); }
.tl-kind-decision::before { left: 4px; top: 4px; width: 10px; height: 10px; transform: rotate(45deg); border: 2px solid var(--c); background: var(--c); }
.tl-kind-event::before { left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text); }
.tl-kind-reminder::before { left: 4px; top: 2px; width: 2px; height: 14px; background: var(--soon); }
.tl-kind-reminder::after { content: ''; position: absolute; left: 6px; top: 2px; width: 8px; height: 6px; background: var(--soon); }

.tl-sw { position: relative; flex: none; width: 64px; height: 22px; }
.tl-sw > * { position: absolute; }
.sw-cfp .tl-cfp { left: 2px; width: 28px; top: 6px; }
.sw-cfp-clip .tl-cfp { left: 2px; width: 28px; top: 6px; }
.sw-band .tl-band { left: 2px; width: 56px; top: 7px; height: 8px; }
.sw-dia .tl-dia { left: 32px; top: 11px; }
.sw-event .tl-event { left: 25px; top: 4px; }
.sw-rem .tl-rem { left: 32px; top: 3px; }
.sw-today .tl-today { left: 32px; top: 0; bottom: 0; }
.sw-late .tl-late { left: 2px; width: 60px; top: 0; bottom: 0; }
.tl-edge-sample, .tl-warn-sample { left: 2px; top: 2px; font: 500 12px/18px var(--font-mono); color: var(--muted); white-space: nowrap; }
.tl-warn-sample { left: 24px; color: var(--urgent); font-size: 14px; }

/* Phone: a narrower name column, shorter button labels, more room for the chart. */
@media (max-width: 599px) {
  .tl { --lab-w: 124px; }
  .tl-long { display: none; }
  .tl-seg button { padding: 0 8px; }
}

/* The sheet is full-screen below 900 px. The timeline fills it and nothing
   around the chart scrolls: only the chart does, in both directions, and the
   details are a drawer under it that the bar at its top opens. */
@media (max-width: 899px) {
  #sheet-body:has(.tl) { overflow: hidden; padding: 10px 12px; }
  .tl { gap: 8px; }
  .tl-scroll { flex: 1 1 0; min-height: 0; }
  .tl-detail { max-height: 45%; padding: 0 14px 10px; border-radius: 12px 12px 0 0; box-shadow: var(--shadow); }
  .tl-detail[data-empty="true"] { display: none; }
  .tl-d-grab { display: grid; place-items: center; width: calc(100% + 28px); min-height: 28px; margin: 0 -14px; padding: 0; border: 0; border-radius: 12px 12px 0 0; background: transparent; }
  .tl-d-bar { width: 40px; height: 4px; border-radius: 2px; background: var(--handle); }
  /* Closed: the title and where it is. Open: every date and the buttons. */
  .tl-detail[data-open="false"] { overflow: hidden; }
  .tl-detail[data-open="false"] .tl-d-actions, .tl-detail[data-open="false"] .tl-d-list, .tl-detail[data-open="false"] .tl-d-conflicts { display: none; }
}

/* --- Runway ---------------------------------------------------------------------- */

.rw { height: 100%; min-width: 0; }
.rw-plot { position: relative; height: 100%; overflow: hidden; }
.rw-late {
  position: absolute; top: 4px; bottom: 17px;
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--urgent) 22%, transparent) 0 1px, transparent 1px 6px), color-mix(in srgb, var(--urgent) 6%, transparent);
}
.rw-tick { position: absolute; top: 4px; bottom: 17px; width: 1px; background: var(--line); }
.rw-tick-label, .rw-today-label { position: absolute; bottom: 1px; padding-left: 3px; font: 500 12px/15px var(--font-mono); color: var(--muted); white-space: nowrap; }
.rw-today { position: absolute; top: 2px; bottom: 15px; width: 2px; margin-left: -1px; background: var(--accent); }
.rw-today-label { padding-left: 4px; color: var(--accent); }
.rw-note { position: absolute; top: 1px; right: 10px; font-size: 11px; line-height: 13px; color: var(--muted); white-space: nowrap; background: var(--surface); }
.rw-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; font-size: .85rem; }

.rw-dot {
  position: absolute; width: 12px; height: 12px; min-height: 0; margin: 0 0 0 -6px; padding: 0; box-sizing: border-box;
  border: 2px solid var(--c, var(--text)); border-radius: 50%; background: var(--c, var(--text)); cursor: pointer;
}
.rw-dot::after { content: ''; position: absolute; inset: -7px; } /* a bigger target than the dot */
.rw-dot:hover { border-color: var(--c, var(--text)); transform: scale(1.3); }
.rw-dot.ring { background: var(--surface); }
.rw-square { border-radius: 2px; }
.rw-diamond { transform: rotate(45deg) scale(.85); border-radius: 1px; }
.rw-diamond:hover { transform: rotate(45deg) scale(1.15); }
.rw-triangle { border: 0; border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.rw-triangle:focus-visible { clip-path: none; }
.rw-dot.is-dim { opacity: .4; }
.rw-dot.is-selected { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The dated list: one line per date that matters, grouped by how soon. */
.ag { display: grid; gap: 14px; min-width: 0; padding-bottom: 12px; }
.ag[hidden], .tl-today-btn[hidden] { display: none; }
.ag-group h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: .95rem; }
.ag-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ag-item {
  display: grid; grid-template-columns: 5.2rem minmax(0, 1fr); gap: 10px; padding: 10px 10px 10px 12px;
  border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px; background: var(--surface);
}
.ag-deadline { border-left-color: var(--soon); }
.ag-decision { border-left-color: var(--pin-submitted); }
.ag-speaking { border-left-color: var(--st-accepted-fg); }
.ag-event { border-left-color: var(--line); border-left-style: dashed; }
.ag-item.is-overdue { border-left-color: var(--urgent); }
.ag-date { display: grid; align-content: start; gap: 2px; }
.ag-day { font-weight: 600; font-size: .9rem; }
.ag-rel { color: var(--muted); font-size: .8rem; }
.ag-body { display: grid; gap: 3px; min-width: 0; }
.ag-name { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.ag-what { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: .9rem; }
.ag-kind { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.ag-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ag-warn { color: var(--urgent); font-size: .85rem; font-weight: 600; }
.tl-today-btn { min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); }
/* The list is the scroller inside the .tl column, like the chart's own box. */
.ag { flex: 1 1 0; min-height: 0; overflow: auto; overscroll-behavior: contain; }

/* On a phone the chart's controls are two rows, not three: view and scope, then
   zoom, Today and the legend. */
@media (max-width: 899px) {
  .tl-seg button { padding: 0 8px; }
  .tl-today-btn { padding: 0 8px; }
  .tl-legend summary { padding: 0 10px; }
  .tl-controls { gap: 6px; }
}
