html { font-size: 100%; }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); font-size: 1rem; line-height: 1.5; color: var(--ink); background: var(--page); }
h1, h2, h3 { color: var(--navy); line-height: 1.25; margin: var(--s6) 0 var(--s3); }
h1 { font-size: 1.75rem; margin-top: 0; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
p, ul, ol { max-width: var(--measure); margin: 0 0 var(--s4); }
a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--navy-dark); }
small, .meta { font-size: 0.875rem; color: var(--muted); }
code { font-family: var(--mono); font-size: 0.9375rem; }

/* Focus: navy ring with a page-color gap, so it shows on white, tint and navy alike */
:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; box-shadow: 0 0 0 2px var(--page); border-radius: 2px; }

.skip { position: absolute; left: -999px; top: 0; background: var(--page); padding: var(--s3) var(--s4); z-index: 10; }
.skip:focus { left: var(--s2); top: var(--s2); }

.site-head { background: var(--navy); color: var(--page); padding: var(--s3) var(--s4); }
.site-head a { color: var(--page); font-weight: 600; }
.site-head a:focus-visible { outline-color: var(--page); box-shadow: 0 0 0 2px var(--navy); }
.wrap { max-width: 64rem; margin: 0 auto; padding: var(--s5) var(--s4) var(--s7); }
.course-line { color: var(--muted); margin-bottom: var(--s5); }

/* Lab steps */
.steps { list-style: none; padding: 0; margin: 0 0 var(--s6); display: flex; flex-wrap: wrap; gap: var(--s2); max-width: none; }
.steps li { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s2) var(--s3); font-size: 0.875rem; background: var(--page); }
.steps li[aria-current="step"] { background: var(--navy); color: var(--page); border-color: var(--navy); font-weight: 600; }
.steps .done { background: var(--tint); }

/* Panels and callouts */
[hidden] { display: none !important; }
fieldset { min-width: 0; }
.panel { background: var(--tint); border: 1px solid var(--hairline); border-radius: var(--radius); padding: var(--s4); margin: 0 0 var(--s5); }
.callout { border-left: 6px solid var(--navy); background: var(--note-bg); padding: var(--s3) var(--s4); margin: 0 0 var(--s4); max-width: var(--measure); }
.callout strong { display: block; }
.callout p { margin: 0 0 var(--s3); }
.callout.caution { border-color: var(--caution); background: var(--caution-bg); }
.callout.success { border-color: var(--success); background: var(--success-bg); }
.callout.error { border-color: var(--error); background: var(--error-bg); }

/* Form controls */
label { display: block; font-weight: 600; margin-bottom: var(--s1); }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 0.875rem; }
input[type="text"], input[type="number"], select, textarea {
  font: inherit; color: var(--ink); background: var(--page);
  border: 2px solid var(--border); border-radius: var(--radius);
  padding: var(--s2) var(--s3); min-height: var(--target); width: 100%; max-width: 32rem;
}
textarea { min-height: 7rem; max-width: var(--measure); resize: vertical; }
input[type="number"] { max-width: 8rem; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--error); }
textarea[readonly] { background: var(--tint); }
input:disabled, select:disabled, textarea:disabled { background: var(--disabled-bg); color: var(--muted); border-color: var(--hairline); cursor: not-allowed; }
.field { margin: 0 0 var(--s4); }
.field-error { color: var(--error); font-size: 0.875rem; margin-top: var(--s1); }
.range-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
input[type="range"] { accent-color: var(--navy); min-height: var(--target); flex: 1 1 12rem; max-width: 24rem; }

button { font: inherit; font-weight: 600; min-height: var(--target); padding: var(--s2) var(--s4); border-radius: var(--radius); cursor: pointer; }
.btn-primary { background: var(--navy); color: var(--page); border: 2px solid var(--navy); }
.btn-primary:hover { background: var(--navy-dark); border-color: var(--navy-dark); }
.btn-secondary { background: var(--page); color: var(--navy); border: 2px solid var(--navy); }
.btn-secondary:hover { background: var(--note-bg); }
button:disabled { background: var(--disabled-bg); color: var(--border); border-color: var(--hairline); cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s3); margin: 0 0 var(--s4); }

/* Tables */
.table-scroll { overflow-x: auto; margin: 0 0 var(--s4); }
table { border-collapse: collapse; width: 100%; max-width: 48rem; font-variant-numeric: tabular-nums; }
caption { text-align: left; font-weight: 600; padding-bottom: var(--s2); }
th, td { border: 1px solid var(--border); padding: var(--s2) var(--s3); text-align: left; }
thead th { background: var(--table-head); }
td.num, th.num { text-align: right; }

/* Layout: controls beside the graph on wide screens, stacked on a phone */
.bench { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); }
.bench > * { min-width: 0; }
@media (min-width: 56rem) { .bench { grid-template-columns: minmax(16rem, 1fr) minmax(0, 2fr); } }
figure { margin: 0; }
figcaption { font-size: 0.875rem; color: var(--muted); margin-top: var(--s2); }
svg { max-width: 100%; height: auto; display: block; }
.legend { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s4); font-size: 0.875rem; }
.legend svg { display: inline-block; vertical-align: middle; }

/* Graph: series styling reads the tokens directly, so forced-colors can override it */
svg [data-role="axis"] { stroke: var(--ink); }
svg [data-role="grid"] { stroke: var(--hairline); }
svg polyline[data-series="1"], svg line[data-series="1"] { stroke: var(--series-1); fill: none; stroke-width: 3; stroke-dasharray: none; }
svg circle[data-series="1"], svg rect[data-series="1"], svg polygon[data-series="1"] { fill: var(--series-1); stroke: none; }
svg polyline[data-series="2"], svg line[data-series="2"] { stroke: var(--series-2); fill: none; stroke-width: 3; stroke-dasharray: 8 5; }
svg circle[data-series="2"], svg rect[data-series="2"], svg polygon[data-series="2"] { fill: var(--series-2); stroke: none; }
svg polyline[data-series="3"], svg line[data-series="3"] { stroke: var(--series-3); fill: none; stroke-width: 3; stroke-dasharray: 2 5; }
svg circle[data-series="3"], svg rect[data-series="3"], svg polygon[data-series="3"] { fill: var(--series-3); stroke: none; }
svg polyline[data-series="4"], svg line[data-series="4"] { stroke: var(--series-4); fill: none; stroke-width: 3; stroke-dasharray: 10 4 2 4; }
svg circle[data-series="4"], svg rect[data-series="4"], svg polygon[data-series="4"] { fill: var(--series-4); stroke: none; }
svg text { fill: var(--ink); font-family: var(--font); }
.graph-title { font-weight: 600; text-align: left; margin: 0 0 var(--s2); }
.graph-container { width: 100%; }
.legend li { display: flex; align-items: center; gap: var(--s1); }

.measure-offscreen { position: absolute; left: -9999px; top: 0; width: 640px; visibility: hidden; }
.print-report { display: none; }

.swatch { forced-color-adjust: none; display: inline-block; width: 2.5rem; height: 1.5rem; border: 1px solid var(--border); vertical-align: middle; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

@media (forced-colors: active) {
  :focus-visible { outline: 3px solid Highlight; box-shadow: none; }
  .site-head { border-bottom: 1px solid CanvasText; }
  .steps li, .panel, .callout, input, select, textarea, button, th, td, .swatch { border-color: CanvasText; }
  .callout { border-left-width: 6px; border-left-color: CanvasText; }
  .steps li[aria-current="step"] { background: Highlight; color: HighlightText; border-color: Highlight; forced-color-adjust: none; }
  .btn-primary { background: ButtonFace; color: ButtonText; border-color: ButtonText; }
  button:disabled, input:disabled, select:disabled, textarea:disabled { color: GrayText; border-color: GrayText; }
  svg [data-role="axis"], svg polyline[data-series], svg line[data-series] { stroke: CanvasText; }
  svg [data-role="grid"] { stroke: GrayText; }
  svg circle[data-series], svg rect[data-series], svg polygon[data-series] { fill: CanvasText; }
  svg text { fill: CanvasText; }
}

@media print {
  body > *:not(.print-report) { display: none !important; }
  .print-report { display: block; }
  .site-head, .steps, .btn-row, .skip { display: none; }
  .table-scroll { overflow: visible; }
  body { font-size: 11pt; color: black; background: white; }
  h1, h2, h3 { color: black; }
  a { color: black; }
  .panel, .callout { background: none; border: 1px solid black; }
}

/* breadcrumb trail, below the site header */
nav.crumbs { background: var(--tint); border-bottom: 1px solid var(--hairline); padding: .45rem var(--s4); font-size: .9375rem; }
nav.crumbs ol { list-style: none; margin: 0 auto; padding: 0; display: flex; flex-wrap: wrap; gap: .1rem 0; max-width: 64rem; }
nav.crumbs li + li::before { content: "/"; padding: 0 .45rem; color: var(--muted); }
nav.crumbs a { color: var(--navy); text-decoration: underline; text-underline-offset: 2px; }
nav.crumbs a:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
nav.crumbs [aria-current] { color: var(--ink); font-weight: 600; }
@media print { nav.crumbs { display: none; } }
