@font-face {
  font-family: "Mac's Minecraft";
  src: url("assets/fonts/macs-minecraft.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --background: #000;
  --surface: #1f1f1f;
  --text: #dedede;
  --muted: #8a8a8a;
  --faint: #4d4d4d;
  --rule: #686868;
  --cyan: #00d7d7;
  --green: #35d04f;
  --magenta: #f05b8d;
  --content-width: 704px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family: "Ubuntu Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, monospace;
  font-size: 17px;
  line-height: 1.42;
  text-rendering: geometricPrecision;
}

a {
  color: inherit;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover,
a:focus-visible {
  color: var(--cyan);
  text-decoration-color: var(--cyan);
}

a:focus-visible {
  outline: 1px solid var(--cyan);
  outline-offset: 4px;
}

.site-shell {
  width: min(calc(100% - 40px), var(--content-width));
  margin: 0 auto;
  padding: 52px 0 40px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 70px;
}

.identity {
  display: inline-flex;
  align-items: center;
  color: var(--cyan);
  font-family: "Mac's Minecraft", monospace;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1;
  text-decoration: none;
}

.identity:visited,
.identity:hover,
.identity:focus-visible {
  color: var(--cyan);
}

nav {
  display: flex;
  gap: 24px;
}

nav a {
  color: var(--muted);
  text-decoration: none;
}

section {
  padding: 0 0 42px;
  margin-bottom: 42px;
}

.section-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  text-transform: lowercase;
}

section > .section-label,
.section-heading,
.terminal-band {
  background: var(--surface);
  border-top: 1px solid #2a2a2a;
  border-bottom: 1px solid #2a2a2a;
}

section > .section-label {
  margin-bottom: 22px;
  padding: 10px 14px;
}

.section-label::before {
  content: "~ ";
  color: var(--cyan);
}

h1 {
  margin: 0 0 4px;
  font-size: clamp(1.55rem, 5vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

h1 a {
  text-decoration: none;
}

.meta {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.94rem;
}

.dek {
  max-width: 640px;
  margin: 0;
  color: #b8b8b8;
}

.continue {
  color: var(--muted);
  white-space: nowrap;
}

.topic-list {
  margin: 0;
  line-height: 1.7;
}

.topic-list a {
  text-decoration-color: var(--rule);
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding: 10px 14px;
}

.terminal-band {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  padding: 10px 14px;
}

.terminal-band .section-label {
  margin: 0;
}

.section-heading .section-label {
  margin-bottom: 0;
}

.section-action {
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
}

.writing-heading {
  margin-bottom: 13px;
}

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

.writing-list li {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 0;
  margin: 0 -10px;
  padding: 5px 10px;
}

.writing-list li:hover {
  background: var(--surface);
}

.writing-list time,
.writing-list .record-id {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.writing-list a {
  text-decoration-color: var(--rule);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 68px;
  color: var(--muted);
  font-size: 0.82rem;
}

.status {
  color: var(--text);
}

.status i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  background: var(--green);
}

.article-header {
  margin-bottom: 38px;
}

.article-header h1,
.writing-index h1 {
  margin-bottom: 10px;
}

.article-header .meta {
  margin-bottom: 0;
}

.meta a {
  color: var(--muted);
}

.article-body {
  color: #c8c8c8;
  line-height: 1.58;
}

.article-body > :first-child {
  margin-top: 0;
}

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

.article-body p,
.article-body ul,
.article-body ol,
.article-body blockquote,
.article-body pre {
  margin-top: 0;
  margin-bottom: 1.25em;
}

.article-body ul,
.article-body ol {
  padding-left: 1.45em;
}

.article-body li + li {
  margin-top: 0.22em;
}

.article-body strong {
  color: var(--text);
}

.article-body h2,
.article-body h3 {
  margin: 2em 0 0.65em;
  color: var(--text);
  line-height: 1.2;
}

.article-body h2 {
  font-size: 1.35rem;
}

.article-body h3 {
  font-size: 1.08rem;
}

.article-body blockquote {
  margin-left: 0;
  padding-left: 16px;
  border-left: 2px solid var(--cyan);
  color: var(--muted);
}

.article-body pre {
  position: relative;
  overflow-x: auto;
  padding: 15px 16px;
  background: var(--surface);
  border-left: 2px solid var(--cyan);
  font-size: 0.92rem;
  line-height: 1.45;
}

.article-body pre.code-block {
  padding-top: 35px;
}

.code-block::before {
  content: attr(data-language);
  position: absolute;
  top: 9px;
  right: 12px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1;
  text-transform: lowercase;
}

.article-body code {
  color: var(--cyan);
  font-family: inherit;
}

.article-body pre code {
  color: var(--text);
}

.hljs-comment,
.hljs-quote,
.hljs-meta {
  color: var(--muted);
}

.hljs-keyword,
.hljs-literal,
.hljs-selector-tag,
.hljs-type {
  color: var(--magenta);
}

.hljs-attr,
.hljs-regexp,
.hljs-string,
.hljs-template-variable,
.hljs-title.class_ {
  color: var(--green);
}

.hljs-built_in,
.hljs-property,
.hljs-title,
.hljs-variable.language_ {
  color: var(--cyan);
}

.hljs-bullet,
.hljs-number,
.hljs-symbol {
  color: #d7af5f;
}

.hljs-emphasis {
  font-style: italic;
}

.hljs-strong {
  font-weight: 700;
}

.article-body hr {
  margin: 2.5em 0;
  border: 0;
  border-top: 1px solid var(--faint);
}

.article-pagination {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
  margin-top: 58px;
  padding-top: 18px;
  border-top: 1px solid var(--faint);
  color: var(--muted);
  font-size: 0.88rem;
}

.article-pagination a {
  text-decoration: none;
}

.article-pagination a:last-child {
  text-align: right;
}

.writing-index {
  margin-bottom: 0;
  padding-bottom: 0;
}

.index-dek {
  margin-bottom: 34px;
}

.writing-index .writing-list {
  margin-top: 30px;
}

.recent-notes {
  margin-bottom: 42px;
  padding-bottom: 0;
}

.notes-index > .recent-notes {
  margin-top: 34px;
}

.recent-note-list,
.map-note-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.recent-note-list li {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 12px;
  margin: 0 -10px;
  padding: 5px 10px;
}

.recent-note-list li:hover,
.map-note-list li:hover {
  background: var(--surface);
}

.recent-note-list .record-id,
.recent-note-list time,
.map-note-list .record-id,
.map-note-list li > span:last-child {
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.place-domains,
.project-domains {
  margin-bottom: 48px;
  padding-bottom: 0;
}

.place-domains .section-heading,
.project-domains .section-heading {
  margin-bottom: 12px;
}

.domain-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.domain-cards > a {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  min-height: 94px;
  padding: 15px;
  background: var(--surface);
  border: 1px solid #2a2a2a;
  text-decoration: none;
}

.domain-cards small {
  color: var(--muted);
  font-size: 0.8rem;
}

.project-index {
  margin-bottom: 0;
  padding-bottom: 0;
}

.project-index > .project-note-list {
  margin-top: 34px;
}

.research-index > .place-domains {
  margin-top: 34px;
}

.research-notes {
  margin-bottom: 0;
  padding-bottom: 0;
}

.research-notes > .section-heading {
  margin-bottom: 8px;
}

.category-jump {
  display: block;
  margin: 0 0 48px;
  color: var(--muted);
  line-height: 1.7;
}

.category-jump a {
  color: inherit;
}

.note-group {
  margin-bottom: 34px;
  padding-bottom: 0;
}

.note-group .section-heading {
  margin-bottom: 8px;
}

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

.note-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 0.72fr);
  gap: 24px;
  margin: 0 -10px;
  padding: 6px 10px;
}

.note-list li:hover {
  background: var(--surface);
}

.note-list li > span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-list a {
  min-width: 0;
}

.back-to-index {
  margin: 56px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--faint);
  color: var(--muted);
  font-size: 0.88rem;
}

.back-to-index a {
  text-decoration: none;
}

.about-page .article-body > p:first-child {
  color: var(--text);
  font-size: 1.08rem;
}

.article-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5em 0;
  background: var(--surface);
}

.article-body table {
  display: block;
  width: 100%;
  overflow-x: auto;
  margin: 1.5em 0;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.article-body th,
.article-body td {
  padding: 7px 10px;
  border: 1px solid var(--faint);
  text-align: left;
  vertical-align: top;
}

.article-body th {
  color: var(--text);
  background: var(--surface);
}

.bookshelf-page .site-shell,
.map-page .site-shell {
  width: min(calc(100% - 40px), 980px);
}

.bookshelf,
.map-index {
  margin-bottom: 0;
  padding-bottom: 0;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 30px 16px;
}

.bookshelf > .book-grid,
.map-index > .map-frame {
  margin-top: 34px;
}

.book {
  min-width: 0;
  margin: 0;
}

.book img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: var(--surface);
  filter: saturate(0.86) contrast(1.04);
}

.book figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.map-frame {
  margin-bottom: 24px;
  padding: 10px;
  background: var(--surface);
  border-top: 1px solid #2a2a2a;
  border-bottom: 1px solid #2a2a2a;
}

.domain-map {
  width: 100%;
  height: min(58vh, 560px);
  min-height: 420px;
  background: #101010;
}

.embedded-map-frame {
  margin: 1.5em 0;
  padding: 8px;
  background: var(--surface);
  border-top: 1px solid #2a2a2a;
  border-bottom: 1px solid #2a2a2a;
}

.embedded-map {
  width: 100%;
  height: 360px;
  background: #101010;
}

.map-status {
  margin: 0;
  padding: 18px;
  color: var(--muted);
}

:is(.domain-map, .embedded-map) .leaflet-tile-pane {
  filter: grayscale(1) invert(1) contrast(0.82) brightness(0.7);
}

.domain-map.leaflet-container,
.embedded-map.leaflet-container {
  color: var(--text);
  font: inherit;
}

:is(.domain-map, .embedded-map) .leaflet-control-zoom a,
:is(.domain-map, .embedded-map) .leaflet-control-attribution {
  color: var(--muted);
  background: var(--surface);
}

:is(.domain-map, .embedded-map) .leaflet-control-zoom a {
  border-color: var(--faint);
}

:is(.domain-map, .embedded-map) .leaflet-popup-content-wrapper,
:is(.domain-map, .embedded-map) .leaflet-popup-tip,
.embedded-map .leaflet-tooltip {
  color: var(--text);
  background: var(--surface);
  border-color: var(--faint);
  border-radius: 0;
  box-shadow: none;
}

:is(.domain-map, .embedded-map) .leaflet-popup-content {
  margin: 10px 12px;
  font: inherit;
}

:is(.domain-map, .embedded-map) .leaflet-popup-content a {
  color: var(--cyan);
}

.map-note-list li {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 12px;
  margin: 0 -10px;
  padding: 6px 10px;
}

.map-references {
  margin: 42px 0 0;
  padding: 0;
}

.map-references .note-list li {
  grid-template-columns: 1fr;
}

@media (max-width: 620px) {
  body {
    font-size: 16px;
  }

  .site-shell {
    width: min(calc(100% - 28px), var(--content-width));
    padding-top: 28px;
  }

  .bookshelf-page .site-shell,
  .map-page .site-shell {
    width: calc(100% - 28px);
  }

  .site-header {
    align-items: flex-start;
    margin-bottom: 52px;
  }

  nav {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px 16px;
  }

  .writing-list li {
    grid-template-columns: 48px 1fr;
  }

  footer {
    flex-direction: column;
    gap: 5px;
  }

  .article-pagination {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .article-pagination a:last-child {
    text-align: left;
  }

  .note-list li {
    grid-template-columns: 1fr;
    gap: 1px;
  }

  .note-list li > span {
    text-align: left;
  }

  .recent-note-list li {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .recent-note-list time {
    display: none;
  }

  .domain-cards {
    gap: 8px;
  }

  .domain-cards > a {
    min-height: 88px;
    padding: 12px;
  }

  .book-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px 10px;
  }

  .book figcaption {
    font-size: 0.72rem;
  }

  .map-frame {
    margin-right: -14px;
    margin-left: -14px;
    padding: 7px;
  }

  .domain-map {
    height: 58vh;
    min-height: 360px;
  }

  .embedded-map-frame {
    margin-right: -7px;
    margin-left: -7px;
    padding: 6px;
  }

  .embedded-map {
    height: 310px;
  }

  .map-note-list li {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .map-note-list li > span:last-child {
    display: none;
  }
}
