/*
 * Standalone resources (worksheets, notes, worked examples).
 * Link after tokens.css and fonts.css. Works on screen and in print.
 * Orange marks the answer in each worked solution, and nothing else.
 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--frame);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-body-size);
  line-height: var(--text-body-line);
}

a {
  color: var(--ink);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--tangent-text);
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.r-header,
.r-main,
.r-footer {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.r-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--grid);
}

.r-header img {
  display: block;
}

.r-header a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.r-main {
  padding-top: var(--space-8);
  padding-bottom: var(--space-16);
}

.r-footer {
  padding-top: var(--space-4);
  padding-bottom: var(--space-8);
  border-top: 1px solid var(--grid);
  color: var(--muted);
  font-size: var(--text-small-size);
  line-height: var(--text-small-line);
}

h1,
h2 {
  font-family: var(--font-display);
  margin: 0 0 var(--space-4);
}

h1 {
  font-size: var(--text-h1-size);
  line-height: var(--text-h1-line);
  font-weight: var(--text-h1-weight);
}

h2 {
  margin-top: var(--space-16);
  font-size: var(--text-h2-size);
  line-height: var(--text-h2-line);
  font-weight: var(--text-h2-weight);
}

h3 {
  margin: var(--space-8) 0 var(--space-2);
  font-size: var(--text-h3-size);
  line-height: var(--text-h3-line);
  font-weight: var(--text-h3-weight);
}

p,
ul,
ol {
  margin: 0 0 var(--space-4);
  max-width: 70ch;
}

.meta {
  color: var(--muted);
  font-size: var(--text-small-size);
  line-height: var(--text-small-line);
}

.pill {
  display: inline-block;
  padding: 0 var(--space-2);
  border: 1px solid var(--muted);
  border-radius: var(--radius-pill);
  font-size: var(--text-small-size);
  line-height: 22px;
  font-weight: 500;
}

.instructions {
  padding: var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.instructions > :last-child {
  margin-bottom: 0;
}

/* Questions */
.questions {
  padding-left: var(--space-8);
}

.questions > li {
  margin-bottom: var(--space-4);
  padding-left: var(--space-2);
}

.questions .marks {
  color: var(--muted);
  font-size: var(--text-small-size);
}

/* Worked solutions: square corners, surface fill, answer in orange. */
.solution {
  margin: 0 0 var(--space-4);
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-none);
  background: var(--surface);
  break-inside: avoid;
}

.solution h3 {
  margin-top: 0;
  font-size: var(--text-body-size);
  line-height: var(--text-body-line);
}

.solution > :last-child {
  margin-bottom: 0;
}

.answer {
  display: inline-block;
  padding: var(--space-2) var(--space-4);
  border: 3px solid var(--tangent);
  border-radius: var(--radius-none);
  background: var(--frame);
}

.note {
  padding-left: var(--space-4);
  border-left: 3px solid var(--ink);
}

.katex {
  font-size: 1.1em;
}

.katex-display {
  margin: var(--space-4) 0;
  overflow-x: auto;
  overflow-y: hidden;
}

table {
  border-collapse: collapse;
  margin: 0 0 var(--space-4);
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--muted);
  text-align: left;
}

th {
  background: var(--surface);
  font-weight: 600;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

/* Figures inside resources */
figure {
  margin: var(--space-8) 0;
}

figcaption {
  margin-top: var(--space-2);
  color: var(--muted);
  font-size: var(--text-caption-size);
  line-height: var(--text-caption-line);
  font-weight: var(--text-caption-weight);
}

figure svg {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
}

.fig-solid { fill: var(--ink); }
.fig-support { fill: var(--frame); stroke: var(--muted); stroke-width: 2; }
.fig-load { fill: none; stroke: var(--curve-alt); stroke-width: 4; }
.fig-load-head { fill: var(--curve-alt); }
.fig-dim { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.fig-text { fill: var(--ink); font-family: var(--font-math); font-size: 20px; }
.fig-text-muted { fill: var(--muted); font-family: var(--font-math); font-size: 18px; }

@media (max-width: 639px) {
  h1 {
    font-size: 36px;
    line-height: 40px;
  }

  h2 {
    font-size: 28px;
    line-height: 32px;
  }

  .solution {
    padding: var(--space-4);
  }
}

@media print {
  body {
    font-size: 12pt;
    line-height: 1.45;
  }

  .r-header a[href]:not(:first-child),
  .no-print {
    display: none;
  }

  .solutions {
    break-before: page;
  }

  h2 {
    margin-top: var(--space-8);
  }

  a {
    text-decoration: none;
  }
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
