:root {
  --bg: #efe7db;
  --bg-strong: #f7f2ea;
  --paper: rgba(255, 251, 245, 0.82);
  --paper-strong: rgba(255, 251, 245, 0.92);
  --ink: #171311;
  --muted: #6b5b4a;
  --muted-soft: #927f6a;
  --accent: #b75a30;
  --accent-strong: #8d3f20;
  --teal: #1f5a58;
  --line: rgba(23, 19, 17, 0.1);
  --line-strong: rgba(23, 19, 17, 0.16);
  --shadow: 0 24px 70px rgba(39, 29, 20, 0.11);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --content-max: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #f7f2ea 0%, #efe7db 48%, #f5efe8 100%);
  font-family: "Palatino Linotype", "Book Antiqua", "Source Han Serif SC", "Noto Serif SC", serif;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; }
code { font-family: "JetBrains Mono", "Cascadia Code", Consolas, monospace; }

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at top left, rgba(31, 90, 88, 0.15), transparent 28%),
    radial-gradient(circle at 88% 10%, rgba(183, 90, 48, 0.16), transparent 24%);
}
.page-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(23, 19, 17, 0.024) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 19, 17, 0.024) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: radial-gradient(circle at center, black 60%, transparent 100%);
}

.shell { width: min(var(--content-max), calc(100% - 32px)); margin: 0 auto; }
.page-space { padding: 28px 0 72px; }
.narrow-shell { max-width: 640px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: rgba(247, 242, 234, 0.78);
  border-bottom: 1px solid rgba(23, 19, 17, 0.06);
}
.header-row, .footer-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.header-row { padding: 18px 0 14px; }
.subnav-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 0 18px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}
.brand-mark {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #f0bc62);
  box-shadow: 0 0 0 8px rgba(183, 90, 48, 0.08);
}
.brand-copy { display: grid; gap: 2px; }
.brand strong,
.eyebrow,
.meta-line,
.main-nav,
.button,
.tag-pill,
.data-table,
.nav-button,
.subnav-pill,
.toolbar-button,
.comment-meta,
.footer-links {
  font-family: "Avenir Next", "Segoe UI", "PingFang SC", sans-serif;
}
.brand small { color: var(--muted); }
.main-nav, .footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  color: var(--muted);
}
.main-nav form { margin: 0; }
.nav-button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
}
.subnav-pill, .tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.88rem;
}
.subnav-pill:hover, .tag-pill:hover { border-color: rgba(183, 90, 48, 0.25); }
.tag-pill-active {
  background: rgba(183, 90, 48, 0.14);
  color: var(--ink);
}

.site-footer {
  border-top: 1px solid rgba(23, 19, 17, 0.08);
  padding-bottom: 30px;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  padding: 30px 0 18px;
}
.footer-copy { color: var(--muted); line-height: 1.75; margin: 12px 0 0; }
.footer-meta {
  padding-top: 18px;
  color: var(--muted);
  border-top: 1px solid rgba(23, 19, 17, 0.08);
}

.hero-panel,
.feature-card,
.content-panel,
.sidebar-card,
.article-card,
.page-hero {
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow);
  border-radius: var(--radius-xl);
}
.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.8fr);
  gap: 18px;
  overflow: hidden;
}
.page-hero, .feature-card, .dashboard-grid, .filter-grid, .posts-layout, .article-layout, .editor-grid, .archive-grid {
  display: grid;
  gap: 18px;
}
.page-hero { grid-template-columns: minmax(0, 1fr) 320px; padding: 30px; }
.dashboard-grid { grid-template-columns: minmax(0, 1fr) 320px; }
.filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.posts-layout, .article-layout { grid-template-columns: minmax(0, 1fr) 320px; }
.archive-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 28px; }
.editor-grid { grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr); }
.hero-copy, .hero-side, .feature-copy, .content-panel, .sidebar-card, .article-card, .panel-note, .preview-pane { padding: 28px; }
.hero-copy { padding: 38px; }
.hero-side { display: grid; gap: 18px; background: rgba(255, 246, 235, 0.72); }
.hero-copy h1, .page-hero h1, .article-header h1, .section-head h2, .feature-copy h3, .post-card h3 {
  margin: 0;
  line-height: 1.02;
  letter-spacing: -0.05em;
}
.hero-copy h1 { font-size: clamp(2.9rem, 7vw, 5.6rem); max-width: 8ch; }
.page-hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
.hero-text, .panel-note p, .feature-copy p, .post-card p, .article-summary, .prose p, .empty-state, .related-card p, .panel-copy {
  color: var(--muted);
  line-height: 1.85;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  color: var(--teal);
  margin: 0 0 14px;
}
.meta-line {
  color: var(--accent);
  font-size: 0.84rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.hero-actions, .tag-row, .tag-cloud, .pager, .checkbox-row, .hero-metrics, .search-inline, .toolbar, .library-options, .library-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.hero-metrics { margin-top: 22px; }
.hero-metrics div {
  min-width: 120px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.55);
}
.hero-metrics strong { display: block; font-size: 1.4rem; }
.button, .flash, .stat-card, .upload-box, .editor-form input, .editor-form textarea, .editor-form select, .search-card input, .search-inline input {
  border-radius: 18px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  border: 0;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease;
}
.button:hover { transform: translateY(-2px); }
.button-dark { color: #fff8f1; background: var(--ink); }
.button-soft { color: var(--ink); background: rgba(183, 90, 48, 0.12); }
.button-inline { padding: 10px 14px; font-size: 0.9rem; }
.toolbar-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.toolbar-button:hover { color: var(--ink); border-color: var(--line-strong); }

.panel-note, .search-card, .sidebar-card, .stat-card, .post-card, .related-card, .attachment-card, .upload-box, .preview-pane, .archive-group, .comment-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
}
.compact-panel { padding: 22px; }
.inset-panel { background: rgba(255, 255, 255, 0.48); }
.search-card, .editor-form, .comment-form, .preview-pane, .search-inline { display: grid; gap: 12px; }
.editor-form label > span, .search-card label {
  font-family: "Avenir Next", "Segoe UI", "PingFang SC", sans-serif;
  font-size: 0.92rem;
  color: var(--muted);
}
.editor-form input, .editor-form textarea, .editor-form select, .search-card input, .search-inline input, .comment-form input, .comment-form textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(23, 19, 17, 0.12);
  background: rgba(255, 251, 245, 0.84);
  color: var(--ink);
}
.comment-form textarea, .editor-textarea { min-height: 180px; resize: vertical; }
.editor-textarea { min-height: 380px; }
.section-block { margin-top: 28px; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}
.section-head h1, .section-head h2 { font-size: clamp(1.8rem, 4vw, 3rem); }
.compact-head h2, .compact-head h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.feature-card { grid-template-columns: minmax(0, 0.95fr) minmax(320px, 0.8fr); overflow: hidden; }
.feature-media, .post-cover, .article-hero { background: rgba(232, 222, 211, 0.76); overflow: hidden; }
.feature-media img, .feature-media video, .post-cover img, .post-cover video, .attachment-card img, .attachment-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.post-grid, .attachment-grid, .stats-grid, .sidebar-stack, .comment-list { display: grid; gap: 18px; }
.post-grid, .attachment-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stats-grid-wide { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.post-card { overflow: hidden; }
.post-cover { display: block; aspect-ratio: 16 / 9; }
.post-copy { padding: 22px; }
.post-copy h3, .feature-copy h3 { font-size: clamp(1.45rem, 3vw, 2.15rem); margin: 12px 0 10px; }
.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--muted-soft);
  margin-top: 18px;
}
.card-foot a, .link-action, .actions-cell a, .actions-cell button { color: var(--accent-strong); }
.sidebar-card, .preview-pane { height: fit-content; }
.media-stack { display: grid; gap: 14px; }
.media-item, .related-card { display: grid; gap: 12px; }
.media-item img, .media-item video, .related-card { border-radius: 14px; }
.media-item img, .media-item video { aspect-ratio: 16 / 10; object-fit: cover; }
.article-card { padding: 34px; }
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--muted);
  margin-top: 16px;
}
.article-summary { font-size: 1.08rem; margin-top: 16px; }
.article-hero { margin: 26px 0; border-radius: var(--radius-lg); border: 1px solid var(--line); }
.article-hero img, .article-hero video {
  width: 100%;
  max-height: 540px;
  object-fit: cover;
}
.prose h1, .prose h2, .prose h3 { margin: 30px 0 12px; letter-spacing: -0.04em; }
.prose ul, .prose ol { margin: 12px 0; padding-left: 22px; color: var(--muted); line-height: 1.8; }
.prose blockquote {
  margin: 20px 0;
  padding: 12px 18px;
  border-left: 3px solid rgba(183, 90, 48, 0.45);
  background: rgba(183, 90, 48, 0.06);
}
.prose pre {
  overflow-x: auto;
  padding: 18px;
  border-radius: var(--radius-md);
  background: #181412;
  color: #f6eee7;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
}
.prose th, .prose td {
  padding: 10px 12px;
  border: 1px solid var(--line);
}
.embedded-media {
  margin: 24px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.7);
}
.embedded-media img, .embedded-media video {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
}
.embedded-media figcaption, .attachment-card figcaption, .library-copy { padding: 12px 14px 16px; }
.library-copy { display: grid; gap: 8px; }
.library-copy small { color: var(--muted); line-height: 1.5; word-break: break-all; }
.library-card { overflow: hidden; }
.library-select-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.info-strip {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(183, 90, 48, 0.18);
  background: rgba(183, 90, 48, 0.08);
  color: var(--accent-strong);
}
.comment-form, .comment-card, .archive-group, .preview-body, .preview-head, .search-toolbar { padding: 0; }
.comment-card { padding: 18px; border-radius: var(--radius-lg); }
.comment-head, .comment-meta, .preview-head, .archive-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.comment-card p { margin: 10px 0 0; color: var(--muted); line-height: 1.75; }
.comment-meta { margin-top: 14px; }
.hidden-honeypot { display: none; }
.archive-group { padding: 24px; border-radius: var(--radius-lg); }
.archive-head { margin-bottom: 18px; }
.archive-list { display: grid; gap: 14px; }
.archive-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}
.archive-item p { margin: 8px 0 0; color: var(--muted); line-height: 1.7; }
.archive-meta {
  display: grid;
  gap: 8px;
  align-content: start;
  color: var(--muted-soft);
  white-space: nowrap;
}
.admin-body .page-space { padding-top: 24px; }
.upload-box { padding: 18px; display: grid; gap: 10px; }
.upload-box input { padding: 0; background: transparent; border: 0; }
.preview-head { margin-bottom: 18px; }
.preview-body {
  min-height: 360px;
  padding: 22px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
}
.form-grid, .upload-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.stats-grid { margin: 20px 0 24px; }
.stat-card { padding: 20px; }
.stat-card strong {
  display: block;
  font-family: "Avenir Next", "Segoe UI", "PingFang SC", sans-serif;
  font-size: 2rem;
  margin-bottom: 8px;
}
.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "Avenir Next", "Segoe UI", "PingFang SC", sans-serif;
}
.inline-check input { width: 18px; height: 18px; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  padding: 16px 14px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.data-table th {
  color: var(--muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.table-sub {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}
.actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.actions-cell form { margin: 0; }
.actions-cell button {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}
.actions-cell button:disabled,
.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.flash-stack { display: grid; gap: 10px; padding-top: 18px; }
.flash {
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
}
.flash-success { border-color: rgba(31, 90, 88, 0.2); }
.flash-error { border-color: rgba(183, 90, 48, 0.24); }
.empty-state { padding: 12px 0; }

@media (max-width: 1180px) {
  .hero-panel,
  .page-hero,
  .dashboard-grid,
  .filter-grid,
  .posts-layout,
  .article-layout,
  .editor-grid,
  .feature-card,
  .archive-grid,
  .form-grid,
  .upload-grid,
  .library-select-grid {
    grid-template-columns: 1fr;
  }
  .stats-grid-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .shell { width: min(var(--content-max), calc(100% - 20px)); }
  .header-row, .footer-grid, .footer-meta, .section-head, .comment-head, .comment-meta, .archive-head, .archive-item {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
  }
  .post-grid, .attachment-grid, .stats-grid, .stats-grid-wide {
    grid-template-columns: 1fr;
  }
  .hero-copy, .hero-side, .content-panel, .sidebar-card, .article-card, .panel-note, .preview-pane { padding: 22px; }
  .archive-item { display: grid; }
}
