/* ============================================================
   The Operating Score — interactive mission board
   Replaces the static SVG with a real HTML board.
   Grid: 12 week columns shared by ruler, lanes and playhead.
   ============================================================ */

.score {
  margin: clamp(40px, 5vw, 64px) 0 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  position: relative;
  --lane-h: 62px;
  --label-w: 232px;
}

.score__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 14px 0 0;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 12px;
}

.score__meta,
.score__now {
  font-family: var(--f-ui);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
  font-weight: 500;
}

.score__now {
  color: var(--accent-text);
  font-family: var(--f-mono);
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
}

.score__scroll {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--rule-strong) transparent;
  -webkit-overflow-scrolling: touch;
}

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

.sc {
  position: relative;
  min-width: 860px;
  padding-bottom: 4px;
}

/* --- ruler --- */
.sc__ruler {
  display: grid;
  grid-template-columns: var(--label-w) 1fr;
  align-items: end;
  border-bottom: 1px solid var(--rule);
}

.sc__weeks {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
}

.sc__weeks span {
  font-family: var(--f-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--muted-2);
  text-align: left;
  padding: 8px 0 8px 2px;
  border-left: 1px solid var(--rule);
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.sc__weeks span:first-child {
  border-left: 1px solid var(--rule-strong);
}

.sc__weeks span.is-current {
  color: var(--accent-text);
  border-left-color: var(--accent);
}

.sc__weeks span.is-past {
  color: var(--fg);
}

/* --- lanes --- */
.sc__lanes {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sc__lane {
  display: grid;
  grid-template-columns: var(--label-w) 1fr;
  align-items: center;
  min-height: var(--lane-h);
  border-bottom: 1px solid var(--rule);
  position: relative;
}

.sc__lane:last-child {
  border-bottom: 0;
}

.sc__label {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 9px;
  row-gap: 1px;
  padding: 12px 18px 12px 0;
  align-content: center;
}

.sc__n {
  font-family: var(--f-mono);
  font-size: 0.6rem;
  color: var(--muted-2);
  letter-spacing: 0.08em;
  grid-row: span 2;
  align-self: center;
  padding-top: 2px;
}

.sc__verb {
  font-family: var(--f-ui);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.sc__name {
  font-family: var(--f-ui);
  font-size: 0.93rem;
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
  line-height: 1.25;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.35s var(--ease);
  justify-self: start;
}

.sc__name:hover,
.sc__name:focus-visible {
  background-size: 100% 1px;
}

.sc__stat {
  grid-column: 2;
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.3;
}

/* track */
.sc__track {
  position: relative;
  height: var(--lane-h);
  border-left: 1px solid var(--rule-strong);
  background-image: linear-gradient(to right, var(--rule) 1px, transparent 1px);
  background-size: calc(100% / 12) 100%;
}

.sc__bar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: var(--from);
  width: calc(var(--to) - var(--from));
  height: 3px;
  background: var(--rule-strong);
  border-radius: 2px;
  overflow: hidden;
}

.sc__bar-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.18s linear;
}

.sc__lane--sense .sc__bar {
  height: 2px;
  background: repeating-linear-gradient(
    to right,
    var(--rule-strong) 0 5px,
    transparent 5px 10px
  );
}

.sc__lane--sense .sc__bar-fill {
  background: repeating-linear-gradient(
    to right,
    var(--accent) 0 5px,
    transparent 5px 10px
  );
}

.sc__lane--learn .sc__bar {
  background: var(--rule);
}

/* marks */
.sc__mark {
  position: absolute;
  top: 50%;
  left: var(--at);
  transform: translate(-50%, -50%);
  z-index: 2;
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease),
    opacity 0.25s var(--ease);
}

.sc__mark--checkpoint {
  width: 11px;
  height: 11px;
  border: 1.5px solid var(--muted);
  background: var(--bg);
  transform: translate(-50%, -50%) rotate(45deg);
}

.sc__mark--review {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--muted);
  background: var(--bg);
}

.sc__mark.is-past.sc__mark--checkpoint {
  border-color: var(--accent);
  background: var(--accent);
}

.sc__mark.is-past.sc__mark--review {
  border-color: var(--accent);
  background: var(--accent);
}

/* detail — revealed per lane, all present in DOM for crawlers */
.sc__detail {
  grid-column: 1 / -1;
  display: none;
  padding: 0 0 18px 0;
  gap: 4px;
}

.sc__lane.is-open .sc__detail {
  display: grid;
  grid-template-columns: 1fr;
}

.sc__cadence {
  font-size: 0.78rem;
  color: var(--accent-text);
  margin: 0;
  font-weight: 500;
}

.sc__deliv {
  font-size: 0.84rem;
  color: var(--muted);
  margin: 0;
  max-width: 62ch;
  line-height: 1.5;
}

.sc__ev {
  font-family: var(--f-ui);
  font-size: 0.58rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted-2);
  border: 1px solid var(--rule);
  padding: 2px 7px;
  justify-self: start;
  margin-top: 4px;
}

/* --- playhead --- */
.ph-wrap {
  position: absolute;
  top: 33px;
  bottom: 0;
  left: var(--label-w);
  right: 0;
  pointer-events: none;
}

.ph-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  border-left: 1px solid var(--accent);
  will-change: transform;
}

.ph-knob {
  position: absolute;
  top: -5px;
  left: -4.5px;
  width: 9px;
  height: 9px;
  background: var(--accent);
  transform: rotate(45deg);
}

/* native range sits on top, invisible, full-width — accessible */
.ph {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: grab;
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}

.ph::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 100%;
  cursor: grab;
}

.ph::-moz-range-thumb {
  width: 26px;
  height: 100%;
  border: 0;
  background: transparent;
  cursor: grab;
}

.ph:active {
  cursor: grabbing;
}

.ph:focus-visible ~ .ph-line,
.score:has(.ph:focus-visible) .ph-line {
  border-left-width: 2px;
}

/* --- foot --- */
.score__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 26px;
  padding: 13px 0 0;
}

.score__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--f-ui);
  font-size: 0.63rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}

.score__legend li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.score__legend li span {
  width: 10px;
  height: 10px;
  display: inline-block;
  flex: none;
}

.lg-install span {
  background: var(--accent);
  height: 3px !important;
  width: 16px !important;
}

.lg-checkpoint span {
  border: 1.5px solid var(--muted);
  transform: rotate(45deg);
  width: 9px !important;
  height: 9px !important;
}

.lg-review span {
  border: 1.5px solid var(--muted);
  border-radius: 50%;
  width: 8px !important;
  height: 8px !important;
}

.lg-stop span {
  background: var(--stop);
  width: 3px !important;
  height: 12px !important;
}

.score__note,
.score__phases {
  font-family: var(--f-ui);
  font-size: 0.63rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin: 0;
}

.score__phases {
  padding-top: 8px;
  opacity: 0.75;
  letter-spacing: 0.16em;
  font-size: 0.58rem;
}

.score__hint {
  display: none;
  font-family: var(--f-ui);
  font-size: 0.63rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding-top: 10px;
  margin: 0;
}

/* --- responsive --- */
@media (max-width: 860px) {
  .score {
    --label-w: 170px;
    --lane-h: 56px;
  }
  .sc__weeks span {
    font-size: 0.52rem;
    letter-spacing: 0.04em;
  }
  .sc__hint {
    display: block;
  }
  .sc__weeks span:nth-child(even) {
    visibility: hidden;
  }
}

@media (max-width: 560px) {
  .score {
    --label-w: 128px;
    --lane-h: 52px;
  }
  .sc__name {
    font-size: 0.84rem;
  }
  .sc__stat,
  .sc__n {
    display: none;
  }
  .sc__weeks span:nth-child(3n + 2),
  .sc__weeks span:nth-child(3n + 3) {
    visibility: hidden;
  }
}

/* reduced motion: kill the fill transition */
@media (prefers-reduced-motion: reduce) {
  .sc__bar-fill,
  .sc__mark,
  .sc__name {
    transition: none !important;
  }
  .score__hint {
    display: block;
  }
}

/* print: static board, no playhead */
@media print {
  .ph-wrap,
  .score__hint {
    display: none;
  }
  .sc__detail {
    display: grid !important;
  }
}
