:root {
  --bg: #ffffff;
  --fg: #000000;
  --line: #000000;
  --panel: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --fg: #ffffff;
    --line: #ffffff;
    --panel: #000000;
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: Menlo, Consolas, "Liberation Mono", monospace;
}

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted var(--line);
}

a:hover { border-bottom-style: solid; }

a:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 10;
  padding: 6px 10px;
  color: var(--bg);
  background: var(--fg);
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.win {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: 100%;
  min-height: 100dvh;
  background: var(--panel);
  border: 1px solid var(--line);
}

.title {
  border-bottom: 1px solid var(--line);
  padding: 6px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 0;
}

.left, .right {
  margin: 0;
  padding: 12px;
  overflow: auto;
  line-height: 1.35;
}

.left {
  border-right: 1px solid var(--line);
  background: var(--panel);
  white-space: pre;
}

.right {
  background: var(--panel);
  white-space: normal;
}

.post-list, .meta, .tree-list, .topic-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav { display: block; }

.site-nav a.is-active {
  font-weight: 700;
  border-bottom-style: solid;
}

.nav-count { opacity: 0.65; }

.page-header {
  margin: 0 0 28px;
  padding: 0 0 20px;
  border-bottom: 1px solid var(--line);
  white-space: normal;
}

.page-header h1 {
  max-width: 32ch;
  margin: 6px 0 8px;
  font-size: clamp(1.55rem, 3vw, 2.3rem);
  line-height: 1.12;
}

.eyebrow {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.page-intro {
  max-width: 70ch;
  margin: 0;
  opacity: 0.72;
}

.home-copy { max-width: 82ch; line-height: 1.65; }

.content-section { margin-top: 42px; }

.section-heading {
  display: flex;
  gap: 16px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
  white-space: normal;
}

.section-heading h2 { margin: 0; font-size: 1.12rem; }
.section-heading > a { flex: 0 0 auto; font-size: 0.82rem; }

.post-list { white-space: normal; }

.post-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 24px;
  margin: 0;
  padding: 12px 0;
  border-bottom: 1px dotted var(--line);
}

.post-item:first-child { border-top: 1px dotted var(--line); }

.post-link {
  display: inline;
  width: fit-content;
  font-weight: 700;
  line-height: 1.35;
}

.post-topic,
.post-date {
  margin-top: 5px;
  font-size: 0.75rem;
  line-height: 1.4;
  opacity: 0.65;
}

.post-topic {
  max-width: 70ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-date {
  margin-top: 1px;
  text-align: right;
}

.post-meta {
  font-size: 0.78rem;
  line-height: 1.45;
  opacity: 0.72;
}

.topic-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  white-space: normal;
}

.topic-list li > a {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  height: 100%;
  padding: 12px;
  border: 1px solid var(--line);
}

.topic-list li > a:hover { border-style: solid; }

.topic-count {
  flex: 0 0 auto;
  font-size: 0.75rem;
  opacity: 0.65;
}

.page-next { margin-top: 24px; white-space: normal; }

.archive-year { margin-top: 34px; white-space: normal; }
.archive-year > h2 { margin: 0 0 18px; font-size: 1.4rem; }

.archive-month {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.archive-month h3 {
  margin: 12px 0 0;
  font-size: 0.85rem;
  font-weight: 400;
  text-transform: uppercase;
}

.post-header .post-meta { margin-top: 14px; }

.post-content {
  max-width: 82ch;
  white-space: normal;
  line-height: 1.65;
}

.post-content img { max-width: 100%; height: auto; }
.post-content pre { overflow-x: auto; }
.post-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.post-content th, .post-content td { padding: 7px 10px; border: 1px solid var(--line); }

.post-pagination {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 48px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  white-space: normal;
}

.post-pagination div:last-child { text-align: right; }
.post-pagination span { display: block; margin-bottom: 6px; font-size: 0.75rem; opacity: 0.6; }
.post-pagination a { line-height: 1.4; }

.empty-state { opacity: 0.65; }

.status {
  border-top: 1px solid var(--line);
  padding: 2px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--panel);
  line-height: 1.1;
}

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .left { border-right: 0; border-bottom: 1px solid var(--line); }
  .post-item { grid-template-columns: 1fr; }
  .post-date { text-align: left; }
  .topic-list { grid-template-columns: 1fr; }
  .archive-month { grid-template-columns: 1fr; gap: 0; }
  .post-pagination { grid-template-columns: 1fr; }
  .post-pagination div:last-child { text-align: left; }
}
