/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #f8f7f4;
  --surface:    #ffffff;
  --border:     #e0ddd6;
  --text:       #1a1a1a;
  --muted:      #6b6b6b;
  --accent:     #2c5f2e;
  --accent-lt:  #eaf2ea;
  --danger:     #c0392b;
  --radius:     6px;
  --font:       'Georgia', serif;
  --font-ui:    system-ui, sans-serif;
  --max-w:      780px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.7;
}

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

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }

/* ── Header ───────────────────────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
}
.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 24px;
}
.site-title {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--text);
  text-decoration: none;
}
.site-tagline {
  color: var(--muted);
  font-size: 0.9rem;
  flex-basis: 100%;
  margin-top: -4px;
}
.site-nav { margin-left: auto; display: flex; gap: 20px; font-family: var(--font-ui); font-size: 0.9rem; }
.site-nav a { color: var(--muted); }
.site-nav a:hover { color: var(--accent); text-decoration: none; }

/* ── Main ─────────────────────────────────────────────────── */
main.container { padding-top: 40px; padding-bottom: 60px; }

/* ── Flash messages ───────────────────────────────────────── */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  font-family: var(--font-ui);
  font-size: 0.9rem;
}
.flash-ok    { background: var(--accent-lt); border: 1px solid var(--accent); color: var(--accent); }
.flash-error { background: #fdf0ef; border: 1px solid var(--danger); color: var(--danger); }

/* ── Post list (homepage) ─────────────────────────────────── */
.post-list { list-style: none; }
.post-item {
  border-bottom: 1px solid var(--border);
  padding: 32px 0;
}
.post-item:first-child { padding-top: 0; }
.post-date {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
}
.post-title {
  font-size: 1.5rem;
  line-height: 1.3;
  margin-bottom: 10px;
}
.post-title a { color: var(--text); }
.post-title a:hover { color: var(--accent); text-decoration: none; }
.post-excerpt { color: var(--muted); margin-bottom: 12px; }
.read-more {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--accent);
}

/* ── Single post ──────────────────────────────────────────── */
.post-full {
  background: var(--surface);
  padding: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 32px;
}
.post-full .post-title { font-size: 2rem; margin-bottom: 8px; }
.post-meta {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 32px;
}
.post-meta span { margin-right: 16px; }
.post-body { line-height: 1.8; }
.post-body h2 { font-size: 1.4rem; margin: 32px 0 12px; }
.post-body h3 { font-size: 1.2rem; margin: 24px 0 10px; }
.post-body p  { margin-bottom: 16px; }
.post-body img { max-width: 100%; height: auto; border-radius: var(--radius); margin: 16px 0; }
.post-body blockquote {
  border-left: 4px solid var(--border);
  padding: 8px 20px;
  margin: 24px 0;
  color: var(--muted);
  font-style: italic;
}
.post-body pre {
  background: #f0eeea;
  padding: 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.85rem;
  margin: 16px 0;
}
.post-updated { font-size: 0.8rem; color: var(--muted); margin-top: 24px; }
.post-actions { margin-top: 16px; font-family: var(--font-ui); font-size: 0.85rem; }
.post-actions a { margin-right: 12px; }

/* ── Comments ─────────────────────────────────────────────── */
.comments-section {
  margin-top: 48px;
  padding: 28px;
  background: #f5f4f0;
  border-radius: var(--radius);
  border: 1px solid #e8e5df;
}
.comments-section h2 { font-size: 1.2rem; margin-bottom: 24px; font-family: var(--font-ui); }
.comment-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}
.comment-meta {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.stars { color: #e0a800; letter-spacing: -1px; }
.comment-headline { font-weight: bold; margin-bottom: 4px; }
.comment-body { font-size: 0.95rem; }

/* Comment form in comments section */
.comments-section > div:last-child {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 2px solid #e8e5df;
}
.comments-section > div:last-child h2 {
  margin-bottom: 20px;
}

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; font-family: var(--font-ui); }
label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url],
select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--font-ui);
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}
textarea { min-height: 120px; resize: vertical; }

.btn {
  display: inline-block;
  padding: 10px 22px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity .15s;
}
.btn:hover { opacity: .85; text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

/* ── Pagination ───────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 40px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
}
.pagination a, .pagination strong {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}
.pagination a:hover { background: var(--accent-lt); border-color: var(--accent); }
.pagination strong { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── About page ───────────────────────────────────────────── */
.about-content { max-width: 640px; }
.about-content h1 { margin-bottom: 24px; }

/* ── Login page ───────────────────────────────────────────── */
.login-box { max-width: 380px; margin: 60px auto; }
.login-box h1 { margin-bottom: 28px; font-size: 1.5rem; }

/* ── Admin layout ─────────────────────────────────────────── */
.admin-header {
  background: #1a1a1a;
  color: #fff;
  padding: 14px 0;
}
.admin-header .container { display: flex; align-items: center; gap: 24px; }
.admin-header a { color: #ccc; font-family: var(--font-ui); font-size: 0.85rem; text-decoration: none; }
.admin-header a:hover { color: #fff; }
.admin-header .admin-brand { font-weight: bold; color: #fff; font-size: 1rem; margin-right: auto; }

.admin-body { background: var(--bg); min-height: calc(100vh - 50px); }
.admin-body main.container { padding-top: 32px; }

.admin-page-title {
  font-size: 1.4rem;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-ui);
}

/* ── Admin tables ─────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.data-table th {
  text-align: left;
  padding: 12px 16px;
  background: #f0eeea;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: .05em;
  color: var(--muted);
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #faf9f7; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-family: var(--font-ui);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-green  { background: var(--accent-lt); color: var(--accent); }
.badge-grey   { background: #eee; color: var(--muted); }
.badge-orange { background: #fff3e0; color: #e65100; }

/* ── Admin dashboard stats ────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  font-family: var(--font-ui);
}
.stat-card .stat-num { font-size: 2rem; font-weight: bold; color: var(--accent); }
.stat-card .stat-label { font-size: 0.8rem; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .05em; }

/* ── Post editor ──────────────────────────────────────────── */
#editor-container {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  min-height: 320px;
}
#editor-toolbar { border-radius: var(--radius) var(--radius) 0 0; }
#editor-body    { border-radius: 0 0 var(--radius) var(--radius); min-height: 280px; font-size: 1rem; }
.ql-toolbar.ql-snow { border: none; border-bottom: 1px solid var(--border); }
.ql-container.ql-snow { border: none; }

/* ── Subscribe form (footer) ──────────────────────────────── */
.footer-subscribe { margin-bottom: 20px; }
.subscribe-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 0.9rem;
}
.subscribe-form label { margin: 0; font-size: 0.9rem; text-transform: none; font-weight: normal; color: var(--muted); }
.subscribe-form input[type=email] { width: auto; flex: 1; min-width: 180px; }
.subscribe-form button { background: var(--accent); color: #fff; border: none; padding: 10px 18px; border-radius: var(--radius); cursor: pointer; font-size: 0.85rem; }

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0 24px;
  background: var(--surface);
  margin-top: 60px;
}
.footer-copy { font-family: var(--font-ui); font-size: 0.8rem; color: var(--muted); margin-top: 16px; }

/* ── Utility ──────────────────────────────────────────────── */
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.text-muted { color: var(--muted); }
.text-sm    { font-size: 0.85rem; font-family: var(--font-ui); }
.empty-state { text-align: center; color: var(--muted); padding: 48px 0; font-family: var(--font-ui); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
  body { font-size: 16px; }
  .site-header .container { flex-direction: column; align-items: flex-start; }
  .site-nav { margin-left: 0; }
  .post-full .post-title { font-size: 1.5rem; }
}
