:root {
  --bg: #f8f6f0;
  --surface: #fffdf8;
  --surface-2: #f1ece1;
  --ink: #1f1c18;
  --muted: #6e665d;
  --line: #d8cfc1;
  --accent: #244a5a;
  --accent-soft: #dce9ef;
  --danger: #9b2f2f;
  --success: #1e6b46;
  --shadow: 0 10px 30px rgba(28, 24, 17, 0.06);
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: radial-gradient(circle at top left, #f4efe2 0%, var(--bg) 50%, #f8f7f2 100%);
  color: var(--ink);
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; height: auto; }

.container { width: min(1120px, calc(100% - 2rem)); margin-inline: auto; }
.narrow { width: min(760px, calc(100% - 2rem)); }
.section { padding: 2.5rem 0; }
.promo-section { padding: 1rem 0; }

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(248, 246, 240, 0.82);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.site-header .container {
  width: min(1360px, calc(100% - 2rem));
}
.header-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1.2rem;
  align-items: start;
  padding: 1rem 0;
}
.menu-toggle {
  display: none;
  width: 44px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
}
.menu-toggle-bar {
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 99px;
}
.brand { font-size: 1.4rem; font-weight: 700; color: var(--ink); text-decoration: none; }
.brand-with-logo { display: inline-flex; align-items: center; gap: 0.55rem; }
.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
}
.tagline { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.9rem; }
.main-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  align-items: center;
  justify-content: flex-end;
  overflow-x: auto;
  scrollbar-width: thin;
}
.main-nav a {
  text-decoration: none;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.32rem 0.62rem;
  white-space: nowrap;
}
.main-nav a.active,
.main-nav a:hover { border-color: var(--line); background: var(--surface); }
.header-search {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  flex: 0 0 auto;
}
.header-search input {
  min-width: 130px;
  max-width: 160px;
  border-radius: 999px;
  padding: 0.42rem 0.72rem;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
}
.header-search button {
  border-radius: 999px;
  padding: 0.42rem 0.7rem;
  border: 1px solid #1e3f4d;
  background: var(--accent);
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.header-search button:hover {
  filter: brightness(1.05);
}
.mobile-category-links {
  display: none;
}

.category-strip {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0 0 0.9rem;
}
.category-strip a {
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.9rem;
}

.hero { padding: 2.5rem 0 1.2rem; }
.coming-soon-shell {
  min-height: 58vh;
  display: grid;
  align-items: center;
}
.coming-soon-card {
  padding: clamp(1.2rem, 2vw, 1.8rem);
  text-align: center;
}
.coming-soon-card h1 {
  margin: 0.3rem 0 0.8rem;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.06;
}
.coming-soon-card .lede {
  margin-inline: auto;
}
.coming-soon-card .cta-row {
  justify-content: center;
}
.coming-soon-logo {
  display: block;
  width: clamp(56px, 8vw, 80px);
  height: clamp(56px, 8vw, 80px);
  border-radius: 14px;
  margin: 0 auto 0.45rem;
  object-fit: cover;
}
.hero-compact {
  background: linear-gradient(135deg, rgba(255, 253, 248, 0.9), rgba(244, 237, 224, 0.7));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(1.1rem, 2vw, 1.8rem);
  box-shadow: var(--shadow);
}
.hero h1 { font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.08; margin: 0.2rem 0 1rem; }
.lede { color: var(--muted); font-size: 1.05rem; max-width: 62ch; }
.hero-categories {
  margin-top: 0.95rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.hero-categories a {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
}
.hero-categories a:hover {
  border-color: #b7aa95;
  background: #fff;
}
.eyebrow {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0;
}
.section-heading h1,
.section-heading h2 { margin: 0.2rem 0 0.5rem; line-height: 1.1; }
.section-heading { margin-bottom: 1rem; }

.hero-aside,
.panel,
.feature-card,
.article-card {
  background: linear-gradient(180deg, var(--surface), #fbfaf6);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.hero-aside { padding: 1rem; }
.hero-aside h2 { margin: 0 0 0.8rem; font-size: 1.1rem; }
.category-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.5rem; }
.category-list a {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  text-decoration: none;
  color: var(--ink);
}
.category-list small { color: var(--muted); }

.search-form {
  display: flex;
  gap: 0.6rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.search-form input,
.search-form button,
input,
select,
textarea {
  font: inherit;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.7rem 0.8rem;
}
.search-form input { min-width: 260px; flex: 1; }
.search-form-wide { margin-bottom: 1rem; }
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}
.button-primary,
.search-form button {
  background: var(--accent);
  color: #fff;
  border-color: #1e3f4d;
}
.button-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
}
.button-link.danger { color: var(--danger); }
.share-trigger,
.copy-link-trigger {
  white-space: nowrap;
  padding: 0.65rem 0.9rem;
  min-height: 42px;
  font: inherit;
}
.share-feedback {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  background: #1f1c18;
  color: #fff;
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 60;
}
.share-feedback.show {
  opacity: 1;
  transform: translateY(0);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.latest-grid {
  grid-template-columns: 1fr;
}
.article-card,
.feature-card { padding: 1rem; }
.article-card h3,
.feature-card h3 { margin: 0.4rem 0 0.5rem; line-height: 1.2; }
.article-card h3 a,
.feature-card h3 a { color: var(--ink); text-decoration: none; }
.article-card h3 a:hover,
.feature-card h3 a:hover { color: var(--accent); }
.article-card p,
.feature-card p { margin: 0.55rem 0; color: #2d2924; }
.article-subtitle { color: var(--muted); font-style: italic; }
.article-subtitle-large { font-size: 1.08rem; margin-top: -0.3rem; }
.card-image-link,
.feature-image-link {
  display: block;
  margin: -1rem -1rem 0.8rem;
  border-bottom: 1px solid var(--line);
  background: #f3eee4;
  padding: 0.5rem;
}
.card-image-link.side,
.feature-image-link.side {
  margin: 0;
  border-bottom: 0;
  border-right: 1px solid var(--line);
  padding: 0.5rem;
}
.card-cover-image,
.feature-cover-image {
  width: 100%;
  height: 180px;
  object-fit: contain;
  object-position: center;
  display: block;
}
.feature-cover-image {
  height: clamp(190px, 24vw, 280px);
}
.card-cover-image.side {
  width: 180px;
  height: 140px;
}
.feature-cover-image.side {
  width: 240px;
  height: 180px;
}
.feature-image-link.side {
  padding: 0;
  width: 260px;
  overflow: hidden;
  background: #e9e2d6;
}
.feature-cover-image.side {
  width: 100%;
  height: 100%;
  min-height: 220px;
  object-fit: cover;
}
.article-card-content {
  min-width: 0;
}
.article-card-side {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  padding: 0.75rem;
  gap: 0.8rem;
}
.article-card-side .article-card-content {
  display: grid;
  align-content: start;
  gap: 0.15rem;
}
.article-card-side .article-card-meta {
  margin-bottom: 0.05rem;
}
.article-card-side .card-image-link.side {
  width: 220px;
  padding: 0;
  overflow: hidden;
  background: #e9e2d6;
}
.article-card-side .card-cover-image.side {
  width: 100%;
  height: 170px;
  object-fit: cover;
}
.article-card-side .tag-list {
  margin-top: 0.55rem;
}
.tag-more {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px dashed var(--line);
  background: #fbf9f3;
  color: var(--muted);
  font-size: 0.8rem;
}
.feature-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.feature-card-content {
  min-width: 0;
  display: grid;
  align-content: start;
}
.feature-card .article-card-meta,
.feature-card h3,
.feature-card .article-subtitle,
.feature-card p,
.feature-card .cta-row {
  margin-left: 0;
}

.article-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.88rem;
}
.pill,
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  padding: 0.2rem 0.55rem;
  text-decoration: none;
}
.badge { font-size: 0.76rem; }
.badge-research {
  border-color: #8fb2c5;
  background: #e8f2f7;
  color: #1f3f4f;
}
.badge-status { background: #fff; }
.badge-draft { border-color: #c9b786; background: #fbf2d7; }
.badge-published { border-color: #a8c7b7; background: #e6f3eb; }
.badge-archived { border-color: #c7c7c7; background: #efefef; }

.tag-list {
  margin: 0.8rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.tag-list a {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  text-decoration: none;
  font-size: 0.85rem;
}

.cta-row { display: flex; gap: 0.6rem; align-items: center; }
.cta-row-wrap { flex-wrap: wrap; }
.empty-state,
.result-summary,
.muted { color: var(--muted); }
.archive-shell .section-heading {
  margin-bottom: 0.8rem;
}
.archive-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: end;
  margin-bottom: 1rem;
}
.archive-filter-field {
  min-width: 180px;
  flex: 1;
}
.archive-sentinel {
  text-align: center;
  padding: 0.9rem 0;
}
.substack-ad {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
  background: linear-gradient(140deg, #fffdf8, #f2ebde);
  box-shadow: var(--shadow);
}
.substack-ad-media {
  background: radial-gradient(circle at top, #fff 0%, #f0e6d5 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  padding: 0.9rem;
}
.substack-ad-media img {
  width: min(120px, 100%);
  height: auto;
  object-fit: contain;
}
.substack-ad-content h2 {
  margin: 0.2rem 0 0.55rem;
  line-height: 1.1;
}
.substack-ad-content p {
  margin: 0.45rem 0 0.8rem;
  color: #2d2924;
}

.article-shell { padding-top: 1.4rem; }
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: 1rem;
  align-items: start;
}
.article-main {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.2rem;
  box-shadow: var(--shadow);
}
.article-main h1 { line-height: 1.08; margin: 0.6rem 0 0.8rem; font-size: clamp(1.8rem, 3vw, 2.8rem); }
.article-cover-wrap {
  margin: 0.8rem auto 1rem;
  width: min(100%, 620px);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #f3eee4;
}
.article-cover-image {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  display: block;
}
.overview-block { margin-top: 1.1rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.overview-block h2 { margin-top: 0; font-size: 1.15rem; }

.article-sidebar { display: grid; gap: 1rem; position: sticky; top: 7.2rem; }
.panel { padding: 1rem; }
.panel h2, .panel h3 { margin: 0 0 0.6rem; }
.bibtex-block {
  margin: 0.2rem 0 0.8rem;
  background: #f5f1e8;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem;
  max-height: 280px;
  overflow: auto;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.84rem;
  line-height: 1.45;
}

.research-grid {
  display: grid;
  gap: 0.9rem;
}
.research-card h3 {
  margin-top: 0.45rem;
}
.research-authors {
  margin-top: 0;
}
.research-card .cta-row {
  margin-top: 0.75rem;
  align-items: stretch;
}
.research-card .cta-row .button {
  flex: 0 0 auto;
  white-space: nowrap;
  min-height: 42px;
}
.research-card .tag-list {
  margin-bottom: 0.35rem;
}
.meta-list { margin: 0; }
.meta-list div { display: grid; grid-template-columns: 90px 1fr; gap: 0.5rem; padding: 0.25rem 0; }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; }
.related-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.8rem; }
.related-list li a { display: block; color: var(--ink); font-weight: 600; text-decoration: none; }
.related-list small { color: var(--muted); display: block; }

.pagination {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
}
.pagination .disabled { color: var(--muted); }

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 2rem;
  padding: 1.2rem 0 2rem;
  background: rgba(255, 255, 255, 0.45);
}
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.footer-grid p { margin: 0; }

.cookie-consent {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 70;
}
.cookie-consent-inner {
  margin: 0 auto;
  width: min(920px, 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf8;
  box-shadow: var(--shadow);
  padding: 0.95rem;
}
.cookie-title {
  margin: 0 0 0.25rem;
  font-weight: 700;
}
.cookie-text {
  margin: 0;
  color: var(--muted);
}
.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.75rem;
}
.cookie-preferences {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 5.8rem;
  z-index: 80;
  padding: 0;
}
.cookie-preferences-inner {
  width: min(920px, 100%);
  margin: 0 auto;
}
.cookie-preferences-inner h2 {
  margin-top: 0;
}

.prose p { margin: 0 0 0.95rem; }
.prose h1, .prose h2, .prose h3 { line-height: 1.15; }

.alert {
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  margin: 0 0 1rem;
  border: 1px solid var(--line);
}
.alert ul { margin: 0; padding-left: 1.1rem; }
.alert-error { background: #fff0f0; border-color: #e8b8b8; color: #7a1d1d; }
.alert-success { background: #eefaf2; border-color: #b8dfc7; color: #165838; }

.stack-form { display: grid; gap: 0.9rem; }
.stack-form label { display: grid; gap: 0.35rem; font-weight: 600; }
.stack-form input,
.stack-form select,
.stack-form textarea { width: 100%; font-weight: 400; }
.stack-form textarea { resize: vertical; }
.form-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.import-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0.9rem;
}
.import-panel h2 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
}
.import-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: end;
}
.import-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.import-status {
  margin-top: 0.8rem;
  margin-bottom: 0;
}
.checkbox-row { display: flex !important; align-items: center; gap: 0.55rem; }
.checkbox-row input { width: auto; }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: end;
  margin-bottom: 1rem;
}
.filter-row label { min-width: 220px; flex: 1; }
.compact-panel { padding: 0.8rem; }

.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.admin-table th,
.admin-table td { padding: 0.65rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.admin-table th { color: var(--muted); font-weight: 600; }
.action-links { display: flex; flex-wrap: wrap; gap: 0.55rem; align-items: center; }
.action-links form { margin: 0; }
.action-links a { text-decoration: none; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1rem;
}
.stat { font-size: 2rem; line-height: 1; margin: 0; font-weight: 700; }
.admin-body .site-header { position: static; }
.admin-header { border-bottom: 1px solid var(--line); background: #fbfaf7; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 980px) {
  .article-layout { grid-template-columns: 1fr; }
  .article-sidebar { position: static; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .site-header {
    position: static;
  }
  .footer-grid { display: flex; flex-direction: column; align-items: flex-start; }
  .header-search {
    width: 100%;
  }
  .header-search input {
    min-width: 0;
    flex: 1;
    max-width: none;
  }
  .card-grid,
  .form-grid,
  .stats-grid { grid-template-columns: 1fr; }
  .pagination { flex-direction: column; align-items: flex-start; }
  .search-form { flex-direction: column; }
  .search-form input { min-width: 0; width: 100%; }
  .filter-row label { min-width: 0; width: 100%; }
  .archive-filter-field { min-width: 0; width: 100%; }
  .import-row { grid-template-columns: 1fr; }
  .article-card-side,
  .feature-card { grid-template-columns: 1fr; }
  .substack-ad {
    grid-template-columns: 1fr;
  }
  .substack-ad-media {
    min-height: 120px;
  }
  .card-image-link.side,
  .feature-image-link.side {
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    margin: 0;
    border-radius: 14px 14px 0 0;
    overflow: hidden;
  }
  .article-card-side,
  .feature-card {
    padding: 0;
  }
  .article-card-side .article-card-content,
  .feature-card-content {
    padding: 0.85rem;
  }
  .article-card-side .card-image-link.side,
  .feature-image-link.side {
    width: 100%;
  }
  .card-cover-image.side,
  .feature-cover-image.side {
    width: 100%;
    height: 190px;
    object-fit: cover;
  }
  .research-card .cta-row .button {
    width: 100%;
    justify-content: center;
  }
  .mobile-category-links {
    grid-template-columns: 1fr;
  }
  .cookie-consent {
    left: 0.5rem;
    right: 0.5rem;
    bottom: 0.5rem;
  }
  .cookie-preferences {
    left: 0.5rem;
    right: 0.5rem;
    bottom: 8.6rem;
  }
}

@media (max-width: 1024px) {
  .header-grid {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
  .menu-toggle {
    display: inline-flex;
  }
  .main-nav {
    display: none;
    width: 100%;
    grid-column: 1 / -1;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.45rem;
    overflow: visible;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    padding: 0.75rem;
  }
  .main-nav.is-open {
    display: flex;
  }
  .main-nav a {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 10px;
  }
  .header-search {
    width: 100%;
  }
  .header-search input {
    min-width: 0;
    max-width: none;
    flex: 1;
  }
  .mobile-category-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
    margin-top: 0.25rem;
  }
  .category-strip {
    display: none;
  }
}
