@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/inter/regular.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/inter/semibold.woff2") format("woff2");
}

@font-face {
  font-family: "EB Garamond";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/eb-garamond/regular.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --paper: #fff;
  --ink: #030330;
  --body: #303346;
  --muted: #686a7b;
  --line: #dfdfe7;
  --accent: #80601f;
  --surface: #f6f6f9;
  --plot-actual: #030330;
  --plot-estimate: #80601f;
  --plot-sensor: #428354;
  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-mode="dark"] {
  color-scheme: dark;
  --paper: #030330;
  --ink: #f6f4ed;
  --body: #d3d4e1;
  --muted: #a1a4be;
  --line: #29294b;
  --accent: #d7b971;
  --surface: #10103e;
  --plot-actual: #a6c6e0;
  --plot-estimate: #d7b971;
  --plot-sensor: #78bf8c;
}

* { box-sizing: border-box; }
html {
  font-size: 100%;
  background: var(--paper);
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 2rem;
}
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 1rem/1.75 var(--sans);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "kern", "liga", "calt";
}
::selection { color: var(--paper); background: var(--accent); }
a {
  color: inherit;
  text-decoration-color: var(--line);
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
}
a:hover { color: var(--accent); text-decoration-color: var(--accent); }
a, button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button, input { font: inherit; }
button { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
main:focus, .protected-post-content:focus { outline: none; }
[hidden] { display: none !important; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4, p, figure { margin: 0; }
h1, h2, h3, h4 { font-weight: 400; overflow-wrap: break-word; }
h1 { font: 400 2rem/1.2 var(--serif); letter-spacing: -.015em; }
h2 { font: 400 1.5rem/1.3 var(--serif); }
h3 { font: 400 1.25rem/1.4 var(--serif); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.skip-link { position: absolute; top: -100px; left: 1rem; background: var(--paper); padding: .5rem; }
.skip-link:focus { top: 1rem; }

/* A quiet navigation column beside the page. */
.site-shell {
  display: grid;
  grid-template-columns: 9rem minmax(0, 36rem);
  gap: 5.5rem;
  max-width: 54.5rem;
  margin: 0 auto;
  padding: 7.25rem 2rem 6rem;
}
.site-content { min-width: 0; }
.site-sidebar { position: sticky; top: 7.25rem; align-self: start; padding-top: .4rem; }
.main-nav { display: flex; flex-direction: column; gap: .15rem; }
.main-nav a {
  position: relative;
  width: fit-content;
  color: var(--muted);
  text-decoration: none;
  font-size: .875rem;
  line-height: 1.7;
  padding: .25rem 0;
}
.main-nav a[aria-current] { color: var(--ink); font-weight: 600; }
.main-nav a[aria-current]::before {
  content: "";
  position: absolute;
  left: -1rem;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: var(--accent);
}
.sidebar-links { display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; margin-top: 2rem; }
.sidebar-label { color: var(--muted); font-size: .75rem; margin-bottom: .4rem; }
.sidebar-links a { color: var(--muted); text-decoration: none; font-size: .8125rem; line-height: 1.7; padding-block: .1rem; }
.sidebar-links a:hover, .main-nav a:hover { color: var(--accent); }
.site-utilities { display: flex; flex-direction: column; align-items: flex-start; gap: .45rem; margin-top: .65rem; }
.theme-toggle { display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem; margin-left: -.75rem; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.theme-toggle:hover { background: var(--surface); }
.theme-icon { font: 1.125rem/1 "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.utc-clock { display: block; color: var(--muted); font: .75rem/1.5 var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Introductions and plain text. */
.home-heading { display: grid; grid-template-columns: minmax(0, 1fr) 72px; align-items: center; gap: 2rem; margin: -.8rem 0 1.8rem; }
.home-heading h1 { font-size: 2.5rem; line-height: 1.1; letter-spacing: -.025em; }
.home-location { color: var(--muted); font-size: .8125rem; margin-top: .6rem; }
.home-portrait { display: block; width: 72px; text-decoration: none; }
.home-portrait img { width: 72px; height: 96px; object-fit: contain; mix-blend-mode: multiply; }
:root[data-mode="dark"] .home-portrait img { filter: invert(1); mix-blend-mode: screen; }
.home-prose { font-size: 1rem; line-height: 1.85; }
.home-prose p:last-child { color: var(--muted); font-size: .9375rem; margin-top: 1.8rem; }
.page-heading { margin-bottom: 2rem; }
.page-deck { color: var(--muted); font-size: 1rem; line-height: 1.65; margin-top: .65rem; }
.back-link { display: inline-block; font-size: .8125rem; color: var(--muted); text-decoration: none; margin-bottom: 1.8rem; }
.prose { overflow-wrap: break-word; color: var(--body); }
.prose h2, .prose h3, .prose h4 { color: var(--ink); }
.prose a { color: var(--accent); }
.prose a:hover { color: var(--accent); }
.prose p { margin-bottom: 1.5em; }
.prose p:last-child { margin-bottom: 0; }
.prose h2 { margin: 2.25rem 0 .75rem; }
.prose h3 { margin: 1.8rem 0 .65rem; }
.prose h4 { font-size: 1rem; font-weight: 600; margin: 1.75rem 0 .6rem; }
.prose strong { font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.25em; margin: 1em 0 1.5em; }
.prose li { padding-left: .25em; margin: .45em 0; }
.prose li p { margin: .65em 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.prose blockquote { color: var(--muted); border-left: 1px solid var(--line); padding-left: 1.25rem; margin: 1.75rem 0; }
.prose blockquote p { margin: 0; }
.prose img { margin: 1.75rem auto; }
.prose figure { margin: 1.75rem 0; }
.prose figure img { margin: 0; }
.prose figcaption { color: var(--muted); font-size: .8125rem; line-height: 1.6; margin-top: .5rem; }
.prose pre { max-width: 100%; overflow: auto; background: var(--surface); padding: 1rem; font: .875rem/1.65 var(--mono); tab-size: 2; }
.prose code { font-family: var(--mono); font-size: .875em; background: var(--surface); padding: .1em .2em; }
.prose pre code { font-size: inherit; background: none; padding: 0; }
.prose table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin-block: 1.5rem; font-size: .9375rem; }
.prose th, .prose td { text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); padding: .75rem 1rem .75rem 0; }
.prose th { font-weight: 600; }
.prose iframe { max-width: 100%; }
.prose mjx-container[display="true"] { max-width: 100%; overflow-x: auto; overflow-y: hidden; padding-block: .5rem; }
.site-credit { color: var(--muted); font-size: .8125rem; line-height: 1.65; margin-top: 2.5rem; }
.site-credit a { color: var(--accent); }
.site-credit strong { font-weight: 600; }

/* Simple indexes, with dates kept secondary. */
.writing-list { border-top: 1px solid var(--line); }
.writing-row { text-decoration: none; color: var(--ink); display: flex; justify-content: space-between; align-items: baseline; gap: 1.25rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.writing-row-title { display: flex; align-items: baseline; gap: .6rem; min-width: 0; }
.writing-row:hover .writing-title { text-decoration: underline; text-underline-offset: .2em; }
.writing-row time, .work-year { flex-shrink: 0; color: var(--muted); font-size: .8125rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.private-label { flex-shrink: 0; color: var(--muted); }
.index-footer { color: var(--muted); font-size: .8125rem; margin-top: 1.5rem; }
.index-footer a { text-decoration-color: var(--line); }
.pagination { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; font-size: .875rem; }
.pagination span { color: var(--muted); }
.project-entry { display: block; text-decoration: none; padding: 1.15rem 0; border-bottom: 1px solid var(--line); }
.project-entry:hover h2 { color: var(--accent); }
.project-entry:first-child { border-top: 1px solid var(--line); }
.project-entry-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 1.5rem; }
.project-entry h2, .project-entry h3 { font: 400 1rem/1.6 var(--sans); }
.project-entry h2 a, .project-entry h3 a { text-decoration: none; }
.project-entry h2 a:hover, .project-entry h3 a:hover { text-decoration: underline; }
.project-entry p { font-size: .875rem; color: var(--muted); line-height: 1.7; margin-top: .5rem; }
.experiments, .friends { margin-top: 2.5rem; }
.experiments h2, .friends h2 { margin-bottom: .8rem; }
.simple-list { list-style: none; padding: 0; margin: 0; }
.simple-list li { margin-bottom: .55rem; }
.friends .simple-list { display: flex; gap: 1.25rem; flex-wrap: wrap; font-size: .875rem; }
.category-section + .category-section { margin-top: 2.5rem; }
.category-section > h2 { margin-bottom: 1rem; }
.subject-index { list-style: none; padding: 0; margin: 0; }
.subject-index li { padding: .8rem 0; border-bottom: 1px solid var(--line); }
.subject-index a { text-decoration: none; }
.subject-index a:hover { text-decoration: underline; }

/* Essays, including the original access-code flow. */
.article-heading { margin-bottom: 2rem; }
.article-meta { display: flex; flex-wrap: wrap; gap: 1rem; color: var(--muted); font-size: .8125rem; margin-top: .8rem; }
.article-heading .page-deck { margin-top: 1.1rem; }
.article-image { margin-bottom: 1.75rem; }
.article-footer { display: flex; flex-wrap: wrap; align-items: baseline; gap: 1.5rem; border-top: 1px solid var(--line); margin-top: 3rem; padding-top: 1.1rem; font-size: .8125rem; color: var(--muted); }
.subject-links { display: flex; flex-wrap: wrap; gap: .5rem 1rem; font-size: .8125rem; color: var(--muted); }
.subject-links a, .article-footer > a { text-decoration-color: var(--line); }
.protected-post-gate { border: 1px solid var(--line); padding: 1.5rem; }
.protected-post-gate h2 { font-size: 1.5rem; }
.protected-post-gate > p { color: var(--muted); font-size: .9375rem; margin-top: .5rem; }
.protected-post-gate form { margin-top: 1.5rem; }
.protected-post-gate label { display: block; font-size: .8125rem; margin-bottom: .4rem; }
.protected-post-controls { display: flex; gap: .6rem; }
.protected-post-controls input { min-width: 0; flex: 1; padding: .55rem .75rem; border: 1px solid var(--line); border-radius: 2px; background: var(--paper); color: var(--ink); }
.protected-post-controls button { padding: .55rem 1.1rem; border: 1px solid var(--ink); border-radius: 2px; background: var(--ink); color: var(--paper); cursor: pointer; font-size: .875rem; }
.protected-post-controls button:hover { background: var(--accent); border-color: var(--accent); }
.protected-post-controls button:disabled { cursor: wait; opacity: .65; }
.protected-post-status { font-size: .875rem; }
.protected-post-status:not(:empty) { margin-top: .65rem; }
.is-error { color: var(--accent); }
.protected-post-gate > .protected-post-privacy { font-size: .75rem; margin-top: 1rem; }
.comments { margin-top: 2rem; }

/* Long project stories retain every image and gallery. */
.project-heading { margin-bottom: 1.75rem; }
.project-facts { margin-top: 1.5rem; }
.project-facts dl { margin: 0; font-size: .875rem; line-height: 1.6; }
.project-facts dl > div { display: grid; grid-template-columns: 3rem minmax(0, 1fr); gap: 1rem; margin-bottom: .35rem; }
.project-facts dt { color: var(--muted); }
.project-facts dd { margin: 0; }
.project-heading .subject-links { margin-top: 1.1rem; }
.project-blurb { margin-bottom: 1.75rem; }
.project-hero { margin: 1.75rem 0 2rem; }
.project-hero img { width: 100%; }
.project-body h2:first-child, .project-body h3:first-child { margin-top: 0; }
.project-gallery { display: grid; grid-template-columns: 1fr; gap: 2rem; margin-top: 2.5rem; }
.project-gallery img { width: 100%; }
.project-gallery figcaption { font-size: .8125rem; line-height: 1.6; color: var(--muted); margin-top: .65rem; }
.story-end { display: flex; justify-content: space-between; gap: 1.25rem; border-top: 1px solid var(--line); padding-top: 1.2rem; margin-top: 2.5rem; font-size: .8125rem; color: var(--muted); }
.video-embed { position: relative; width: 100%; aspect-ratio: 16 / 9; background: var(--surface); margin-block: 1.75rem; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

@media (max-width: 900px) {
  .site-shell { grid-template-columns: 7rem minmax(0, 36rem); gap: 3rem; }
}

@media (max-width: 720px) {
  .site-shell { grid-template-columns: 1fr; max-width: 39rem; gap: 2rem; padding: .75rem 1.5rem 3rem; }
  .site-sidebar { display: contents; }
  .main-nav { grid-row: 1; flex-direction: row; flex-wrap: wrap; gap: .25rem 1.5rem; border-bottom: 1px solid var(--line); padding-bottom: .5rem; }
  .main-nav a { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; font-size: .875rem; padding: .6rem 0; }
  .main-nav a[aria-current]::before { width: auto; height: 2px; left: 0; right: 0; top: auto; bottom: -.55rem; border-radius: 0; transform: none; }
  .site-content { grid-row: 2; }
  .sidebar-links { grid-row: 3; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: .5rem 1.4rem; margin-top: 1rem; }
  .sidebar-label { display: none; }
  .sidebar-links a { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; font-size: .8125rem; }
  .site-utilities { flex-basis: 100%; flex-direction: row; align-items: center; gap: .6rem; margin-top: 0; }
  .home-heading { grid-template-columns: minmax(0, 1fr) 56px; gap: 1rem; margin: -.25rem 0 1.7rem; }
  .home-heading h1 { font-size: clamp(1.85rem, 6vw, 2.25rem); }
  .home-portrait, .home-portrait img { width: 56px; }
  .home-portrait img { height: 75px; }
  .home-location { font-size: .75rem; margin-top: .5rem; }
  .home-prose { line-height: 1.8; }
  .page-heading { margin-bottom: 1.6rem; }
  .writing-row { gap: .8rem; }
  .writing-row-title { gap: .4rem; }
  .writing-row time, .work-year { font-size: .75rem; }
  .project-entry-heading { gap: 1rem; }
  .back-link { margin-bottom: 1.4rem; }
  .protected-post-gate { padding: 1.2rem; }
  .protected-post-controls input, .protected-post-controls button { min-height: 44px; }
}

@media (max-width: 380px) {
  .site-shell { padding-inline: 1.25rem; }
  .main-nav { gap: .25rem 1.2rem; }
  .project-entry-heading { flex-wrap: wrap; gap: .1rem 1rem; }
  .writing-row { flex-wrap: wrap; gap: .1rem 1rem; }
  .protected-post-controls { flex-direction: column; }
}

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

@media print {
  :root { --paper: #fff; --ink: #111; --body: #222; --muted: #555; --line: #ccc; --accent: #333; }
  .site-shell { display: block; max-width: none; padding: 0; }
  .site-sidebar, .skip-link, .back-link, .story-end { display: none; }
  body { font-size: 11pt; }
  .prose h2, .prose h3 { break-after: avoid; }
  figure, img, .protected-post-gate { break-inside: avoid; }
}

.experiment-index { list-style: none; margin: 0; padding: 0; }
.experiment-index li + li { border-top: 1px solid var(--line); }
.experiment-index a { display: block; padding: .9rem 0; text-decoration: none; }
.experiment-index a > span { display: block; font-size: 1rem; }
.experiment-index a > small { display: block; color: var(--muted); font-size: .875rem; line-height: 1.65; margin-top: .3rem; }
.experiment-index a:hover > span { text-decoration: underline; text-underline-offset: .2em; }
