@font-face {
  font-family: 'Source Serif 4';
  src: url('/static/fonts/source-serif-4-400.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('/static/fonts/source-serif-4-600.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('/static/fonts/ibm-plex-sans-400.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('/static/fonts/ibm-plex-sans-600.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
:root {
  color-scheme: light;
  --paper: #f7f1e7;
  --ink: #1f1d1a;
  --accent: #2d5f73;
  --muted: #6c6460;
  --panel: #efe6da;
  --rule: #d8cbbd;
}
body {
  margin: 0;
  font-family: 'Source Serif 4', Georgia, serif;
  background: radial-gradient(circle at top right, #ffffff 0, var(--paper) 45%);
  color: var(--ink);
  line-height: 1.65;
}
a { color: var(--accent); }
header.site-header {
  padding: 1.5rem 2rem 0.75rem;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 0;
}
/* Desktop: flatten nav children into header flow for explicit ordering. */
.nav-menu {
  display: contents;
}
.nav-toggle-checkbox {
  display: none;
}
.nav-toggle {
  display: none;
}
.nav-menu-content {
  display: contents;
}
.nav-link,
.nav-form {
  order: 1;
  margin-left: 0.75rem;
}
.search-form {
  order: 2;
  margin-left: auto;
  margin-right: auto;
}
.lang-form {
  order: 3;
  margin-left: 0;
}
.home-link {
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
}
.nav-link {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.9rem;
  color: var(--accent);
  text-decoration: none;
  font-variant: small-caps;
  letter-spacing: 0.08em;
}
.nav-form {
  margin: 0;
  display: flex;
  align-items: center;
}
.nav-button {
  background: none;
  border: none;
  padding: 0;
  line-height: inherit;
  cursor: pointer;
}
.search-form {
  position: relative;
  flex: 0 1 18rem;
}
.search-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.9rem;
  border: 1px solid var(--rule);
  background: #fffdf7;
}
.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fffdf7;
  border: 1px solid var(--rule);
  border-top: none;
  box-shadow: 0 10px 20px rgba(31, 29, 26, 0.1);
  list-style: none;
  margin: 0;
  padding: 0;
  display: none;
  z-index: 10;
}
.search-suggestions li a {
  display: block;
  padding: 0.5rem 0.75rem;
  color: var(--ink);
  text-decoration: none;
}
.search-suggestions li a:hover {
  background: var(--panel);
}
.lang-form {
  margin: 0;
}
.lang-selector {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--rule);
  background: #fffdf7;
  color: var(--ink);
  cursor: pointer;
}
.lang-selector:hover {
  border-color: var(--accent);
}
.lang-form noscript button {
  margin-left: 0.5rem;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.85rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--rule);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}
.page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18rem;
  gap: 2rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: 2rem;
}
.page-layout.single {
  grid-template-columns: minmax(0, 1fr);
}
.article {
  background: #fffdf7;
  padding: 2rem 2.5rem;
  border: 1px solid var(--rule);
  box-shadow: 0 6px 16px rgba(31, 29, 26, 0.08);
}
.sidebar {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.92rem;
  color: var(--muted);
}
h1 {
  font-size: 2.4rem;
  margin: 0 0 1.25rem;
}
code, pre { background: #f5f0e7; }
pre { padding: 1rem; white-space: pre-wrap; overflow-wrap: anywhere; }
pre.diff del { background: #ffe0e0; text-decoration: none; }
pre.diff ins { background: #ddf8dd; text-decoration: none; }
.article table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  border: 1px solid var(--rule);
  background: #fffdf7;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.95rem;
}
.article th,
.article td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.article thead th {
  background: var(--panel);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--muted);
}
.article tbody tr:nth-child(even) {
  background: #f5f0e7;
}
.article tbody tr:last-child td {
  border-bottom: none;
}
#refs { margin-top: 2rem; font-size: 0.95rem; }
.citation-ref { font-size: 0.8em; }
.citation-group { white-space: nowrap; }
.citation-group .citation-ref + .citation-ref { margin-left: 0.2rem; }
.citation-notes { padding-left: 1.25rem; }
.citation-notes li { margin-bottom: 0.5rem; }
.ref-backlinks { margin-right: 0.25rem; }
.ref-backlink { margin-right: 0.25rem; font-size: 0.8em; text-decoration: none; }
.page-history, .page-diff, .page-toc {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 1rem;
  margin-bottom: 1rem;
}
.page-history summary, .page-diff summary, .page-toc summary {
  font-weight: 600;
  color: var(--ink);
  font-family: 'IBM Plex Sans', sans-serif;
  cursor: pointer;
}
.page-toc .toc-list {
  margin: 0.75rem 0 0 0;
  padding: 0;
  list-style: none;
}
.page-toc .toc-list li {
  margin: 0.35rem 0;
  line-height: 1.4;
}
.page-toc .toc-list a {
  color: var(--ink);
  text-decoration: none;
}
.page-toc .toc-list a:hover {
  text-decoration: underline;
}
.history-list { margin-top: 1rem; padding-left: 1.25rem; }
.history-list li { margin-bottom: 1rem; }
.change-list { padding-left: 1.25rem; }
.change-list li { margin-bottom: 1rem; }
.change-meta { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.change-summary { margin-top: 0.25rem; color: #444; }
.change-actions { margin-top: 0.35rem; }
.citation-card {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.citation-meta {
  margin-top: 0.5rem;
  color: #555;
  font-size: 0.9rem;
}
.citation-fields {
  margin: 1rem 0 0;
}
.citation-field {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}
.citation-field dt {
  font-weight: 600;
  color: var(--ink);
  font-family: 'IBM Plex Sans', sans-serif;
}
.citation-field dd {
  margin: 0;
}
.citation-raw {
  margin-top: 1.5rem;
}
.citation-raw pre {
  background: #f6f4ee;
  border: 1px solid var(--rule);
  padding: 1rem;
  overflow: auto;
}
@media (max-width: 640px) {
  .citation-field {
    grid-template-columns: 1fr;
  }
}
.rev-meta { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.rev-radio { width: 1.4rem; display: inline-flex; justify-content: center; }
.rev-summary { margin-top: 0.25rem; color: #333; }
.rev-actions { margin-top: 0.25rem; }
.history-form { margin-top: 1rem; }
.history-actions { margin-bottom: 0.75rem; }
.form-card {
  background: #fffdf7;
  border: 1px solid var(--rule);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 12px rgba(31, 29, 26, 0.08);
}
.form-card h1,
.form-card h2 {
  margin-top: 0;
}
.form-field {
  display: block;
  margin-bottom: 1rem;
  font-family: 'IBM Plex Sans', sans-serif;
}
.form-field span {
  display: block;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}
.form-field input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--rule);
  background: #fffdf7;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.95rem;
}
.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.form-actions button,
.form-actions a {
  padding: 0.55rem 1.2rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.form-actions a {
  background: transparent;
  color: var(--accent);
}
.form-error {
  padding: 0.6rem 0.75rem;
  background: #fff0f0;
  border: 1px solid #f0b5b5;
  margin-bottom: 1rem;
  font-family: 'IBM Plex Sans', sans-serif;
}
.form-help {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.form-inline {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}
.form-inline label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-family: 'IBM Plex Sans', sans-serif;
}
.form-inline input {
  min-width: 12rem;
}
.token-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'IBM Plex Sans', sans-serif;
}
.token-table th,
.token-table td {
  border-bottom: 1px solid var(--rule);
  padding: 0.6rem 0.4rem;
  text-align: left;
}
.token-table form {
  display: inline-block;
  margin-right: 0.5rem;
}
.token-display {
  padding: 0.75rem 1rem;
  background: #f5f0e7;
  border: 1px dashed var(--rule);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.95rem;
  word-break: break-all;
}
.page-label {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
button {
  font-family: 'IBM Plex Sans', sans-serif;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}
.diff-top {
  max-width: 72rem;
  margin: 1.5rem auto 0;
  padding: 0 2rem;
}
.diff-top .page-diff {
  margin-bottom: 0;
}
.blog-list {
  max-width: 60rem;
  margin: 0 auto;
}
.post-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}
.post-list h2 {
  margin: 0 0 0.35rem;
}
.post-meta {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}
.post-meta--primary {
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}
.post-meta--bottom {
  margin-top: 1.5rem;
  margin-bottom: 0;
}
.post-created,
.post-updated {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
}
.post-summary {
  font-family: 'IBM Plex Sans', sans-serif;
  color: var(--ink);
  margin-bottom: 1.2rem;
}
footer.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  padding: 1.5rem 2rem 2.5rem;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.9rem;
  color: var(--muted);
}
.footer-inner {
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
}
.footer-inner a { color: var(--accent); }
.meta-tooltip {
  position: absolute;
  z-index: 50;
  max-width: 22rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--rule);
  background: #fffdf6;
  color: var(--ink);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.85rem;
  line-height: 1.35;
  box-shadow: 0 12px 30px rgba(26, 22, 16, 0.12);
  border-radius: 0.5rem;
  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
}
.meta-tooltip.is-visible {
  opacity: 1;
  transform: translateY(calc(-100% - 6px));
  pointer-events: auto;
}
.meta-tooltip.is-pinned {
  border-color: var(--accent);
}
.form-field textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--rule);
  background: #fffdf7;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.95rem;
  resize: vertical;
  min-height: 4rem;
}
.form-hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.25rem;
}
altcha-widget {
  display: block;
  margin-bottom: 1rem;
}
@media (max-width: 900px) {
  .page-layout { grid-template-columns: 1fr; }
  .sidebar { order: -1; }
  header.site-header {
    flex-wrap: wrap;
  }
  .nav-menu {
    display: block;
    position: relative;
    order: 1;
    margin-left: auto;
  }
  .nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    cursor: pointer;
    list-style: none;
  }
  .nav-toggle::before {
    content: '';
    display: block;
    width: 20px;
    height: 2px;
    background: var(--ink);
    box-shadow: 0 6px 0 var(--ink), 0 12px 0 var(--ink);
  }
  .nav-menu-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 12rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 0;
    background: #fffdf7;
    border: 1px solid var(--rule);
    box-shadow: 0 10px 20px rgba(31, 29, 26, 0.1);
    z-index: 20;
  }
  .nav-toggle-checkbox:checked + .nav-toggle + .nav-menu-content {
    display: flex;
  }
  .nav-menu-content .nav-link,
  .nav-menu-content .nav-button {
    display: block;
    padding: 0.75rem 1rem;
    min-height: 44px;
    box-sizing: border-box;
    border-radius: 0.25rem;
  }
  .nav-menu-content a.nav-link {
    margin: 0 0.5rem;
  }
  .nav-menu-content .nav-form {
    margin: 0 0.5rem;
  }
  .nav-menu-content .nav-button {
    margin: 0;
    width: 100%;
    text-align: left;
  }
  .nav-menu-content .nav-link:hover,
  .nav-menu-content .nav-button:hover {
    background: var(--panel);
  }
  .nav-menu-content .lang-form {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--rule);
    margin-top: 0.25rem;
  }
  .nav-menu-content .lang-selector {
    width: 100%;
  }
  .search-form {
    flex: 1 1 100%;
    order: 2;
    margin-left: 0;
    margin-right: 0;
    margin-top: 0.75rem;
  }
  .article table { display: block; overflow-x: auto; }
  .page-toc:not([open]) .toc-list { display: none; }
}
