:root {
  color-scheme: light dark;
  --page: #ffffff;
  --text: #242424;
  --secondary: #656565;
  --link: #244c91;
  --hairline: #dddddd;
  --accent: #a23b2a;
  --muted-bar: #8a93a3;
  --wash: #f6f5f1;
  --highlight: #fff3a8;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #191a1b;
    --text: #e6e6e6;
    --secondary: #aaaaaa;
    --link: #9abcef;
    --hairline: #454545;
    --accent: #e48b73;
    --muted-bar: #7b8496;
    --wash: #212325;
    --highlight: #4a4420;
  }
}

@font-face {
  font-family: "STIX Two Math Page";
  src: url("/assets/engineering/fonts/stix-two-math-subset.woff2") format("woff2");
  font-display: swap;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 65px 28px 55px;
  background: var(--page);
  color: var(--text);
  font: 400 18px/1.6 Georgia, "Times New Roman", serif;
  overflow-wrap: anywhere;
}

.reading-column {
  max-width: 680px;
  margin: 0 auto;
}

h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 400;
  line-height: 1.3;
}

.byline {
  margin: 0 0 30px;
  color: var(--secondary);
  font-size: 14px;
  line-height: 1.5;
}

h2 {
  margin: 34px 0 12px;
  font-size: 21px;
  font-weight: 400;
  line-height: 1.4;
}

h3 {
  margin: 24px 0 8px;
  font-size: 18px;
  font-style: italic;
  font-weight: 400;
}

p {
  margin: 0 0 20px;
}

ul,
ol {
  margin: 0 0 20px;
  padding-left: 23px;
}

li {
  margin-bottom: 10px;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;
}

.crumbs {
  margin-bottom: 28px;
  color: var(--secondary);
  font-size: 14px;
}

footer {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
  font-size: 14px;
}

footer p {
  margin: 0;
}

/* Math */
.eq {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding: 0.7em 0;
  overflow-x: auto;
}

.eq math {
  flex: 1;
}

.eq .tag {
  color: var(--secondary);
  font-size: 15px;
}

math {
  font-family: "STIX Two Math Page", "STIX Two Math", math, Georgia, serif;
  font-size: 1.14em;
  line-height: normal;
}

p math {
  font-size: 1.04em;
}

math mtable.mat {
  border-left: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  border-radius: 3px;
  padding: 0 0.35em;
}

/* Figures */
figure {
  margin: 28px 0;
}

figcaption {
  margin-top: 8px;
  color: var(--secondary);
  font-size: 14px;
  line-height: 1.5;
}

figure img,
figure svg,
figure video {
  display: block;
  width: 100%;
  height: auto;
}

figure img,
figure video {
  background: #fff;
  border: 1px solid var(--hairline);
}

figure.narrow,
figure.hero-video {
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

figure.hero-video {
  max-width: 540px;
}

.videos {
  display: flex;
  justify-content: center;
  gap: 18px;
}

.videos figure {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
}

/* Inline SVG theme */
svg text {
  fill: var(--text);
  font: 12.5px Georgia, "Times New Roman", serif;
}

svg text.sm {
  font-size: 12px;
  fill: var(--secondary);
}

svg text.b {
  font-weight: 700;
}

svg text.it {
  font-style: italic;
}

svg .sub {
  font-size: 9px;
}

svg .ln,
svg .axis {
  stroke: var(--text);
  stroke-width: 1.2;
  fill: none;
}

svg .axis {
  stroke: var(--secondary);
  stroke-width: 1.6;
}

svg .dash {
  stroke-dasharray: 4 4;
  stroke: var(--secondary);
}

svg .grid {
  stroke: var(--hairline);
}

svg .ray {
  stroke: var(--accent);
  stroke-width: 1.6;
  fill: none;
}

svg .fit {
  stroke: var(--text);
  stroke-width: 1.6;
}

svg .fit.dash {
  stroke: var(--secondary);
  stroke-width: 1.2;
}

svg .dim {
  stroke: var(--accent);
  stroke-width: 2;
}

svg .dot-ink,
svg .fill-ink {
  fill: var(--text);
}

svg .dot-acc,
svg .bar-acc {
  fill: var(--accent);
}

svg .dot-sec,
svg .bar-sec {
  fill: var(--muted-bar);
}

svg .track {
  fill: var(--wash);
}

/* Tables */
.tablewrap {
  margin: 24px 0;
  overflow-x: auto;
}

table {
  overflow-wrap: normal;
  width: 100%;
  border-collapse: collapse;
  border-top: 2px solid var(--text);
  border-bottom: 2px solid var(--text);
  font-size: 15px;
  line-height: 1.4;
}

caption {
  caption-side: top;
  padding-bottom: 8px;
  color: var(--secondary);
  font-size: 14px;
  text-align: left;
}

th,
td {
  padding: 6px 10px 6px 0;
  text-align: left;
  vertical-align: top;
}

thead th {
  border-bottom: 1px solid var(--text);
  font-weight: 500;
}

tbody tr.hl td {
  background: var(--highlight);
  font-weight: 500;
}

tbody tr.hl td:first-child {
  box-shadow: -8px 0 0 var(--highlight);
}

tbody tr + tr td {
  border-top: 1px solid var(--hairline);
}

.n {
  text-align: right;
  white-space: nowrap;
}

.refs {
  font-size: 15px;
  line-height: 1.5;
}

@media (max-width: 630px) {
  body {
    padding: 43px 24px;
    font-size: 17px;
  }

  h1 {
    font-size: 24px;
  }

  .videos {
    flex-direction: column;
    align-items: center;
  }
}

math mfrac {
  padding: 0.1em 0.18em;
}

math msub,
math msup,
math msubsup {
  padding-right: 0.06em;
}

math mo {
  padding: 0 0.03em;
}

math mo.bar {
  padding: 0 0.18em;
}

strong {
  font-weight: 500;
}

/* Index grid */
ul.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
  margin: 0 0 36px;
  padding: 0;
  list-style: none;
}

ul.grid li {
  margin: 0;
}

.card {
  display: block;
  color: inherit;
  text-decoration: none;
}

.card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--hairline);
}

.card .title {
  display: block;
  margin-top: 10px;
  font-size: 17px;
  line-height: 1.35;
  text-decoration: underline;
  text-decoration-color: var(--hairline);
  text-underline-offset: 3px;
}

.card:hover .title {
  text-decoration-color: currentColor;
}

.card .meta {
  display: block;
  margin-top: 4px;
  color: var(--secondary);
  font-size: 14px;
}

/* Index rows */
ul.rows {
  margin: 0 0 36px;
  padding: 0;
  list-style: none;
}

ul.rows li {
  margin: 0 0 20px;
}

.row {
  display: flex;
  align-items: center;
  gap: 16px;
  color: inherit;
  text-decoration: none;
}

.row img {
  flex: 0 0 96px;
  width: 96px;
  height: 72px;
  object-fit: cover;
  border: 1px solid var(--hairline);
}

.row .title {
  display: block;
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.row:hover .title {
  text-decoration-thickness: 2px;
}

.row .meta {
  display: block;
  color: var(--secondary);
  font-size: 14px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  margin: 0 0 34px;
  font-size: 15px;
}

.site-nav a[aria-current="page"] {
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}
