/* Time Lens: the Timeline view (lens-timeline.js). Colours from theme.css tokens only. */

.lens {
  --lens-card-w: 260px;
  --lens-ease: cubic-bezier(0.22, 1, 0.36, 1);

  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 12px;
  cursor: default;
  touch-action: none;
  user-select: none;
}

/* Hidden while another view is shown; stays laid out so labels keep their measured widths */
[data-view="teams"] .lens,
[data-view="classic"] .lens {
  visibility: hidden;
}

@container (max-width: 820px) {
  .lens {
    --lens-card-w: 228px;
  }
}

.lens.is-booting,
.lens.is-booting *,
.lens.is-reacting .ll,
.lens.is-reacting .st,
.lens.is-reacting .nd {
  transition: none !important;
}

.lens.has-focus {
  cursor: ew-resize;
}

.lens.is-dragging {
  cursor: grabbing;
}

/* Reset app.css's global button look; no :hover here, it would outrank the classes below */
.lens button {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
}

.lens-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.lens-labels,
.lens-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Small caps captions, like the controls strip's */
.lens-caption-text {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Grid and axis ── */
.lens .yl {
  stroke: var(--grid);
  stroke-width: 0.6;
}

.lens .ql {
  stroke: var(--grid-soft);
  stroke-width: 0.6;
}

.lens .tk {
  stroke: var(--muted);
  stroke-width: 0.6;
}

.lens .frame {
  stroke: var(--ink);
  stroke-width: 1;
}

.lens .ax {
  font-family: var(--font);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  fill: var(--muted);
}

.lens .ax.is-year {
  fill: var(--ink);
}

/* ── Spine ── */
.lens .ribbon {
  fill: var(--ink);
}

.lens .future {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.lens .ribbon.is-accent {
  fill: var(--accent);
}

.lens .future.is-accent {
  stroke: var(--accent);
  stroke-width: 1.4;
}

.lens .today-line {
  stroke: var(--accent);
  stroke-width: 1;
}

.lens .today-ring {
  fill: var(--page);
  stroke: var(--accent);
  stroke-width: 1.6;
}

.lens .lens-tick {
  stroke: var(--accent);
  stroke-width: 1.4;
}

/* Period window edges: always there, faint; full accent while the badge is hovered */
.lens .period-tick {
  stroke: var(--accent);
  stroke-width: 1.2;
  opacity: 0.45;
  transition: opacity 0.15s ease;
}

.lens .period-tick.is-on {
  opacity: 1;
}

/* Comparison overlap */
.lens .lens-overlap {
  fill: var(--accent-soft);
  pointer-events: none;
}

.lens .lens-overlap-tick {
  stroke: var(--accent);
  stroke-width: 1.6;
}

/* ── Waves ── */
.lens .hatch-line {
  stroke: var(--grid);
  stroke-width: 1;
}

.lens .wb {
  fill: var(--grid-soft);
  cursor: pointer;
  transition: fill 0.15s ease;
}

.lens .wb.is-planned {
  fill: url(#lens-hatch);
}

.lens .wb.is-hot {
  fill: var(--grid);
}

.lens .wb.is-planned.is-hot {
  fill: url(#lens-hatch);
}

.lens .wt {
  stroke: var(--ink);
  stroke-width: 1;
  transition: stroke 0.15s ease;
}

.lens .wt.is-planned {
  stroke-dasharray: 1.5 1.5;
}

.lens .wc {
  stroke: var(--ink);
  stroke-width: 0.6;
}

.lens .wt.is-hot,
.lens .wc.is-hot {
  stroke: var(--accent);
}

.lens .wl {
  position: absolute;
  left: 0;
  top: 0;
  height: 16px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink);
  background: var(--page);
  pointer-events: auto;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.lens .wl.is-hot {
  color: var(--accent);
  background: var(--page);
}

.lens .wl.is-focus {
  background: var(--accent);
  color: var(--accent-ink);
}

.lens .wl:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.lens .wl.is-gone {
  visibility: hidden;
}

/* ── Events: stems, nodes, labels ── */
#lens-events,
#lens-bars {
  transition: opacity 0.35s var(--lens-ease);
}

.lens.mode-bars #lens-events {
  opacity: 0;
}

.lens.mode-labels #lens-bars {
  opacity: 0;
  pointer-events: none;
}

.lens .st {
  stroke: var(--ink);
  stroke-width: 0.7;
  transition: opacity 0.3s var(--lens-ease), stroke 0.15s ease;
}

.lens .nd {
  fill: var(--ink);
  stroke: var(--ink);
  stroke-width: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--lens-ease), fill 0.15s ease, stroke 0.15s ease;
}

.lens .nd.is-out {
  fill: var(--page);
  stroke-width: 1;
}

.lens .nd.is-planned {
  stroke-dasharray: 1.6 1.3;
}

.lens .nd.is-small.is-out {
  stroke-width: 0.8;
}

.lens .nd.is-faded {
  fill: var(--muted);
  stroke: var(--muted);
}

.lens .nd.is-faded.is-out,
.lens .nd.is-accent.is-out {
  fill: var(--page);
}

.lens .nd.is-gone {
  display: none;
}

.lens .st.is-accent {
  stroke: var(--accent);
  stroke-width: 1;
}

.lens .nd.is-accent {
  fill: var(--accent);
  stroke: var(--accent);
}

.lens .st.is-dim,
.lens .nd.is-dim {
  opacity: 0.22;
}

.lens .st.is-off {
  opacity: 0;
}

.lens.has-hot .st:not(.is-hot) {
  stroke: var(--muted);
}

.lens .st.is-hot {
  stroke: var(--accent);
  stroke-width: 1;
  opacity: 1;
}

.lens .nd.is-hot {
  fill: var(--accent);
  stroke: var(--accent);
  opacity: 1;
}

.lens .nd.is-hot.is-small {
  r: 3.5px;
}

/* a stem without a label stays hidden, hovered or not (off-screen ones keep their last classes) */
.lens .st.is-off,
.lens.has-hot .st.is-off {
  opacity: 0;
}

.lens .ll {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px 0 3px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--surface-ink);
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
  transition: opacity 0.3s var(--lens-ease), background-color 0.15s ease, color 0.15s ease;
}

.lens .ll-name {
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}

.lens .ll-date {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--surface-muted);
}

.lens .ll.is-accent {
  background: var(--accent);
  color: var(--accent-ink);
}

.lens .ll.is-accent .ll-date {
  color: inherit;
  opacity: 0.78;
}

/* --select: black in the default theme, the accent in the alternatives (where pills can be dark) */
.lens .ll:hover,
.lens .ll.is-hot,
.lens .ll.is-self {
  background: var(--select);
  color: var(--select-ink);
}

.lens .ll:hover .ll-date,
.lens .ll.is-hot .ll-date,
.lens .ll.is-self .ll-date {
  color: inherit;
  opacity: 0.7;
}

.lens .ll:hover .lens-avatar img,
.lens .ll.is-hot .lens-avatar img,
.lens .ll.is-self .lens-avatar img {
  filter: none;
}

/* dimmed by colour, not opacity, so the pill still hides the stems behind it */
.lens .ll.is-dim {
  background: var(--page);
  color: var(--outline);
}

.lens .ll.is-dim .ll-date {
  color: var(--outline);
}

.lens .ll.is-dim .lens-avatar {
  opacity: 0.3;
}

.lens .ll.is-off,
.lens.mode-bars .ll {
  opacity: 0;
  pointer-events: none;
}

/* ── Barcode (zoomed out) ── */
.lens .bar {
  fill: var(--ink);
  stroke: var(--ink);
  stroke-width: 0;
  transition: opacity 0.25s ease, fill 0.15s ease, stroke 0.15s ease;
}

.lens .bar.is-out {
  fill: var(--page);
  stroke-width: 1;
}

.lens .bar.is-planned {
  stroke-dasharray: 2 1.5;
}

.lens .bar.is-accent,
.lens .bar:hover {
  fill: var(--accent);
  stroke: var(--accent);
}

.lens .bar.is-accent.is-out {
  fill: var(--page);
}

.lens .bar.is-dim {
  opacity: 0.22;
}

/* ── Avatars: greyscale photo over initials ── */
.lens-avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 50%;
  background: var(--grid);
  color: var(--ink);
  font-weight: 600;
}

.lens-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  filter: grayscale(1) contrast(1.05);
  transition: filter 0.3s ease;
}

/* ── Overlay: legend, lens caption, today pill ── */
.lens-legend {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  gap: 14px;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
  white-space: nowrap;
}

.lens-legend li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.lens-legend i {
  display: inline-block;
}

.lg-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
}

.lg-ring {
  width: 7px;
  height: 7px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 1px solid var(--ink);
}

.lg-ring.lg-dash {
  border-style: dashed;
}

.lg-ribbon {
  width: 18px;
  height: 0;
  border-top: 1px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  border-radius: 2px;
}

.lens-lens-caption {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--accent);
  line-height: 20px;
  opacity: 0;
}

.lens-today {
  position: absolute;
  top: 0;
  left: 0;
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--page);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ── Tooltip ── */
.lens-tip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--page);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
}

.lens-tip[hidden] {
  display: none;
}

.lens-tip-meta {
  font-size: 10px;
  letter-spacing: 0.04em;
  opacity: 0.7;
}

/* ── Card: the selection's details ── */
.lens-card {
  position: absolute;
  top: 58px;
  right: 16px;
  bottom: 112px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: var(--lens-card-w);
  box-sizing: border-box;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--surface-shadow);
  color: var(--surface-ink);
  cursor: default;
  user-select: text;
}

.lens-card[hidden] {
  display: none;
}

.lens-card .lens-caption-text {
  color: var(--surface-muted);
}

.lens-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--surface-line);
}

.lens-card-head .lens-avatar img {
  filter: none;
}

.lens-card-text {
  flex: 1;
  min-width: 0;
}

.lens-card-title {
  font-size: 14px;
  font-weight: 600;
}

.lens-card-meta {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--surface-muted);
  font-variant-numeric: tabular-nums;
}

.lens .lens-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--surface-line);
  color: var(--surface-ink);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.lens .lens-close:hover {
  box-shadow: 0 0 0 1px var(--surface-ink);
}

.lens .lens-close:focus-visible,
.lens .lens-card-list button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.lens-card-list {
  flex: 1;
  margin: 8px 0 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.lens-card-list li + li {
  margin-top: 3px;
}

/* Each row is its own bar: fill = length relative to the longest */
.lens .lens-card-list button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 6px;
  border-radius: 6px;
  background: linear-gradient(to right, var(--tile) calc(var(--share) * 100%), transparent 0);
  text-align: left;
  cursor: pointer;
}

.lens .lens-card-list button:hover {
  background: linear-gradient(to right, var(--tab-hover) calc(var(--share) * 100%), var(--tile) 0);
}

.lens-card-list .lens-card-name {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.lens-card-list .lens-card-meta {
  flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
  .lens *,
  .lens *::before,
  .lens *::after {
    transition-duration: 0.01ms !important;
  }
}
