/* Round 119: the simulations page (rackoon.fit/simulations/). Colors come from ../styles.css's tokens;
   the second chart series gets its own token here, light and dark. */
:root {
  --series-a: var(--accent);
  --series-b: #2f6db5;
  --band-a: rgba(138, 88, 0, 0.16);
  --band-b: rgba(47, 109, 181, 0.16);
  --grid: #d3cfc6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --series-b: #7aa7ea;
    --band-a: rgba(242, 179, 61, 0.18);
    --band-b: rgba(122, 167, 234, 0.18);
    --grid: #3c3c3c;
  }
}
:root[data-theme='dark'] {
  --series-b: #7aa7ea;
  --band-a: rgba(242, 179, 61, 0.18);
  --band-b: rgba(122, 167, 234, 0.18);
  --grid: #3c3c3c;
}

.sims {
  padding-block: 32px 56px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.sims h1 {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.sims h2 {
  font-size: 1.35rem;
  font-weight: 800;
  text-wrap: balance;
}
.asof {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 8px 0 0;
}

/* Standard / Gentle workouts, like the old 100 / 1,000 tabs. Round 120: pinned just under the site's
   top bar (64 px) while scrolling. */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 64px;
  background: var(--bg);
  z-index: 2;
}
.tabs button {
  font: inherit;
  font-weight: 700;
  color: var(--muted);
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 10px 14px;
  margin-bottom: -1px;
  cursor: pointer;
}
.tabs button[aria-selected='true'] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tabs button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
.pane {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}

/* The summary at the top of each tab: every two-liner, linking to its chart. */
.summary {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 18px 22px;
}
.summary h2 {
  margin-bottom: 10px;
}
.summary ol {
  margin: 0;
  padding-left: 1.3em;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 75ch;
}
.summary a {
  color: inherit;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}
.summary .does {
  color: var(--muted);
}

.sim {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  /* Clears the top bar and the pinned tabs. */
  scroll-margin-top: 124px;
}
.sim h3 {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0;
}
/* The two-liner, larger: what the user does, then what Rackoon did and by when. */
.two-liner {
  font-size: 1.1rem;
  line-height: 1.45;
  margin: 0;
  max-width: 70ch;
}
.two-liner .does {
  display: block;
  color: var(--muted);
}
.two-liner .did {
  display: block;
  font-weight: 700;
}
.how {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
  max-width: 70ch;
}

.charts {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}
.chart {
  min-width: 0;
  max-width: 560px;
  margin: 0;
}
.chart h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 6px;
}
.chart-box {
  position: relative;
}
.chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.chart .axis text {
  fill: var(--muted);
  font-size: 11px;
}
.chart .grid line {
  stroke: var(--grid);
  stroke-width: 1;
}
.chart .s-a {
  stroke: var(--series-a);
}
.chart .s-b {
  stroke: var(--series-b);
}
.chart .b-a {
  fill: var(--band-a);
}
.chart .b-b {
  fill: var(--band-b);
}
.chart .line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
}
.chart .target {
  fill: none;
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}
.chart .switch {
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}
.chart .cross {
  stroke: var(--muted);
  stroke-width: 1;
}
.chart .dot {
  stroke: var(--card);
  stroke-width: 2;
}
.tip {
  position: absolute;
  pointer-events: none;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.85rem;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  z-index: 1;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}
.legend i {
  display: inline-block;
  width: 16px;
  height: 3px;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 6px;
}
.legend i.dash {
  height: 0;
  border-top: 2px dashed var(--muted);
}

details.numbers summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.95rem;
}
.table-scroll {
  overflow-x: auto;
  margin-top: 8px;
}
.sims table {
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 100%;
}
.sims th,
.sims td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.sims th {
  color: var(--muted);
  font-weight: 700;
}
.sims tr.changed td.n {
  color: var(--accent);
  font-weight: 700;
}

.howto-read dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0;
  max-width: 75ch;
}
.howto-read dt {
  font-weight: 700;
}
.howto-read dd {
  margin: 0;
  color: var(--muted);
}
@media (max-width: 520px) {
  .howto-read dl {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .howto-read dd {
    margin-bottom: 8px;
  }
  .sim {
    padding: 16px;
  }
}
.next {
  margin: 0;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: right;
}
.sims-error {
  color: var(--muted);
}

/* The page shows one tab at a time: `hidden` wins over the panes' flex layout. */
.sims [hidden] {
  display: none !important;
}
