:root {
  --bg: #f5f1e8;
  --paper: #fffdf9;
  --text: #1d1b18;
  --muted: #6e675f;
  --line: #ddd3c7;
  --accent: #8f3b24;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #efe7d9 0%, var(--bg) 28%, #f7f4ee 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  line-height: 1.7;
  min-height: 100vh;
}

a {
  color: inherit;
}

.site-header,
.site-footer,
.page {
  width: min(760px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header .inner,
.site-footer .inner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  padding: 0.85rem 0 0.7rem;
}

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

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  margin-top: 1rem;
}

.brand,
.footer-mark,
nav a {
  text-decoration: none;
}

.brand,
.footer-mark {
  font-size: 1.1rem;
  line-height: 1.3;
  letter-spacing: 0;
}

.brand {
  color: #3a332d;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.3;
}

.nav-link.active {
  color: var(--accent);
}

.page {
  padding: 0.5rem 0 0.75rem;
}

.intro,
.post {
  background: rgba(255, 253, 249, 0.78);
  border: 1px solid rgba(221, 211, 199, 0.65);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 16px 40px rgba(36, 24, 14, 0.05);
  overflow-x: hidden;
}

.post-list {
  margin-top: 1.5rem;
  display: grid;
  gap: 1rem;
}

.archive > .post-list:first-child {
  margin-top: 0;
}

.archive-header {
  margin-bottom: 1rem;
}

.post-header {
  margin-bottom: 1.15rem;
}

.archive-intro p {
  margin: 0.5rem 0 0;
  color: var(--muted);
}

.archive-header h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.1;
}

.post-card {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
}

.post-card-anchor {
  display: block;
  text-decoration: none;
  transition: transform 140ms ease, color 140ms ease;
}

.post-card:last-child {
  border-bottom: 0;
}

.taxonomy-card {
  padding-bottom: 1rem;
}

.taxonomy-title-link,
.taxonomy-preview-link {
  text-decoration: none;
}

.taxonomy-title-link:hover,
.taxonomy-title-link:focus-visible,
.taxonomy-preview-link:hover,
.taxonomy-preview-link:focus-visible {
  color: var(--accent);
}

.taxonomy-preview {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.taxonomy-separator {
  display: inline-block;
  margin: 0 0.42rem;
}

.post-card h2,
.post-header h1,
.intro h1 {
  margin: 0 0 0.5rem;
  line-height: 1.2;
}

.post-header h1 {
  margin-bottom: 0;
}

.meta,
.summary,
.source-meta,
.source-block,
.source-block a,
.terms,
.site-footer {
  color: var(--muted);
}

.source-meta {
  margin: -0.1rem 0 0.5rem;
  font-style: italic;
}

.post-card-link .source-meta:last-child {
  margin-bottom: 0;
}

.post-card-link:hover .post-card-anchor,
.post-card-link:focus-within .post-card-anchor {
  color: var(--accent);
  transform: translateX(3px);
}

.post-card-link:hover .meta,
.post-card-link:focus-within .meta,
.post-card-link:hover .source-meta,
.post-card-link:focus-within .source-meta {
  color: var(--accent);
}

.source-block {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.98rem;
}

.source-block p {
  margin: 0.2rem 0;
}

.footer-mark {
  margin: 0;
  font-size: 0.98rem;
  text-align: right;
  width: 100%;
}

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

.prose a,
.source-block a,
.terms a {
  color: var(--accent);
  text-decoration: none;
}

.prose a:hover,
.prose a:focus-visible,
.source-block a:hover,
.source-block a:focus-visible,
.terms a:hover,
.terms a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.prose {
  min-width: 0;
  overflow-x: auto;
}

.prose blockquote {
  margin: 1.4rem 0;
  padding: 0.9rem 1.1rem 0.9rem 1.25rem;
  background: rgba(143, 59, 36, 0.06);
  border-left: 4px solid var(--accent);
  border-radius: 0 10px 10px 0;
  color: #3f3730;
}

.prose blockquote p {
  margin: 0;
}

.prose table {
  width: 100%;
  min-width: min(680px, 100%);
  margin: 1.4rem 0;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.55;
}

.prose th,
.prose td {
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(221, 211, 199, 0.9);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.prose th {
  background: rgba(143, 59, 36, 0.08);
  color: #312a24;
  font-weight: 700;
}

.prose tbody tr:nth-child(even) {
  background: rgba(255, 253, 249, 0.68);
}

.prose tbody tr:nth-child(odd) {
  background: rgba(245, 241, 232, 0.42);
}

.paper-table-figure {
  margin: 1.7rem 0 2rem;
}

.paper-table-figure figcaption {
  margin-bottom: 0.9rem;
  padding: 0.55rem 0 0.65rem;
  border-top: 2px solid rgba(61, 49, 39, 0.72);
  border-bottom: 1px solid rgba(61, 49, 39, 0.72);
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.prose .paper-acm-table,
.prose .paper-mini-table {
  width: 100%;
  min-width: 0;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.98rem;
  line-height: 1.5;
}

.prose .paper-acm-table th,
.prose .paper-acm-table td,
.prose .paper-mini-table th,
.prose .paper-mini-table td {
  background: none;
  border: 0;
  padding: 0.35rem 0.5rem;
  color: var(--text);
  overflow-wrap: normal;
  word-break: normal;
}

.prose .paper-acm-table tbody tr:nth-child(even),
.prose .paper-acm-table tbody tr:nth-child(odd),
.prose .paper-mini-table tbody tr:nth-child(even),
.prose .paper-mini-table tbody tr:nth-child(odd) {
  background: none;
}

.paper-acm-table--axioms th[scope="row"] {
  width: 3.8rem;
  padding-left: 0;
  white-space: nowrap;
  font-weight: 600;
}

.paper-acm-table--axioms td:nth-child(2) {
  width: 52%;
  white-space: nowrap;
}

.paper-acm-table--axioms td:nth-child(3) {
  width: 48%;
}

.paper-mini-sections {
  display: grid;
  gap: 1.2rem;
}

.paper-mini-section {
  padding-bottom: 1.1rem;
  border-bottom: 1px solid rgba(61, 49, 39, 0.25);
}

.paper-mini-section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.paper-mini-heading {
  margin: 0 0 0.8rem;
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
}

.paper-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.prose .paper-mini-table {
  width: min(100%, 16rem);
  margin: 0 auto;
  font-variant-numeric: tabular-nums;
}

.prose .paper-mini-table th,
.prose .paper-mini-table td {
  padding: 0.15rem 0.45rem;
  text-align: center;
  white-space: nowrap;
}

.prose .paper-mini-table thead th {
  font-weight: 600;
  border-bottom: 2px solid rgba(61, 49, 39, 0.72);
}

.prose .paper-mini-table thead th:first-child,
.prose .paper-mini-table tbody th {
  border-right: 2px solid rgba(61, 49, 39, 0.72);
}

.paper-table-note {
  width: min(100%, 34rem);
  margin: 0.55rem auto 0;
}

.prose .paper-acm-table--proof thead th {
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(61, 49, 39, 0.72);
  font-weight: 600;
}

.paper-acm-table--proof th[scope="row"] {
  width: 3.8rem;
  padding-left: 0;
  white-space: nowrap;
  font-weight: 600;
}

.paper-acm-table--proof td:last-child,
.paper-acm-table--proof th:last-child {
  width: 8.75rem;
  white-space: nowrap;
}

.paper-proof-cell > div + div {
  margin-top: 0.1rem;
}

.paper-proof-indent {
  padding-left: 1.8rem;
}

.paper-table-notes {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(61, 49, 39, 0.25);
}

.paper-table-notes-title {
  margin: 0 0 0.55rem;
  font-weight: 600;
}

.paper-table-notes ol {
  margin: 0;
  padding-left: 1.4rem;
}

.paper-table-notes li + li {
  margin-top: 0.35rem;
}

.prose img {
  display: block;
  width: min(100%, 960px);
  max-width: 100%;
  height: auto;
  margin: 1.5rem auto;
  border-radius: 14px;
  border: 1px solid rgba(221, 211, 199, 0.9);
  box-shadow: 0 12px 30px rgba(36, 24, 14, 0.08);
}

.prose code {
  background: rgba(143, 59, 36, 0.08);
  border: 1px solid rgba(143, 59, 36, 0.14);
  border-radius: 6px;
  padding: 0.12rem 0.35rem;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.prose pre,
.prose pre.wp-block-code {
  background: rgba(143, 59, 36, 0.06);
  color: var(--text);
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  border: 1px solid rgba(143, 59, 36, 0.14);
  margin: 1.5rem 0;
  box-shadow: none;
}

.prose pre code,
.prose pre.wp-block-code code {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: inherit;
  font-size: 0.95rem;
  line-height: 1.65;
}

.prose .highlight pre {
  background-color: rgba(143, 59, 36, 0.06) !important;
  color: var(--text) !important;
}

.prose .highlight pre code {
  color: inherit !important;
}

.post-paper .highlight span[style] {
  color: inherit !important;
  background: transparent !important;
}

.paper-acm-table--glossary {
  margin: 1.1rem 0 1.6rem;
}

.prose .paper-acm-table--glossary thead th {
  padding-bottom: 0.55rem;
  border-bottom: 1px solid rgba(61, 49, 39, 0.72);
  font-weight: 600;
}

.paper-acm-table--glossary th:first-child,
.paper-acm-table--glossary td:first-child {
  width: 8.5rem;
  padding-left: 0;
  white-space: nowrap;
}

.paper-acm-table--glossary tbody th,
.paper-acm-table--glossary tbody td {
  padding-top: 0.28rem;
  padding-bottom: 0.28rem;
}

.paper-acm-table--compare {
  margin: 0.15rem 0 0;
}

.prose .paper-acm-table--compare thead th {
  padding-bottom: 0.55rem;
  border-bottom: 1px solid rgba(61, 49, 39, 0.72);
  font-weight: 600;
}

.prose .paper-acm-table--compare tbody td {
  width: 50%;
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
}

.prose .paper-acm-table--compare tbody tr + tr td {
  border-top: 1px solid rgba(61, 49, 39, 0.12);
}

.paper-acm-table--compare td:first-child,
.paper-acm-table--compare th:first-child {
  padding-left: 0;
}

.paper-acm-table--matrix {
  margin: 0.15rem 0 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

.prose .paper-acm-table--matrix thead th {
  padding-bottom: 0.55rem;
  border-bottom: 1px solid rgba(61, 49, 39, 0.72);
  font-weight: 600;
}

.prose .paper-acm-table--matrix thead th,
.prose .paper-acm-table--matrix tbody td {
  text-align: left;
  vertical-align: top;
}

.paper-acm-table--matrix th:first-child,
.paper-acm-table--matrix td:first-child {
  width: 6.6rem;
  padding-left: 0;
  white-space: nowrap;
}

.paper-acm-table--matrix tbody td {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}

.prose .paper-acm-table--matrix tbody tr + tr td {
  border-top: 1px solid rgba(61, 49, 39, 0.12);
}

.prose .paper-acm-table--matrix th + th,
.prose .paper-acm-table--matrix td + td {
  border-left: 1px solid rgba(61, 49, 39, 0.1);
}

@media (max-width: 640px) {
  .site-footer .inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-header .inner {
    gap: 0.75rem;
  }

  .paper-mini-grid {
    grid-template-columns: 1fr;
  }

  .paper-acm-table--axioms td:nth-child(2),
  .paper-acm-table--axioms td:nth-child(3),
  .paper-acm-table--proof td:last-child,
  .paper-acm-table--proof th:last-child {
    width: auto;
  }

  .brand {
    flex: 0 1 auto;
    min-width: 0;
  }

  nav {
    flex: 0 0 auto;
    gap: 0.75rem;
  }

  .intro,
  .post {
    padding: 1.5rem;
  }
}
