@font-face {
  font-family: "DM Sans";
  src: url("/fonts/dm/dm-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 1000;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/fonts/instrument/instrument-serif-latin-400-normal.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/fonts/instrument/instrument-serif-latin-400-italic.woff2") format("woff2");
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Quicksand";
  src: url("/fonts/quicksand-regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Playfair Display";
  src: url("/fonts/playfair-display-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --paper: #faf8f3;
  --white: #fffdf8;
  --ink: #21332b;
  --muted: #55625a;
  --accent: #233a30;
  --accent-hover: #365246;
  --shade: #e5ecdf;
  --row-hover: #f2f4ed;
  --line: #d9ded3;
  --control-line: #aeb9ad;
  --outline-line: #859487;
  --notice-line: #b7c8ae;
  --focus: #8d662a;
  --heading: "Instrument Serif", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
}

.public-page {
  --paper: #fff;
  --white: #fff;
  --ink: #000;
  --muted: #4b4b4b;
  --accent: #000;
  --accent-hover: #333;
  --panel: #e0e0e0;
  --shade: #f2f2f2;
  --row-hover: #f7f7f7;
  --line: #e5e5e5;
  --control-line: #767676;
  --outline-line: #767676;
  --notice-line: #bcbcbc;
  --focus: #000;
  --sans: "Quicksand", system-ui, sans-serif;
  --heading: var(--sans);
  --post-heading: "Playfair Display", Georgia, serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.6 var(--sans); }
main { min-height: 56vh; }
.public-page main { flex: 1; }
main:focus { outline: none; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--heading); font-weight: 400; line-height: 1.02; }
a { color: inherit; text-underline-offset: .19em; }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: progress; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
img { display: block; max-width: 100%; }
.wrap { width: min(1180px, calc(100% - 104px)); margin-inline: auto; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { position: fixed; z-index: 50; top: 12px; left: 12px; padding: 8px 12px; background: var(--white); }

.site-header { background: var(--paper); border-bottom: 1px solid var(--line); position: relative; z-index: 2; }
.header-inner { min-height: 77px; display: flex; align-items: center; justify-content: center; }
.public-page .site-header { border-bottom: 0; }
.public-page .header-inner { min-height: 96px; }
.header-inner > .plain-link { margin-inline-start: auto; }
.site-nav { display: flex; align-items: center; justify-content: center; gap: clamp(12px, 2.2vw, 34px); font-size: 14px; white-space: nowrap; }
.site-nav > a, .resources summary { text-decoration: none; }
.site-nav > a[aria-current], .site-nav > a:hover, .resources summary:hover { text-decoration: underline; text-underline-offset: .35em; }
.resources { position: relative; }
summary::marker, summary::-webkit-details-marker { display: none; content: ""; }
.resources summary { display: inline-flex; align-items: center; gap: 9px; }
.chevron { width: .42em; height: .42em; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg) translateY(-2px); }
details[open] > summary .chevron { transform: rotate(225deg) translate(-1px, -1px); }
.resources ul { list-style: none; padding: 8px; margin: 13px 0 0; min-width: 210px; position: absolute; inset-inline-end: -15px; top: 100%; border: 1px solid var(--line); background: var(--white); box-shadow: 0 12px 24px #00000016; }
.resources li a { display: flex; justify-content: space-between; gap: 16px; padding: 9px 10px; text-decoration: none; white-space: normal; }
.resources li a:hover { background: var(--shade); }
.mobile-toggle { background: transparent; color: var(--ink); border: 1px solid var(--line); padding: 7px 10px; }

.eyebrow { text-transform: uppercase; letter-spacing: .16em; font-weight: 700; font-size: 11px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 13px; text-decoration: none; font-weight: 650; font-size: 14px; line-height: 1.15; min-height: 43px; padding: 10px 16px; color: var(--white); background: var(--accent); border: 1px solid var(--accent); }
.button:hover { background: var(--accent-hover); }
.button-outline { background: transparent; color: var(--ink); border-color: var(--outline-line); }
.button-outline:hover { background: var(--shade); }
.plain-link { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 650; text-decoration: none; }
.plain-link:hover { text-decoration: underline; }

.post-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.post-card { position: relative; min-height: 215px; padding: 19px 19px 15px; background: var(--white); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 13px; }
.post-card:hover { border-color: var(--control-line); background: var(--row-hover); }
.post-card h3 { font: 700 clamp(22px, 2.3vw, 28px)/1.4 var(--post-heading); overflow-wrap: anywhere; }
.post-card h3 a { text-decoration: none; }
.post-card h3 a::after { content: ""; position: absolute; inset: 0; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 10px; font-size: 12px; color: var(--muted); }
.tag { background: var(--accent); color: var(--white); border-radius: 16px; padding: 3px 9px; font-size: 12px; }
.card-subtitle { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.card-foot { margin-top: auto; display: flex; align-items: end; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; }
.card-arrow { color: var(--ink); font-size: 19px; }
.site-footer { background: var(--paper); color: var(--ink); border-top: 1px solid var(--line); }
.footer-inner { padding-block: 28px; }
.footer-inner nav { display: flex; justify-content: center; gap: 10px 22px; flex-wrap: wrap; }
.footer-inner nav a { font-size: 13px; text-decoration: none; }
.footer-inner nav a:hover { text-decoration: underline; }

.page-banner { padding-block: 41px 44px; background: var(--panel); text-align: center; }
.page-banner h1 { font-size: clamp(32px, 6vw, 47px); line-height: 1.25; overflow-wrap: anywhere; }
.page-banner p { color: var(--muted); margin-top: 8px; font-size: 16px; overflow-wrap: anywhere; }
.page-content { padding-block: 28px 60px; }
.filters { display: grid; grid-template-columns: minmax(150px, 1.35fr) repeat(3, minmax(115px, 1fr)) auto; align-items: end; gap: 11px; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.filters .button { min-height: 43px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-stack { display: grid; gap: 14px; }
.span-all { grid-column: 1 / -1; }
label { display: grid; gap: 5px; font-weight: 650; font-size: 13px; }
input:not([type=checkbox]), select, textarea { display: block; width: 100%; max-width: 100%; min-height: 43px; border: 1px solid var(--control-line); border-radius: 0; padding: 8px 10px; background: var(--white); color: var(--ink); font-weight: 400; font-size: 15px; }
textarea { resize: vertical; }
label small { font-weight: 400; font-size: 12px; color: var(--muted); }
.result-line { display: flex; justify-content: space-between; gap: 10px; margin-block: 14px; color: var(--muted); font-size: 14px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 26px; text-align: center; font-size: 14px; }
.pagination a { background: var(--white); border: 1px solid var(--line); padding: 6px 11px; text-decoration: none; }
.pagination a:hover { background: var(--shade); }
.empty { padding: 15px 17px; background: var(--white); color: var(--muted); border: 1px solid var(--line); }
.empty a { font-weight: 650; }
.table-scroll { border: 1px solid var(--line); overflow: auto; max-width: 100%; }
table { width: 100%; min-width: 860px; border-collapse: collapse; background: var(--white); font-size: 13px; line-height: 1.42; }
thead { background: var(--shade); }
td, th { border-bottom: 1px solid var(--line); padding: 12px 10px; text-align: left; vertical-align: top; }
tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tbody th { width: 25%; font-size: 14px; }
tbody tr:hover { background: var(--row-hover); }
td a { font-weight: 600; }
.nowrap { white-space: nowrap; }

.reading { max-width: 810px; padding-block: 37px 70px; }
.article-heading { margin: 18px 0 24px; padding-bottom: 19px; border-bottom: 1px solid var(--line); }
.reading h1 { font-size: clamp(32px, 6vw, 54px); line-height: 1.2; overflow-wrap: anywhere; }
.article-heading h1 { margin: 10px 0 12px; font-family: var(--post-heading); font-weight: 700; }
.original { display: flex; flex-wrap: wrap; gap: 4px 9px; font-size: 14px; overflow-wrap: anywhere; }
.subtitle { margin-top: 14px; font-size: 21px; color: var(--muted); }
.prose { font-size: 17px; line-height: 1.75; overflow-wrap: anywhere; }
.prose > * { margin: 0 0 1em; }
.prose h1, .prose h2, .prose h3 { font-size: 34px; }
.prose blockquote { margin-inline: 0; border-inline-start: 3px solid var(--line); padding-inline-start: 15px; color: var(--muted); }
.references { padding-top: 18px; border-top: 1px solid var(--line); }
.resume-download { margin-bottom: 18px; }
.error-page > * + * { margin-top: 16px; }
.gallery { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gallery a { display: block; background: var(--shade); overflow: hidden; aspect-ratio: 4 / 3; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.gallery a:hover img { transform: scale(1.035); }
.photo-dialog { padding: 8px; border: 1px solid var(--control-line); background: var(--white); max-width: 95vw; }
.photo-dialog::backdrop { background: #000000d6; }
.photo-dialog form { display: flex; justify-content: end; margin-bottom: 7px; }
.photo-dialog img { max-height: 80vh; margin-inline: auto; }

.admin-body { background: #f2f4ee; }
.admin-shell { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; padding-block: 28px 55px; }
.admin-sidebar { border-right: 1px solid var(--line); padding: 10px 14px 10px 0; }
.admin-sidebar nav { display: grid; gap: 3px; margin: 9px 0 18px; }
.admin-sidebar a { font-size: 14px; font-weight: 600; padding: 7px 10px; text-decoration: none; }
.admin-sidebar a:hover, .admin-sidebar a[aria-current] { background: var(--shade); }
.admin-content { min-width: 0; }
.admin-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 15px; }
.admin-heading h1, .login-card h1 { font-size: clamp(40px, 6vw, 62px); }
.text-button { padding: 5px 10px; border: 0; color: var(--ink); background: transparent; font-weight: 650; font-size: 14px; }
.text-button:hover { text-decoration: underline; }
.login-page { display: grid; place-items: center; min-height: 67vh; padding-block: 25px; }
.login-card { width: min(100%, 465px); padding: clamp(16px, 4vw, 34px); background: var(--white); border: 1px solid var(--line); }
.login-card > * + * { margin-top: 14px; }
.editor-card { background: var(--white); padding: clamp(12px, 2.5vw, 22px); border: 1px solid var(--line); margin-bottom: 12px; }
.editor-card h2 { font-size: 32px; margin: 0 0 6px; }
.editor-card > p + *, .editor-card h2 + form { margin-top: 9px; }
.admin-intro { margin-bottom: 14px; max-width: 70ch; }
.help { font-size: 13px; color: var(--muted); }
.notice, .problem { padding: 9px 13px; margin-bottom: 11px; border: 1px solid var(--notice-line); background: var(--shade); font-size: 14px; }
.problem { background: #f6e7e2; border-color: #d9aaa0; color: #652f24; }
.admin-search { display: flex; align-items: end; gap: 8px; margin-bottom: 8px; }
.admin-search > label { flex: 1; }
.category-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 15px; }
.admin-table { min-width: 540px; }
.admin-table tbody th { width: 54%; }
.admin-table th a { text-decoration: none; }
.admin-table th a:hover { text-decoration: underline; }
.admin-content .table-scroll { margin-top: 8px; }
.editor-meta { margin: 0; min-width: 0; border: 1px solid var(--line); padding: 12px; }
.editor-meta legend { padding-inline: 5px; font-weight: 650; font-size: 13px; }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.menu-entry summary { display: flex; justify-content: space-between; align-items: center; font-weight: 650; gap: 8px; }
.menu-entry summary::before { content: "+"; font-size: 17px; order: -1; }
.menu-entry[open] summary::before { content: "−"; }
.menu-entry summary small { margin-left: auto; color: var(--muted); }
.menu-entry form { margin-top: 13px; border-top: 1px solid var(--line); padding-top: 13px; }
.checkbox { display: flex; align-items: center; gap: 7px; }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 1050px) {
  .wrap { width: calc(100% - 64px); }
  .site-nav { gap: 13px; }
}
@media (max-width: 820px) {
  .wrap { width: calc(100% - 36px); }
  .header-inner { min-height: 61px; flex-wrap: wrap; padding-block: 9px; gap: 9px; }
  .site-nav { width: 100%; gap: 7px 13px; flex-wrap: wrap; }
  .site-nav.enhanced { display: none; }
  .site-nav.enhanced.is-open { display: flex; padding: 7px 0; }
  .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .search-field { grid-column: span 2; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-shell { grid-template-columns: 1fr; gap: 16px; }
  .admin-sidebar { border: 0; border-bottom: 1px solid var(--line); padding: 0 0 8px; }
  .admin-sidebar nav { display: flex; flex-wrap: wrap; margin-block: 4px; }
  .admin-sidebar a { border: 1px solid var(--line); }
}
@media (max-width: 680px) {
  .public-page .header-inner { min-height: clamp(72px, 22.4vw, 96px); }
  .page-banner { padding-block: 28px 30px; }
}
@media (max-width: 550px) {
  .wrap { width: calc(100% - 30px); }
  .site-nav.enhanced.is-open { flex-direction: column; }
  .resources { text-align: center; }
  .resources ul { position: static; box-shadow: none; margin: 4px 0 0; text-align: start; }
  .post-grid, .category-list { grid-template-columns: 1fr; }
  .post-card { min-height: 145px; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pagination a { padding: 5px 6px; }
  .pagination { gap: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
