:root {
  --bg:           #faf6f0;
  --surface:      #f2ebe0;
  --border:       #ddd0bc;
  --text:         #2c2116;
  --muted:        #7c6d5b;
  --subtle:       #a89282;
  --accent:       #c0602d;
  --accent-hover: #a34e22;
  --accent-light: #fdf0e8;
  --accent-line:  #e8a882;
  --green:        #3d7a52;
  --green-bg:     #eef7f2;
  --green-border: #9fcdb4;
  --danger:       #9e2a1c;
  --danger-bg:    #fdf2f0;
  --danger-border:#f0b8b0;
  --r:   5px;
  --r-sm: 3px;
  --prose-w: 700px;
  --wide-w: 1100px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  border-top: 3px solid var(--accent);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-hover);
  text-decoration-color: var(--accent-hover);
}

/* ── Layout ── */

.wrap {
  width: min(var(--wide-w), calc(100% - 48px));
  margin: 0 auto;
}

.narrow {
  width: min(var(--prose-w), calc(100% - 48px));
  margin: 0 auto;
}

/* ── Nav ── */

.topbar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: 20px;
}

.brand {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.05rem;
  font-weight: normal;
  font-style: italic;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.brand:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 0.845rem;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: var(--r-sm);
}

.nav-links a:hover {
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
}

.nav-cta {
  margin-left: 6px;
  background: var(--accent) !important;
  color: #fff !important;
  border-radius: 999px;
  padding: 5px 14px !important;
  font-size: 0.8rem;
  font-weight: 600;
}

.nav-cta:hover {
  background: var(--accent-hover) !important;
  color: #fff !important;
}

.nav-logout-form { display: inline; }

.nav-logout-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.845rem;
  padding: 4px 10px;
  cursor: pointer;
  border-radius: var(--r-sm);
}

.nav-logout-btn:hover {
  color: var(--text);
  background: var(--surface);
}

/* ── Site intro (home) ── */

.site-intro {
  padding: 64px 0 20px;
}

.site-intro-name {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 2.4rem;
  font-weight: normal;
  font-style: italic;
  line-height: 1.2;
  margin: 0 0 10px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.site-intro-desc {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  max-width: 480px;
}

/* ── Post list ── */

.post-feed {
  padding: 36px 0 72px;
}

.post-entry {
  padding: 32px 0;
  border-top: 1px solid var(--border);
}

.post-entry:last-child {
  border-bottom: 1px solid var(--border);
}

.post-entry-date {
  font-size: 0.8rem;
  color: var(--subtle);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.post-entry-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.45rem;
  font-weight: normal;
  line-height: 1.3;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}

.post-entry-title a {
  color: var(--text);
  text-decoration: none;
}

.post-entry-title a:hover {
  color: var(--accent);
}

.post-entry-summary {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 600px;
}

.post-entry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-pill {
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  padding: 2px 9px;
  text-decoration: none;
}

.tag-pill:hover {
  background: #f8ddd0;
  text-decoration: none;
  color: var(--accent-hover);
}

/* ── Pagination ── */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 12px 0 56px;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--muted);
}

/* ── Page head ── */

.page-head {
  padding: 60px 0 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.page-head-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 10px;
}

.page-head h1 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 2.2rem;
  font-weight: normal;
  font-style: italic;
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

/* ── Article ── */

.article-wrap {
  padding: 56px 0 48px;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 0.82rem;
  color: var(--subtle);
}

.article-edit-link {
  color: var(--accent);
  font-size: 0.8rem;
}

.article-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 2.6rem;
  font-weight: normal;
  font-style: italic;
  line-height: 1.18;
  letter-spacing: -0.02em;
  margin: 0 0 22px;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-bottom: 36px;
  margin-bottom: 36px;
  border-bottom: 1px solid var(--border);
}

/* ── Prose ── */

.prose {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.08rem;
  line-height: 1.82;
  color: var(--text);
}

.prose > * + * { margin-top: 1.1em; }

.prose h2 {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2.2em;
  margin-bottom: 0.5em;
  color: var(--text);
}

.prose h3 {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 1.8em;
  margin-bottom: 0.4em;
}

.prose p,
.prose ul,
.prose ol {
  margin-top: 0;
  margin-bottom: 1em;
}

.prose ul,
.prose ol { padding-left: 1.5em; }
.prose li { margin-bottom: 0.3em; }

.prose a {
  color: var(--accent);
  text-underline-offset: 3px;
}

.prose strong { font-weight: bold; }

.prose em { font-style: italic; }

.prose code {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 0.87em;
  background: var(--surface);
  color: var(--accent-hover);
  padding: 0.12em 0.38em;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}

.prose pre {
  background: #251c14;
  color: #f0e8dc;
  padding: 20px 24px;
  border-radius: var(--r);
  overflow-x: auto;
  margin: 1.8em 0;
  font-size: 0.875rem;
  line-height: 1.6;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
}

.prose pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.prose blockquote {
  margin: 1.4em 0;
  padding: 14px 20px;
  border-left: 3px solid var(--accent);
  background: var(--accent-light);
  color: var(--muted);
  font-style: italic;
  border-radius: 0 var(--r) var(--r) 0;
}

.prose blockquote p { margin: 0; font-style: inherit; }

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--r);
  border: 1px solid var(--border);
  display: block;
  margin: 0 auto;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  margin: 1.4em 0;
}

.prose th,
.prose td {
  border: 1px solid var(--border);
  padding: 8px 13px;
  text-align: left;
}

.prose th {
  background: var(--surface);
  font-weight: 700;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.4em 0;
}

/* ── Comments ── */

.comments-section {
  margin-top: 56px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
  padding-bottom: 72px;
}

.comments-section h2 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.3rem;
  font-weight: normal;
  font-style: italic;
  margin: 0 0 28px;
  color: var(--muted);
}

.comment-item {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.comment-item:last-of-type { border-bottom: none; }

.comment-author {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.comment-date {
  font-size: 0.78rem;
  color: var(--subtle);
  margin-bottom: 10px;
}

.comment-body .prose {
  font-size: 0.96rem;
  line-height: 1.65;
}

/* ── Forms ── */

label {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: #fffdf9;
  color: var(--text);
  padding: 9px 12px;
  font-size: 0.9375rem;
  font-family: inherit;
  line-height: 1.5;
  transition: border-color 0.12s, box-shadow 0.12s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(192, 96, 45, 0.12);
}

textarea {
  min-height: 200px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.9375rem;
  line-height: 1.7;
  resize: vertical;
}

.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: var(--r);
  background: var(--text);
  color: #fff;
  padding: 9px 18px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
  transition: background 0.12s, border-color 0.12s;
}

.btn:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

.btn-warm {
  background: var(--accent);
}

.btn-warm:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.alert {
  padding: 11px 14px;
  border: 1px solid var(--danger-border);
  border-radius: var(--r);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.875rem;
  margin: 0;
}

.draft-notice {
  padding: 10px 14px;
  border: 1px solid var(--green-border);
  border-radius: var(--r);
  background: var(--green-bg);
  color: var(--green);
  font-size: 0.875rem;
  margin: 0 0 16px;
}

/* ── Login ── */

.login-wrap {
  padding: 80px 0;
  display: grid;
  grid-template-columns: 1fr minmax(300px, 400px);
  gap: 60px;
  align-items: start;
}

.login-copy h1 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 2.2rem;
  font-weight: normal;
  font-style: italic;
  margin: 0 0 10px;
  line-height: 1.2;
}

.login-copy p {
  color: var(--muted);
  margin: 0;
  font-size: 0.95rem;
}

.form-card {
  background: #fffdf9;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 28px;
}

.form-stack {
  display: grid;
  gap: 18px;
}

/* ── Archive ── */

.archive-body {
  padding-bottom: 80px;
}

.archive-group {
  border-top: 1px solid var(--border);
  padding: 28px 0;
}

.archive-group:last-child {
  border-bottom: 1px solid var(--border);
}

.archive-month-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.archive-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.archive-group li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
}

.archive-group li a {
  color: var(--text);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.97rem;
  text-decoration: none;
}

.archive-group li a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.archive-group li time {
  flex-shrink: 0;
  font-size: 0.78rem;
  color: var(--subtle);
}

/* ── Admin ── */

.manage-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 48px 0 28px;
}

.manage-bar h1 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.7rem;
  font-weight: normal;
  font-style: italic;
  margin: 0;
  line-height: 1.2;
}

.manage-bar-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.manage-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.data-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  overflow-x: auto;
  margin-bottom: 60px;
  background: #fffdf9;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead {
  background: var(--surface);
}

.data-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--accent-light); }

.row-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.row-actions form { display: inline; }

.status-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
}

.status-badge.published {
  background: var(--green-bg);
  color: var(--green);
  border-color: var(--green-border);
}

.status-badge.spam,
.status-badge.rejected {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

.status-badge.approved {
  background: var(--green-bg);
  color: var(--green);
  border-color: var(--green-border);
}

/* ── Editor page ── */

.editor-page {
  padding: 40px 0 80px;
}

.editor-page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.editor-page-head h1 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.5rem;
  font-weight: normal;
  font-style: italic;
  margin: 0;
}

.editor-form {
  display: grid;
  gap: 18px;
}

.editor-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.editor-meta-full {
  grid-column: 1 / -1;
}

.editor-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ── Error ── */

.error-page {
  padding: 100px 0 80px;
  text-align: center;
}

.error-code {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 5rem;
  font-style: italic;
  font-weight: normal;
  color: var(--accent);
  line-height: 1;
  margin: 0 0 12px;
}

.error-message {
  color: var(--muted);
  font-size: 1rem;
  margin: 0 0 28px;
}

/* ── Footer ── */

.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  font-size: 0.82rem;
  color: var(--subtle);
  font-style: italic;
}

.footer-inner p { margin: 0; }

/* ── Empty ── */

.empty-state {
  padding: 48px 0;
  color: var(--muted);
  font-style: italic;
  text-align: center;
}

/* ── Responsive ── */

@media (max-width: 680px) {
  .nav-inner { height: 52px; }
  .nav-links a, .nav-logout-btn { padding: 4px 7px; font-size: 0.8rem; }

  .site-intro { padding: 44px 0 16px; }
  .site-intro-name { font-size: 1.8rem; }

  .article-title { font-size: 1.9rem; }
  .page-head h1 { font-size: 1.7rem; }

  .login-wrap {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 52px 0;
  }

  .editor-meta-grid { grid-template-columns: 1fr; }
  .editor-meta-full { grid-column: 1; }

  .manage-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .archive-group li {
    flex-direction: column;
    gap: 2px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}
