:root {
  --timing-ink: #232b28;
  --timing-soft: #4c5751;
  --timing-line: #c6c6b4;
  --timing-paper: #fcfaf4;
  --timing-pine: #1c6651;
  --timing-copper: #984228;
}

[hidden] { display: none !important; }

.timing-wrap {
  width: min(1140px, calc(100% - 64px));
  margin: 0 auto;
  color: var(--timing-ink);
}

.timing-wrap a { text-underline-offset: .2em; }
.timing-wrap :where(a, button, summary, select, input, [tabindex]):focus-visible {
  outline: 3px solid #285b74;
  outline-offset: 3px;
}

.timing-workbench :where(input, select, button) {
  scroll-margin-block-start: calc(var(--aptifold-bar-height, 68px) + 12px);
}

.timing-hero {
  position: relative;
  padding: clamp(28px, 6vw, 82px) 0 clamp(18px, 3vw, 34px);
  border-bottom: 1px solid var(--timing-line);
}

.timing-crumb {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 9px;
  margin: 0 0 16px;
  color: var(--timing-soft);
  font-size: .84rem;
  font-weight: 710;
}

.timing-hero h1 {
  max-width: 14ch;
  font-size: clamp(2.65rem, 7.9vw, 6.2rem);
  line-height: .94;
  letter-spacing: -.073em;
  margin: 0 0 16px;
}

.timing-lede {
  max-width: 62ch;
  font-size: clamp(1.03rem, 2vw, 1.37rem);
  line-height: 1.45;
  margin: 0;
}

.timing-source {
  color: var(--timing-copper);
  font-size: .87rem;
  margin: 10px 0 0;
  font-weight: 720;
}

.timing-station,
.timing-section { scroll-margin-top: calc(var(--aptifold-bar-height, 68px) + 14px); }
.timing-station { padding-top: 18px; }

.timing-workbench {
  display: grid;
  grid-template-columns: minmax(225px, .45fr) minmax(0, 1fr);
  grid-template-areas: "chance decision" "controls chart";
  align-items: start;
  gap: 12px 23px;
  padding: clamp(12px, 2.45vw, 25px);
  background: var(--timing-paper);
  border: 1px solid var(--timing-line);
}

.timing-chance { grid-area: chance; }
.timing-result { grid-area: decision; min-width: 0; }
.timing-controls { grid-area: controls; display: grid; gap: 13px; min-width: 0; }
.timing-chart { grid-area: chart; min-width: 0; }
.timing-fallback { padding: 14px; background: var(--timing-paper); border: 1px solid var(--timing-line); }

.timing-chance, .timing-controls {
  padding: 13px 14px;
  background: #eeebdf;
  border: 1px solid #d7d3c3;
}

.timing-workbench label { display: block; font-weight: 710; font-size: .9rem; }
.timing-workbench label > span {
  display: flex;
  gap: 5px 10px;
  justify-content: space-between;
  align-items: baseline;
}

.timing-workbench output { min-width: max-content; font-weight: 640; font-variant-numeric: tabular-nums; }
.timing-workbench input, .timing-workbench select, .timing-workbench button {
  box-sizing: border-box;
  color: var(--timing-ink);
  font: inherit;
}

.timing-workbench input[type="range"] {
  display: block;
  width: 100%;
  height: 36px;
  margin: 0;
  accent-color: var(--timing-pine);
}

.timing-workbench :is(select, input[type="url"]) {
  width: 100%;
  border: 1px solid #858878;
  background: var(--timing-paper);
  border-radius: 4px;
  min-height: 42px;
  padding: 7px 8px;
}

.timing-workbench select { margin-top: 5px; }
.timing-presets, .timing-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.timing-presets button, .timing-tools button {
  min-height: 41px;
  padding: 7px 11px;
  border: 1px solid #797d71;
  border-radius: 4px;
  background: var(--timing-paper);
  font-size: .85rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.timing-presets button:hover, .timing-tools button:hover { background: #dfebde; }
.timing-controls p, .timing-note, #share-status { font-size: .88rem; color: var(--timing-soft); }
.timing-controls p { margin: 0; }

.timing-decision h3 {
  font-size: clamp(1.35rem, 3.1vw, 2.2rem);
  line-height: 1.05;
  letter-spacing: -.046em;
  margin: 0 0 6px;
}

.timing-decision p { margin: 0 0 12px; }
.timing-rates {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 9px 0 11px;
  border-block: 1px solid var(--timing-line);
}

.timing-rates span { display: block; font-size: .82rem; color: var(--timing-soft); }
.timing-rates strong { display: block; font-size: clamp(1.13rem, 2.7vw, 2rem); font-variant-numeric: tabular-nums; line-height: 1.12; }
.timing-figure { margin: 0; }
.timing-figure figcaption { font-size: .94rem; font-weight: 720; margin-bottom: 6px; }
.timing-figure canvas {
  display: block;
  width: 100%;
  height: clamp(236px, 30vw, 305px);
  box-sizing: border-box;
  border: 1px solid #dad8cb;
}

.timing-key { display: flex; flex-wrap: wrap; gap: 3px 15px; font-size: .8rem; margin-top: 5px; }
.timing-key span::before {
  display: inline-block;
  content: "";
  width: 13px;
  height: 0;
  border-bottom: 3px solid currentColor;
  vertical-align: .23em;
  margin-right: 4px;
}

.planned-key { color: var(--timing-copper); }
.scan-key { color: var(--timing-pine); }
.timing-key .scan-key::before { border-bottom-style: dashed; }
.timing-key .range-key::before { height: .61em; border: 1px solid #8faa96; background: #d3e4d5; vertical-align: .03em; }
.timing-tools input { flex-basis: 100%; }
.timing-note { max-width: 78ch; }

.timing-section {
  margin-top: 28px;
  padding-bottom: 25px;
  border-bottom: 1px solid var(--timing-line);
}

.timing-section h2 {
  font-size: clamp(1.9rem, 4vw, 3.2rem);
  line-height: 1;
  letter-spacing: -.054em;
  margin: 0 0 10px;
}

.timing-section > p { margin-top: 0; }
.timing-scroll { max-width: 100%; overflow-x: auto; margin: 11px 0; }
.timing-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.timing-table :is(th, td) { text-align: left; border-bottom: 1px solid var(--timing-line); padding: 8px 9px; font-size: .88rem; min-width: 90px; }
.timing-table th:first-child { min-width: 110px; }
.timing-table td:last-child { min-width: 145px; }
.timing-selected-row { background: #e1ecdf; }
.timing-method { margin-bottom: 46px; }
.timing-method-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; margin-top: 18px; }
.timing-method-grid h3, .timing-method-grid p { margin: 0 0 6px; }
.timing-method-grid h3 { font-size: 1.13rem; line-height: 1.14; }
.timing-method-grid p, .timing-method details p { font-size: .96rem; max-width: 76ch; }
.timing-method details { margin-block: 18px; border-top: 1px solid var(--timing-line); padding-top: 10px; }
.timing-method summary { width: fit-content; cursor: pointer; font-weight: 700; }
.timing-links { display: flex; gap: 8px 22px; flex-wrap: wrap; font-weight: 690; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 820px) {
  .timing-wrap { width: calc(100% - 34px); }
  .timing-workbench { grid-template-columns: 1fr; grid-template-areas: "chance" "decision" "controls" "chart"; }
  .timing-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 13px; }
  .timing-presets, .timing-controls p { grid-column: 1 / -1; }
}

@media (max-width: 480px) {
  .timing-wrap { width: calc(100% - 26px); }
  .timing-hero { padding: 23px 0 15px; }
  .timing-crumb { margin-bottom: 11px; }
  .timing-hero h1 { margin-bottom: 12px; }
  .timing-method-grid { grid-template-columns: 1fr; gap: 13px; }
  .timing-controls label > span { display: block; }
  .timing-controls output { display: block; }
  .timing-controls label:nth-of-type(3) { grid-column: 1 / -1; }
}
