:root {
  --bg: #fffff8;
  --text: #11110f;
  --muted: #777064;
  --faint: #aaa397;
  --line: #ded8c9;
  --accent: #72520f;
  --accent-soft: #f0ead9;
  --code-bg: #f3eedf;
  --sidebar: 15rem;
  --measure: 43rem;
  --wide: 60rem;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Noto Sans Tifinagh", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #161618;
    --text: #ede8dd;
    --muted: #aaa398;
    --faint: #7c756a;
    --line: #33312e;
    --accent: #d0aa5a;
    --accent-soft: #29251d;
    --code-bg: #22211f;
  }
}

:root[data-theme="dark"] {
  --bg: #161618;
  --text: #ede8dd;
  --muted: #aaa398;
  --faint: #7c756a;
  --line: #33312e;
  --accent: #d0aa5a;
  --accent-soft: #29251d;
  --code-bg: #22211f;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
}

a {
  color: var(--text);
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.17em;
}

a:hover {
  color: var(--accent);
}

.skip-link {
  background: var(--text);
  color: var(--bg);
  left: 1rem;
  padding: 0.45rem 0.7rem;
  position: absolute;
  top: -4rem;
  z-index: 10;
}

.skip-link:focus {
  top: 1rem;
}

.site-controls {
  align-items: center;
  display: flex;
  gap: 0.4rem;
  position: fixed;
  right: 0.85rem;
  top: 0.85rem;
  z-index: 20;
}

.theme-toggle,
.language-switch,
.language-switch a {
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
  display: inline-flex;
  font-family: var(--sans);
  font-size: 0.72rem;
  height: 1.85rem;
  justify-content: center;
  line-height: 1;
  text-decoration: none;
}

.theme-toggle {
  cursor: pointer;
  padding: 0;
  width: 1.85rem;
}

.theme-toggle:hover,
.language-switch a:hover,
.language-switch a[aria-current="true"] {
  color: var(--text);
}

.theme-icon,
.language-icon svg {
  fill: none;
  height: 0.95rem;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
  width: 0.95rem;
}

.theme-icon-sun {
  display: none;
}

.theme-toggle[data-theme-state="dark"] .theme-icon-sun {
  display: block;
}

.theme-toggle[data-theme-state="dark"] .theme-icon-moon {
  display: none;
}

.language-switch {
  display: inline-flex;
  gap: 0;
  height: 1.85rem;
  overflow: hidden;
}

.language-icon {
  align-items: center;
  border-right: 1px solid var(--line);
  display: inline-flex;
  height: 100%;
  justify-content: center;
  width: 1.85rem;
}

.language-switch a {
  background: transparent;
  border: 0;
  font-size: 0.68rem;
  height: 100%;
  min-width: 2.15rem;
}

.language-switch a + a {
  border-left: 1px solid var(--line);
}

.language-switch a[aria-current="true"] {
  background: var(--accent-soft);
  color: var(--text);
}

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

.site-header {
  color: var(--muted);
  font-family: var(--sans);
  padding: 2.2rem 1.4rem;
}

.brand {
  align-items: center;
  display: flex;
  gap: 0.7rem;
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  border: 1px solid var(--line);
  color: var(--accent);
  display: inline-flex;
  font-family: "Old English Text MT", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 1.82rem;
  height: 3rem;
  justify-content: center;
  letter-spacing: 0;
  line-height: 1;
  width: 3rem;
}

.brand-name {
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1;
}

.name-mark {
  white-space: nowrap;
}

.name-initial {
  color: var(--accent);
  font-family: "Old English Text MT", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 1.16em;
  line-height: 0;
  margin-right: 0.01em;
}

.brand-name .name-initial {
  font-size: 1.3em;
}

.brand-line {
  font-size: 0.76rem;
  line-height: 1.45;
  margin: 1rem 0 1.8rem;
  max-width: 11rem;
}

.nav-links,
.header-links {
  display: grid;
  gap: 0.35rem;
}

.nav a,
.header-links a {
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: none;
}

.nav a:hover,
.nav a[aria-current="page"],
.header-links a:hover {
  color: var(--text);
}

.header-links {
  border-top: 1px solid var(--line);
  margin-top: 1.8rem;
  padding-top: 1rem;
}

.social-link {
  align-items: center;
  display: inline-flex;
  gap: 0.45rem;
}

.social-icon {
  align-items: center;
  border: 1px solid var(--line);
  color: var(--text);
  display: inline-flex;
  font-family: var(--sans);
  font-size: 0.58rem;
  font-weight: 700;
  height: 1.25rem;
  justify-content: center;
  letter-spacing: 0;
  line-height: 1;
  width: 1.25rem;
}

.social-icon-linkedin {
  font-size: 0.72rem;
}

.site-main,
.site-footer {
  margin: 0 auto;
  max-width: var(--wide);
  padding-left: 1.35rem;
  padding-right: 1.35rem;
}

.site-main {
  padding-bottom: 5rem;
  padding-top: 2.3rem;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.05;
  margin: 0;
}

h1 {
  font-size: 3.45rem;
  letter-spacing: 0;
}

h2 {
  font-size: 1.65rem;
}

h3 {
  font-size: 1.18rem;
}

.post,
.page,
.archive,
.recent-work,
.home-index,
.home-page,
.home-section {
  max-width: var(--measure);
}

.article-header,
.page-header {
  margin-bottom: 1.7rem;
}

.article-header h1,
.page-header h1 {
  max-width: 11ch;
}

.article-header h1 a,
.page-header h1 a,
.list-item h2 a {
  text-decoration: none;
}

.site-author {
  color: var(--text);
  font-variant-caps: small-caps;
  letter-spacing: 0.03em;
  margin: 1.15rem 0 0;
}

.article-meta,
.page-meta {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.76rem;
  line-height: 1.45;
  margin-top: 0.65rem;
}

.article-meta p,
.page-meta p {
  margin: 0;
}

.page-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
}

.page-meta > * + *::before {
  color: var(--faint);
  content: "/";
  padding-right: 0.7rem;
}

.home-affiliation {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.88rem;
  line-height: 1.55;
  margin: 1.05rem 0 0;
  max-width: 33rem;
}

.home-statement {
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 1.8rem 0;
  padding: 1rem 0;
}

.home-statement p {
  margin: 0.55rem 0;
}

.home-statement p:first-child {
  margin-top: 0;
}

.home-statement p:last-child {
  margin-bottom: 0;
}

.home-section {
  margin-top: 2.4rem;
}

.home-section h2 {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  margin-bottom: 0.8rem;
  text-transform: uppercase;
}

.home-section p {
  margin: 0;
}

.signal-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.signal-list li {
  border-top: 1px solid var(--line);
  padding: 0.72rem 0;
}

.prose {
  max-width: var(--measure);
}

.prose > *:first-child {
  margin-top: 0;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre,
.prose table {
  margin: 1.15rem 0;
}

.prose p {
  hanging-punctuation: first last;
}

.prose h2,
.prose h3 {
  margin-top: 2.2rem;
}

.prose h2 {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.cv-section .prose > h2:first-child {
  border-top: 0;
  font-size: 2.05rem;
  margin-top: 0;
  max-width: 17ch;
  padding-top: 0;
}

.cv-section .prose > h2:first-child + p {
  color: var(--text);
  font-size: 1.08rem;
  line-height: 1.55;
}

.prose blockquote {
  border-left: 1px solid var(--accent);
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.55;
  padding-left: 1rem;
}

.prose code {
  background: var(--code-bg);
  font-family: var(--mono);
  font-size: 0.86em;
  padding: 0.08rem 0.2rem;
}

.prose pre {
  background: var(--code-bg);
  overflow: auto;
  padding: 1rem;
}

.prose pre code {
  background: transparent;
  padding: 0;
}

.article-footer {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.78rem;
  margin-top: 1.8rem;
}

.recent-work,
.home-index,
.after-article,
.archive {
  border-top: 1px solid var(--line);
  margin-top: 3rem;
  padding-top: 1rem;
}

.recent-work h2,
.home-index h2,
.link-panel h2 {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  margin-bottom: 0.85rem;
  text-transform: uppercase;
}

.recent-work ol,
.home-index ul,
.home-aside ul,
.link-panel ul,
.tag-cloud,
.taxonomy-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.recent-work li,
.home-index li {
  align-items: baseline;
  display: grid;
  gap: 1rem;
  grid-template-columns: 6.7rem 1fr;
  margin: 0.4rem 0;
}

.recent-work time {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.list-flow {
  border-top: 1px solid var(--line);
}

.list-item {
  border-bottom: 1px solid var(--line);
  padding: 1.2rem 0 1.35rem;
}

.list-item h2 {
  font-size: 1.4rem;
}

.list-item p {
  color: var(--muted);
  margin: 0.55rem 0 0;
}

.eyebrow {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  margin: 0 0 0.25rem;
  text-transform: uppercase;
}

.dek {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0.9rem 0 0;
}

.taxonomy-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.9rem;
}

.taxonomy-list a,
.tag-cloud a {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.75rem;
  text-decoration: none;
}

.taxonomy-list a::before {
  color: var(--accent);
  content: "#";
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
}

.tag-cloud span {
  color: var(--faint);
  margin-left: 0.2rem;
}

.toc {
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.82rem;
  margin-bottom: 1.8rem;
  padding: 0.8rem 0;
}

.toc h2 {
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.84rem;
  font-weight: 500;
}

.toc ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}

.after-article {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr 1fr;
  max-width: calc(var(--measure) + 12rem);
}

.link-panel li + li {
  margin-top: 0.35rem;
}

.media-embed {
  margin: 1.8rem 0;
}

.illustration-figure {
  margin: 1.8rem 0;
}

.illustration-figure img {
  display: block;
  height: auto;
  max-width: 100%;
}

.illustration-figure figcaption {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.78rem;
  margin-top: 0.5rem;
}

.video-frame {
  aspect-ratio: 16 / 9;
  background: var(--code-bg);
  overflow: hidden;
}

.video-frame iframe {
  border: 0;
  display: block;
  height: 100%;
  width: 100%;
}

.media-embed figcaption {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.78rem;
  margin-top: 0.5rem;
}

.document-link {
  border: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  font-family: var(--sans);
  font-size: 0.84rem;
  gap: 0.7rem;
  justify-content: space-between;
  margin: 1.6rem 0;
  padding: 0.9rem;
}

.document-link span {
  display: flex;
  gap: 1rem;
}

.sidenote {
  border-left: 1px solid var(--line);
  color: var(--muted);
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.78rem;
  margin-left: 0.3rem;
  padding-left: 0.45rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-family: var(--sans);
  font-size: 0.76rem;
  gap: 1rem;
  justify-content: space-between;
  padding-bottom: 2rem;
  padding-top: 1.2rem;
}

.site-footer p {
  margin: 0;
}

@media (min-width: 980px) {
  .site-header {
    bottom: 0;
    left: 0;
    position: fixed;
    top: 0;
    width: var(--sidebar);
  }

  .site-main,
  .site-footer {
    margin-left: calc(var(--sidebar) + 2.8rem);
    margin-right: 0;
    max-width: calc(var(--wide) + 8rem);
    padding-left: 0;
  }
}

@media (max-width: 760px) {
  html {
    font-size: 17px;
  }

  .site-header {
    border-bottom: 1px solid var(--line);
    padding: 3.1rem 1.2rem 1.2rem;
  }

  .brand-line {
    max-width: none;
  }

  .nav-links,
  .header-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
  }

  .site-main,
  .site-footer {
    padding-left: 1.15rem;
    padding-right: 1.15rem;
  }

  h1 {
    font-size: 2.45rem;
  }

  .article-header h1,
  .page-header h1 {
    max-width: 13ch;
  }

  .recent-work li,
  .home-index li {
    display: block;
  }

  .recent-work time {
    display: block;
    margin-bottom: 0.08rem;
  }

  .after-article {
    grid-template-columns: 1fr;
  }

  .document-link {
    display: block;
  }

  .document-link span {
    margin-top: 0.45rem;
  }
}
