/* PDTimeBoard — the shared scrub rail (2026-10-31).
 *
 * The rail is intentionally surface-agnostic: it reads five variables and the
 * host sets them. The draft-class room sets them to its broadcast palette; a
 * Stats board can set its own without touching this file.
 *
 *   --rail-ink       primary text
 *   --rail-muted     labels
 *   --rail-line      track and hairlines
 *   --rail-accent    the "then" end
 *   --rail-accent-2  the "now" end
 *
 * The block is `.pd-tb-rail`, NOT `.pd-rail`. `.pd-rail` is the PWA shell's
 * navigation rail (shell.css). This stylesheet loads after shell.css, so an
 * unscoped `.pd-rail { position: relative; display: grid }` here silently
 * unhooks the Owner Desk sidebar from the viewport and drops it into normal
 * flow at the bottom of the page. Keep every TimeBoard class under `.pd-tb-`.
 */

.pd-tb-rail {
  --rail-ink: var(--pd-text-primary);
  --rail-muted: var(--pd-text-secondary);
  --rail-line: var(--pd-border);
  --rail-accent: #a97b1f;
  --rail-accent-2: #2f8f83;
  position: relative;
  display: grid;
  gap: 8px;
  color: var(--rail-ink);
}

.pd-tb-rail__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 16px;
}

.pd-tb-rail__pole {
  display: grid;
  gap: 2px;
  min-height: 44px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--rail-muted);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: color 140ms ease;
}

.pd-tb-rail__pole--now {
  text-align: right;
}

.pd-tb-rail__pole strong {
  color: var(--rail-ink);
  font-family: var(--pd-font-display);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pd-tb-rail__pole small {
  color: var(--rail-muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pd-tb-rail__pole:hover,
.pd-tb-rail__pole:focus-visible {
  color: var(--rail-ink);
}

.pd-tb-rail__pole:hover strong {
  color: var(--rail-accent-2);
}

.pd-tb-rail__readout {
  display: grid;
  justify-items: center;
  gap: 1px;
  min-width: 168px;
}

.pd-tb-rail__readout b {
  color: var(--rail-ink);
  font-family: var(--pd-font-display);
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.pd-tb-rail__readout small {
  color: var(--rail-muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pd-tb-rail__track {
  position: relative;
  height: 46px;
  margin: 2px 0 0;
}

.pd-tb-rail__line,
.pd-tb-rail__fill {
  position: absolute;
  top: 18px;
  left: 8px;
  height: 2px;
  border-radius: 1px;
}

.pd-tb-rail__line {
  right: 8px;
  background: var(--rail-line);
}

.pd-tb-rail__fill {
  width: calc((100% - 16px) * var(--rail-t, 0));
  background: linear-gradient(90deg, var(--rail-accent), var(--rail-accent-2));
}

.pd-tb-rail__ticks {
  position: absolute;
  inset: 0;
}

.pd-tb-rail__tick {
  position: absolute;
  top: 0;
  left: var(--tick);
  display: grid;
  width: 28px;
  height: 46px;
  place-items: start center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--rail-muted);
  font: inherit;
  transform: translateX(-50%);
  cursor: pointer;
}

.pd-tb-rail__tick span {
  width: 1px;
  height: 8px;
  margin-top: 15px;
  background: var(--rail-line);
  transition: background 140ms ease, height 140ms ease;
}

.pd-tb-rail__tick em {
  margin-top: 10px;
  color: var(--rail-muted);
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pd-tb-rail__tick:hover span,
.pd-tb-rail__tick:focus-visible span,
.pd-tb-rail__tick.is-active span {
  height: 12px;
  margin-top: 13px;
  background: var(--rail-accent-2);
}

.pd-tb-rail__tick.is-active em {
  color: var(--rail-ink);
}

.pd-tb-rail__tick:focus-visible {
  outline: 2px solid var(--rail-accent-2);
  outline-offset: -4px;
  border-radius: 4px;
}

.pd-tb-rail__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 46px;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}

.pd-tb-rail__input:focus-visible ~ .pd-tb-rail__thumb {
  outline: 2px solid var(--rail-accent-2);
  outline-offset: 3px;
}

.pd-tb-rail__thumb {
  position: absolute;
  top: 4px;
  left: calc(8px + (100% - 16px) * var(--rail-t, 0));
  width: 18px;
  height: 30px;
  border: 1px solid color-mix(in srgb, var(--rail-accent-2) 70%, #000 30%);
  border-radius: 3px;
  background: linear-gradient(180deg, var(--rail-accent-2), var(--rail-accent));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--rail-accent-2) 18%, transparent), 0 6px 14px rgba(0, 0, 0, 0.35);
  transform: translateX(-50%);
  pointer-events: none;
  transition: background 120ms linear;
}

.pd-tb-rail__thumb::before,
.pd-tb-rail__thumb::after {
  position: absolute;
  top: 12px;
  width: 3px;
  height: 4px;
  border-top: 1px solid rgba(10, 14, 20, 0.7);
  border-bottom: 1px solid rgba(10, 14, 20, 0.7);
  content: "";
}

.pd-tb-rail__thumb::before {
  left: 4px;
  border-left: 1px solid rgba(10, 14, 20, 0.7);
}

.pd-tb-rail__thumb::after {
  right: 4px;
  border-right: 1px solid rgba(10, 14, 20, 0.7);
}

.pd-tb-rail__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  padding-top: 2px;
  border-top: 1px solid var(--rail-line);
  color: var(--rail-muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pd-tb-rail__note {
  margin: 0;
  color: var(--rail-muted);
  font-size: 10px;
  letter-spacing: 0.01em;
}

@media (max-width: 700px) {
  .pd-tb-rail__head {
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
  }

  .pd-tb-rail__pole {
    min-height: 40px;
    padding: 2px 0;
  }

  .pd-tb-rail__pole strong {
    font-size: 12px;
    letter-spacing: 0.06em;
  }

  .pd-tb-rail__pole small {
    font-size: 9px;
  }

  .pd-tb-rail__readout {
    min-width: 0;
  }

  .pd-tb-rail__readout b {
    font-size: 13px;
    letter-spacing: 0.04em;
  }

  .pd-tb-rail__tick em {
    display: none;
  }

  .pd-tb-rail__tick:first-child em,
  .pd-tb-rail__tick:nth-child(8) em,
  .pd-tb-rail__tick:last-child em {
    display: block;
  }

  .pd-tb-rail__foot {
    font-size: 9px;
  }

  .pd-tb-rail__note {
    font-size: 10px;
    line-height: 1.4;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pd-tb-rail__thumb,
  .pd-tb-rail__tick span {
    transition: none;
  }
}

/* ---- printed time rule -------------------------------------------------
 *
 * The draft room uses this variant: a hairline through the page with one 4px
 * tick per captured week and a single square handle. It is deliberately not a
 * panel or a chip row; it should read as a rule printed inside the board.
 */

.pd-rule {
  --rule-ink: var(--pd-text-primary);
  --rule-muted: var(--pd-text-secondary);
  --rule-line: var(--pd-border);
  --rule-accent: #a97b1f;
  --rule-halo: var(--pd-page, transparent);
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  align-items: center;
  gap: 0 16px;
}

.pd-rule__pole {
  display: flex;
  min-height: 44px;
  align-items: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--rule-muted);
  font: inherit;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: color 140ms ease;
}

.pd-rule__pole--now {
  justify-content: flex-end;
  text-align: right;
}

.pd-rule__pole strong,
.pd-rule__pole small {
  color: inherit;
  font: inherit;
  font-weight: 850;
  letter-spacing: inherit;
}

.pd-rule__pole small::before {
  content: " · ";
}

.pd-rule__pole:hover,
.pd-rule__pole:focus-visible {
  color: var(--rule-ink);
}

.pd-rule__pole:hover {
  color: var(--rule-accent);
}

.pd-rule__track {
  position: relative;
  height: 44px;
  min-width: 0;
}

.pd-rule__line,
.pd-rule__fill {
  position: absolute;
  top: 22px;
  left: 0;
  height: 1px;
}

.pd-rule__line {
  right: 0;
  background: var(--rule-line);
}

.pd-rule__fill {
  width: calc(var(--rail-t, 0) * 100%);
  background: var(--rule-accent);
}

.pd-rule__ticks {
  position: absolute;
  inset: 0;
}

.pd-rule__tick {
  position: absolute;
  top: 18px;
  left: var(--tick);
  width: 4px;
  height: 4px;
  margin-left: -2px;
  background: color-mix(in srgb, var(--rule-ink) 34%, transparent);
  transition: background 120ms ease, height 120ms ease, top 120ms ease;
}

.pd-rule__tick.is-active {
  top: 15px;
  height: 10px;
  background: var(--rule-accent);
}

.pd-rule__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 44px;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}

.pd-rule__input:focus-visible ~ .pd-rule__handle {
  outline: 2px solid var(--rule-accent);
  outline-offset: 4px;
}

.pd-rule__handle {
  position: absolute;
  top: 16px;
  left: calc(var(--rail-t, 0) * 100%);
  width: 12px;
  height: 12px;
  margin-left: -6px;
  background: var(--rule-accent);
  box-shadow: 0 0 0 3px var(--rule-halo);
  pointer-events: none;
  transition: left 80ms linear, background 120ms linear;
}

.pd-rule__caption {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 4px;
  border-top: 1px solid var(--rule-line);
  color: var(--rule-muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

@media (max-width: 700px) {
  .pd-rule {
    grid-template-columns: 1fr 1fr;
    gap: 0 8px;
  }

  .pd-rule__pole {
    display: grid;
    min-height: 40px;
    align-content: center;
    justify-content: start;
    gap: 1px;
    font-size: 9px;
    letter-spacing: 0.07em;
  }

  .pd-rule__pole--now {
    justify-content: end;
    text-align: right;
  }

  .pd-rule__pole small {
    display: block;
  }

  .pd-rule__pole small::before {
    content: "";
  }

  .pd-rule__track {
    grid-row: 2;
    grid-column: 1 / -1;
    height: 40px;
  }

  .pd-rule__line,
  .pd-rule__fill {
    top: 20px;
  }

  .pd-rule__tick {
    top: 16px;
  }

  .pd-rule__tick.is-active {
    top: 13px;
  }

  .pd-rule__handle {
    top: 14px;
  }

  .pd-rule__caption {
    grid-row: 3;
    font-size: 9px;
    letter-spacing: 0.04em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pd-rule__tick,
  .pd-rule__handle {
    transition: none;
  }
}
