:root {
  --forest: #151b16;
  --forest-deep: #101612;
  --cream: #f7f0dc;
  --mist: #dfdfce;
  --gold: #efc379;
  --paper: #ede8d9;
  --ink: #202820;
  --subtle-ink: #4e5548;
  --link: #24534a;
  --line: #bdbdad;
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--forest);
  color: var(--cream);
  font: 1rem/1.65 var(--sans);
}

h1, h2, h3, p, blockquote, figure, dl, dd { margin: 0; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: .22em; }
a:hover { text-decoration-thickness: .14em; }
:focus-visible { outline: .16rem solid currentColor; outline-offset: .3rem; }
[id] { scroll-margin-top: 1rem; }

.shell {
  width: min(75rem, calc(100% - 2 * clamp(1rem, 5vw, 4.5rem)));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  inset: .5rem auto auto .5rem;
  z-index: 2;
  padding: .55rem .85rem;
  transform: translateY(calc(-100% - 1rem));
  background: var(--forest-deep);
  color: var(--cream);
}

.skip-link:focus { transform: none; }

.masthead {
  background: var(--forest-deep);
  border-bottom: 1px solid #3b4639;
}

.masthead-inner, .footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .2rem 1.5rem;
}

.masthead-inner { min-height: 4.3rem; padding-block: .3rem; }

.wordmark {
  font: 800 1.15rem/1 var(--mono);
  letter-spacing: -.045em;
  text-decoration: none;
  text-transform: none;
}

.wordmark:hover, .footer-title:hover { color: var(--gold); }

.masthead nav {
  display: flex;
  flex-wrap: wrap;
  column-gap: clamp(.85rem, 4vw, 2.35rem);
}

.masthead nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--mist);
  font: .9rem/1.2 var(--mono);
  text-decoration: none;
}

.masthead nav a:hover, .masthead nav [aria-current] {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: .45rem;
}

.hero {
  background:
    linear-gradient(90deg, #101612 2%, #101612e8 24%, #10161269 57%, #1016120f 100%),
    url("assets/loch-road.webp") center 54% / cover no-repeat,
    var(--forest-deep);
}

.hero-inner {
  display: flex;
  min-height: clamp(27rem, 45vw, 33rem);
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding-block: 3rem 3.7rem;
}

.kicker {
  color: var(--gold);
  font: 650 .875rem/1.4 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 11ch;
  margin-block: .85rem 1.6rem;
  font: 700 clamp(3rem, 7.9vw, 8.2rem)/.91 var(--serif);
  letter-spacing: -.075em;
}

.hero h1 em {
  display: block;
  color: var(--gold);
  font-weight: 400;
}

.hero-deck {
  max-width: 27rem;
  color: var(--cream);
  font-size: clamp(1.075rem, 1.8vw, 1.3rem);
  line-height: 1.55;
}

.hero-link {
  display: inline-flex;
  min-height: 2.8rem;
  align-items: center;
  margin-top: 1.6rem;
  padding: .55rem 1rem;
  border: 1px solid var(--gold);
  background: var(--gold);
  color: var(--forest-deep);
  font: 700 .9rem/1.15 var(--mono);
  text-decoration: none;
}

.hero-link:hover { background: var(--cream); border-color: var(--cream); }
.hero-link:focus-visible { outline-color: var(--cream); }

.paper { background: var(--paper); color: var(--ink); }
.paper a { color: var(--link); }
.paper .kicker { color: var(--link); }

.feed { padding-block: clamp(2rem, 4vw, 3rem) clamp(3rem, 7vw, 6rem); }

.section-title {
  margin-bottom: 1.25rem;
  padding-bottom: .7rem;
  border-bottom: 1px solid var(--line);
  font: 700 clamp(2.2rem, 4vw, 3.65rem)/1.03 var(--serif);
  letter-spacing: -.055em;
}

.dispatches {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 clamp(1.5rem, 4vw, 3.5rem);
}

.dispatches:empty { display: none; }

.dispatch {
  min-width: 0;
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.dispatch--lead {
  padding-block: 0 1.65rem;
}

.dispatch--illustrated {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  align-items: center;
  gap: 1.25rem clamp(1.75rem, 4vw, 4rem);
}

.dispatch-copy > * + * { margin-top: .65rem; }

.dispatch h3 {
  max-width: 22ch;
  font: 700 clamp(1.7rem, 3.2vw, 2.65rem)/1.03 var(--serif);
  letter-spacing: -.045em;
  text-wrap: balance;
}

.dispatch--lead h3 { font-size: clamp(2.15rem, 4.8vw, 4.15rem); }

.dispatch h3 a {
  color: var(--ink);
  text-decoration: none;
}

.dispatch h3 a:hover, .dispatch h3 a:focus-visible {
  color: var(--link);
  text-decoration: underline;
}

.dispatch-cover {
  aspect-ratio: 2.08;
  overflow: hidden;
  border: 1px solid #c8c9bc;
  background: #dfe3d6;
}

.dispatch-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 26%;
}

.dispatch-deck { max-width: 36ch; }
.byline { color: var(--subtle-ink); font: 650 .875rem/1.4 var(--mono); }

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .3rem .9rem;
  color: var(--subtle-ink);
  font: 650 .875rem/1.5 var(--mono);
}

.post-meta time { color: var(--ink); }

.post-category {
  color: var(--link);
  letter-spacing: .065em;
  text-transform: uppercase;
}

.detail-head {
  padding-block: clamp(2rem, 6vw, 4.15rem);
  background: radial-gradient(ellipse at 75% 80%, #2d3b2d, transparent 65%), var(--forest);
}

.detail-inner { max-width: 62rem; }

.detail-head h1 {
  max-width: 19ch;
  margin-top: .7rem;
  font: 700 clamp(2.7rem, 7vw, 6.25rem)/.98 var(--serif);
  letter-spacing: -.062em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.detail-deck {
  max-width: 37rem;
  margin-top: 1rem;
  color: var(--mist);
  font-size: clamp(1.075rem, 2.1vw, 1.3rem);
  line-height: 1.55;
}

.detail-head .byline { margin-top: 1.15rem; color: var(--gold); }
.detail-head .post-meta time { color: var(--cream); }
.detail-head .post-meta .post-category { color: var(--gold); }

.prose {
  max-width: 62rem;
  padding-block: clamp(1.7rem, 5vw, 3.6rem) clamp(2.75rem, 7vw, 5rem);
  font-size: clamp(1.025rem, 1.6vw, 1.15rem);
}

.prose p, .prose ol { max-width: 68ch; }
.prose > * + *, .prose section > * + * { margin-top: 1rem; }
.prose section + section, .prose section + .related { margin-top: 2.3rem; }

.prose h2, .prose h3 {
  font: 700 clamp(1.7rem, 3.5vw, 2.4rem)/1.1 var(--serif);
  letter-spacing: -.04em;
}

.prose h3 { font-size: 1.4rem; }
.prose ol { padding-inline-start: 1.5rem; }
.prose li + li { margin-top: .55rem; }

.prose code { font-family: var(--mono); }

.prose :not(pre) > code {
  padding: .07em .17em;
  border-radius: .15rem;
  background: #dcded0;
  font-size: .85em;
  overflow-wrap: anywhere;
}

.prose pre {
  max-width: 70ch;
  padding: .9rem 1.1rem;
  background: var(--forest);
  color: var(--cream);
  font-size: .9rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.post-figure img {
  width: 100%;
  border: 1px solid var(--line);
}

.video-link { display: block; }

.video-link span {
  display: inline-block;
  margin-top: .6rem;
  font-weight: 650;
}

.measurement-table {
  width: 100%;
  max-width: 47rem;
  border-collapse: collapse;
  color: var(--ink);
  font-size: .95rem;
  line-height: 1.45;
}

.measurement-table caption {
  margin-bottom: .5rem;
  color: var(--subtle-ink);
  font-weight: 650;
  text-align: left;
}

.measurement-table th, .measurement-table td {
  padding: .55rem clamp(.25rem, 1.2vw, .75rem);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.measurement-table thead th {
  background: #e1e3d5;
  color: var(--link);
}

figcaption {
  margin-top: .65rem;
  color: var(--subtle-ink);
  font-size: .925rem;
}

.post-measurements {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.post-measurements > div {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: .45rem;
  padding: clamp(.75rem, 2vw, 1.25rem);
  background: #e1e3d5;
}

.post-measurements dd {
  color: var(--link);
  font: 700 clamp(1.3rem, 3vw, 2rem)/1.1 var(--serif);
}

.post-measurements dt { color: var(--subtle-ink); font-size: .9rem; }

.post-timeline {
  padding: .8rem 1rem;
  border: 1px solid var(--line);
}

.post-timeline summary {
  color: var(--link);
  font-weight: 680;
  cursor: pointer;
}

.post-timeline .post-figure, .post-timeline .measurement-table { margin-top: .9rem; }

.developer-note {
  padding: .6rem 1rem;
  border-inline-start: .22rem solid var(--link);
}

.developer-note blockquote { font: italic 1.2rem/1.6 var(--serif); }
.developer-note figcaption { font: 650 .875rem/1.4 var(--mono); }

.related {
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 1rem;
}

.related ul { margin: .55rem 0 0; padding-inline-start: 1.1rem; }

.site-footer {
  padding-block: 1.2rem;
  background: var(--forest-deep);
  border-top: 1px solid #3b4639;
  color: var(--mist);
  font: .875rem/1.4 var(--mono);
}

.footer-title { color: var(--cream); font-weight: 700; text-decoration: none; }

@media (max-width: 47rem) {
  .hero {
    background:
      linear-gradient(90deg, #101612db, #10161263 68%, #10161223),
      linear-gradient(0deg, #101612df, transparent 80%),
      url("assets/loch-road.webp") 70% 53% / cover no-repeat,
      var(--forest-deep);
  }

  .hero-inner { min-height: 27rem; justify-content: flex-end; }
  .dispatch--illustrated { grid-template-columns: 1fr; }
}

@media (max-width: 36rem) {
  .hero { background:
    linear-gradient(0deg, #101612 4%, #101612be 55%, #10161218 100%),
    url("assets/loch-road.webp") 73% 52% / cover no-repeat,
    var(--forest-deep);
  }

  .hero-inner { min-height: 27.8rem; padding-block: 3.3rem 2rem; }
  .hero h1 { margin-bottom: 1.1rem; }
  .hero-deck { font-size: 1.075rem; }
  .dispatches { grid-template-columns: 1fr; }
  .post-measurements { grid-template-columns: 1fr; }
}

@media (max-width: 23rem) {
  .masthead-inner { column-gap: .6rem; }
  .masthead nav { column-gap: .7rem; }
}

/* Engineering notebook */
.tech-index { display:flex; flex-wrap:wrap; gap:.6rem 1.4rem; padding-block:1rem 1.5rem; border-bottom:1px solid var(--line); font: .9rem/1.5 var(--mono); }
.prose section > .kicker { color:var(--link); margin-bottom:.5rem; }
.architecture { padding:1.6rem; background:var(--forest-deep); color:var(--cream); border:1px solid #405345; }
.architecture figcaption { color:var(--mist); }
.system-flow { display:flex; flex-direction:column; align-items:center; gap:.7rem; }
.system-flow > div { padding:1rem; width:min(100%,35rem); border:1px solid #7e967e; text-align:center; }
.system-flow b, .system-flow span { display:block; }
.system-flow > div span { color:var(--mist); font:.85rem/1.5 var(--mono); margin-top:.4rem; }
.flow-arrow { color:var(--gold); font:.8rem/1.4 var(--mono); }
.class-diagram { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1rem; }
.type-card { border:1px solid var(--line); background:#e1e3d5; min-width:0; }
.type-card h4 { margin:0; padding:.7rem 1rem; background:var(--forest); color:var(--cream); font:600 .95rem/1.4 var(--mono); }
.prose .type-card pre { margin:0; padding:1rem; background:transparent; color:var(--ink); border:0; font-size:.8rem; }
.type-card p { padding:0 1rem 1rem; font-size:.85rem; }
.receipt-flow { display:flex; flex-wrap:wrap; gap:.6rem; align-items:center; padding:1rem; border:1px solid var(--line); }
.worked-example { padding:1.4rem; border-inline-start:4px solid var(--link); background:#e1e3d5; }
.worked-example > * + * { margin-top:1rem; }
.reload-steps { display:grid; gap:.8rem; }
.lab-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1.5rem; }
.lab-grid figcaption { font-size:.85rem; }
.prose .equation { white-space:pre-wrap; }
@media(max-width:47rem) { .class-diagram,.lab-grid { grid-template-columns:1fr; } }

@media(max-width:36rem) {
  .worked-example .measurement-table { overflow-wrap:anywhere; }
}
