/* Plan: the six-month phase line, then collapsible phase tables. */

.phaseline {
  margin: 8px 0 34px;
}
.phaseline h2 {
  margin-bottom: 14px;
}
.pl-board {
  --pl-pad: 18px;
  position: relative;
  padding: 58px var(--pl-pad) 40px;
  border-radius: var(--radius-board);
  background: var(--surface);
  border: 1px solid color-mix(in oklab, var(--rule) 70%, transparent);
  box-shadow: var(--shadow-3);
}
.pl-months,
.pl-marks,
.pl-lane {
  position: relative;
  margin-inline: 0;
}
.pl-month,
.pl-cluster,
.pl-band,
.pl-today {
  position: absolute;
  left: var(--x, 0%);
}

.pl-lane {
  list-style: none;
  margin: 0;
  padding: 0;
  height: 58px;
  perspective: 900px;
}
.pl-band {
  top: 0;
  bottom: 0;
  width: max(var(--w, 0%), 34px);
}
.pl-band a {
  position: absolute;
  inset: 0 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  overflow: hidden;
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink-2);
  background: var(--surface-3);
  box-shadow:
    0 6px 0 color-mix(in oklab, var(--surface-3) 70%, black 12%),
    var(--shadow-1);
  transform: rotateX(18deg);
  transform-origin: 50% 100%;
  transition:
    transform 220ms var(--ease-spring),
    box-shadow 220ms,
    background-color 200ms;
}
.pl-band a:hover,
.pl-band a:focus-visible {
  transform: rotateX(0deg) translateY(-4px);
  box-shadow:
    0 10px 0 color-mix(in oklab, var(--surface-3) 70%, black 12%),
    var(--shadow-2);
}
.pl-band.is-now a {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow:
    0 6px 0 var(--accent-2),
    0 18px 30px -12px var(--accent);
}
.pl-band.is-past a {
  /* muted by colour, not opacity: the number and title stay readable (ink-3 on surface-2 is 5:1+) */
  background: var(--surface-2);
  color: var(--ink-3);
}
.pl-num {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgb(255 255 255 / 0.9);
  color: #0f1a2b;
  font: 760 14px/1 var(--display);
}
.pl-title {
  font: 650 14.5px/1.2 var(--body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-months {
  height: 22px;
  margin-top: 12px;
}
.pl-month {
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-3);
}
.pl-month::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 24px;
  height: 8px;
  width: 1px;
  background: var(--rule);
}

.pl-marks {
  height: 0;
}
/* No transform on .pl-cluster itself: a transformed ancestor would become the containing block of
   the phone bottom sheet (position: fixed) and shrink it to the width of the diamond. The summary
   is centred on --x instead, and the popover is placed relative to that same point. */
.pl-cluster {
  top: -46px;
  z-index: 2;
}
.pl-cluster[open] {
  z-index: 4; /* above the today line */
}
.pl-cluster > summary {
  translate: -50% 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.pl-cluster > summary::-webkit-details-marker {
  display: none;
}
.pl-diamond {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--kind-decision);
  transform: rotate(45deg);
  box-shadow: 0 3px 8px -2px var(--kind-decision);
}
.pl-cluster.is-past .pl-diamond {
  background: var(--pending);
  box-shadow: none;
}
.pl-count {
  font: 760 13px/1 var(--display);
  color: var(--ink-2);
}
.pl-cluster > summary:hover .pl-diamond,
.pl-cluster[open] .pl-diamond {
  transform: rotate(45deg) scale(1.25);
}
.pl-pop {
  position: absolute;
  top: 26px;
  left: 0;
  translate: -50% 0;
  width: min(340px, 80vw);
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-3);
}
/* A popover near either end hangs inward, so opening it never pushes the page sideways. */
.pl-cluster.is-start .pl-pop {
  left: 0;
  translate: 0 0;
}
.pl-cluster.is-end .pl-pop {
  translate: -100% 0;
}
.pl-pop-head {
  margin: 0 0 6px;
  font-weight: 750;
  font-size: 14px;
}
.pl-pop ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 14px;
  line-height: 1.35;
}
.pl-pop a {
  color: var(--ink);
  text-decoration: none;
}
.pl-pop a:hover {
  color: var(--accent);
}
.pl-pop b {
  color: var(--kind-decision);
  margin-right: 4px;
}
@media (prefers-reduced-motion: no-preference) {
  .pl-cluster[open] .pl-pop {
    animation: pop-in 220ms var(--ease-spring);
  }
  @keyframes pop-in {
    from {
      opacity: 0;
      transform: translateY(-6px) scale(0.97);
    }
  }
}

/* The today line lives in a layer inset like the lanes, so its --x is on the same scale as the bands. */
.pl-now {
  position: absolute;
  top: 20px;
  bottom: 16px;
  left: var(--pl-pad);
  right: var(--pl-pad);
  z-index: 3;
  pointer-events: none;
}
.pl-today {
  top: 0;
  bottom: 0;
  width: 3px;
  translate: -50% 0;
  border-radius: 2px;
  background: var(--marker);
  box-shadow: 0 0 14px 2px rgb(255 210 63 / 0.6);
  z-index: 3;
  pointer-events: none;
}
.pl-today b {
  position: absolute;
  bottom: -22px;
  left: 50%;
  translate: -50% 0;
  font-size: 12px;
  font-weight: 800;
  color: var(--marker-ink);
  background: var(--marker);
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
}

.pl-legend {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.pl-legend a {
  display: flex;
  gap: 10px;
  height: 100%;
  padding: 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid color-mix(in oklab, var(--rule) 70%, transparent);
  box-shadow: var(--shadow-1);
  text-decoration: none;
  color: var(--ink);
  transition:
    transform 180ms var(--ease-out),
    box-shadow 180ms;
}
.pl-legend a:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}
.pl-legend .is-now a {
  border-color: var(--accent);
  box-shadow:
    0 0 0 1px var(--accent),
    var(--shadow-2);
}
.pl-legend .is-now .pl-num {
  background: var(--accent);
  color: var(--on-accent);
}
.pl-legend .pl-num {
  background: var(--surface-3);
  color: var(--ink); /* the band's #0f1a2b on dark --surface-3 was 1.2:1 */
}
.pl-legend-text {
  display: grid;
  gap: 2px;
  font-size: 14.5px;
  line-height: 1.3;
}
.pl-legend-text span {
  font-size: 13px;
  color: var(--ink-3);
}

/* Collapsible phase tables: the current phase starts open. */
.phase-details > summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  gap: 4px;
  padding: 10px 0;
}
.phase-details > summary::-webkit-details-marker {
  display: none;
}
.phase-details > summary h2 {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.phase-details > summary h2::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--ink-3);
  border-bottom: 2px solid var(--ink-3);
  transform: rotate(-45deg);
  transition: transform 220ms var(--ease-out);
}
.phase-details[open] > summary h2::after {
  transform: rotate(45deg);
}
.phase-when {
  font-size: 14.5px;
  color: var(--ink-3);
  font-weight: 600;
}
.phase-details::details-content {
  block-size: 0;
  overflow: clip;
  transition:
    block-size 320ms var(--ease-out),
    content-visibility 320ms allow-discrete;
}
.phase-details[open]::details-content {
  block-size: auto;
}

@media (max-width: 719px) {
  .pl-title {
    display: none;
  }
  .pl-board {
    --pl-pad: 12px;
  }
}
.phase-block > *, .phase-details, .phase-details .table-wrap { min-width: 0; }
.pl-cluster:not([open]) .pl-pop { display: none; }
@media (max-width: 719px) {
  .pl-cluster .pl-pop, .pl-cluster.is-start .pl-pop, .pl-cluster.is-end .pl-pop {
    position: fixed;
    top: auto;
    bottom: 16px;
    left: 16px;
    right: 16px;
    width: auto;
    translate: none;
    z-index: 30;
  }
}
