/* ── Variables ─────────────────────────────────────────── */
:root {
  --color-bg: #ffffff;
  --color-text: #000;
  --color-text-secondary: #444;
  --color-muted: #666;
  --color-border: #000;
  --color-border-light: #e4e4e4;
  --color-surface: #f8f8f8;
  --color-brand: #6B8E5A;
  --color-brand-dark: #5a7a4a;
  --color-brand-light: #E8F0E8;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --max-width: 1200px;
  --content-width: 700px;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-sans); color: var(--color-text); background: var(--color-bg); line-height: 1.6; font-size: 16px; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-text); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ────────────────────────────────────────────── */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 2rem; }

/* ── Nav ───────────────────────────────────────────────── */
.nav {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem 0 0;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text);
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 1rem;
}
.nav-brand:hover { text-decoration: none; opacity: .85; }
.nav-brand img { height: 44px; width: 44px; }
.nav-categories {
  display: flex;
  gap: 0;
  border-top: 1px solid var(--color-border-light);
  width: 100%;
  justify-content: center;
}
.nav-categories a {
  display: block;
  padding: 12px 16px;
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text);
  transition: color 0.15s;
}
.nav-categories a:hover { color: var(--color-brand); text-decoration: none; }
.nav-link { color: var(--color-text); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; }
.nav-link:hover { color: var(--color-brand); text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 1rem; margin-left: auto; }
.nav-user { color: var(--color-muted); font-size: .85rem; }

/* Admin nav override */
.admin-nav .nav-inner { flex-direction: row; padding: 0.875rem 0; }
.admin-nav .nav-brand { font-size: 1.25rem; margin-bottom: 0; }

/* ── Main ──────────────────────────────────────────────── */
main { padding: 3rem 0 5rem; }

/* ── Section header ───────────────────────────────────── */
.section-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border-light);
}
.section-header h1 {
  font-family: var(--font-sans);
  font-size: .85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0;
}
.section-header p {
  display: none;
}

/* ── Footer ────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--color-border);
  padding: 3rem 0;
  text-align: center;
}
.footer p { color: var(--color-muted); font-size: .8rem; }
.footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.footer-brand img { height: 32px; width: 32px; }
.footer-brand span {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--color-text);
}
.footer-tagline {
  color: var(--color-text-secondary);
  font-size: .9rem;
  max-width: 400px;
  margin: 0 auto 1rem;
  line-height: 1.5;
}

.footer-app-badges {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}
.app-badge img {
  display: block;
  height: 40px;
  width: auto;
}

/* ── Post Cards (index / tag pages) ───────────────────── */
.posts-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
}
.empty { color: var(--color-muted); font-style: italic; text-align: center; grid-column: 1 / -1; }

/* Featured post — first card spans full width */
.posts-list > .post-card:first-child {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: #000;
}
.posts-list > .post-card:first-child .post-card-image {
  height: 100%;
  min-height: 400px;
}
.posts-list > .post-card:first-child .post-card-body {
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.posts-list > .post-card:first-child .post-card-title {
  font-size: 2.25rem;
  line-height: 1.1;
}
.posts-list > .post-card:first-child .post-card-title a { color: #fff; }
.posts-list > .post-card:first-child .post-card-title a:hover { color: var(--color-brand-light); }
.posts-list > .post-card:first-child .post-card-meta { color: rgba(255,255,255,.6); }
.posts-list > .post-card:first-child .post-card-excerpt { color: rgba(255,255,255,.8); font-size: 1.05rem; }
.posts-list > .post-card:first-child .post-card-rubric { color: var(--color-brand-light); }
.posts-list > .post-card:first-child .badge { background: rgba(255,255,255,.15); color: rgba(255,255,255,.8); }
.posts-list > .post-card:first-child .badge:hover { background: var(--color-brand); color: #fff; }

.post-card {
  overflow: hidden;
}
.post-card-image {
  width: 100%;
  height: 260px;
  object-fit: cover;
}
.post-card-body { padding: 1rem 0; }
.post-card-rubric {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-brand-dark);
  margin-bottom: 0.35rem;
}
.post-card-title {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 0.5rem;
}
.post-card-title a { color: var(--color-text); }
.post-card-title a:hover { text-decoration: underline; }
.post-card-meta {
  color: var(--color-muted);
  font-size: .75rem;
  margin-bottom: .5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.post-card-excerpt { color: var(--color-text-secondary); margin-bottom: .75rem; font-size: .9rem; line-height: 1.55; }
.post-card-tags { display: flex; flex-wrap: wrap; gap: .35rem; }

/* ── Post Detail ───────────────────────────────────────── */
.post-detail { max-width: var(--content-width); margin: 0 auto; }
.post-hero {
  width: 100vw;
  max-width: none;
  margin-left: calc(-50vw + 50%);
  max-height: 560px;
  object-fit: cover;
  margin-bottom: 2.5rem;
}
.post-header { margin-bottom: 2.5rem; }
.post-header h1 {
  font-family: var(--font-serif);
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}
.post-meta {
  color: var(--color-muted);
  font-size: .8rem;
  margin-bottom: .75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}
.post-meta time, .post-meta .post-author { font-weight: 600; }
.post-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1rem; }

/* ── Prose (markdown content) ──────────────────────────── */
.prose {
  max-width: var(--content-width);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.85;
  color: var(--color-text-secondary);
}
.prose h1, .prose h2, .prose h3 {
  font-family: var(--font-sans);
  color: var(--color-text);
  margin: 2.5rem 0 1rem;
  line-height: 1.2;
  font-weight: 600;
}
.prose h2 { font-size: 1.5rem; }
.prose h3 { font-size: 1.2rem; }
.prose p { margin-bottom: 1.25rem; }
.prose a { color: var(--color-brand-dark); text-decoration: underline; text-underline-offset: 2px; }
.prose a:hover { color: var(--color-brand); }
.prose ul, .prose ol { padding-left: 1.5rem; margin-bottom: 1.25rem; }
.prose li { margin-bottom: .35rem; }
.prose blockquote {
  border-left: 3px solid var(--color-brand);
  padding: 0.75rem 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--color-muted);
}
.prose pre { background: #1a1a1a; color: #e8e8e8; padding: 1.25rem; overflow-x: auto; margin-bottom: 1.25rem; }
.prose code { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: .85em; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose :not(pre) > code { background: var(--color-surface); padding: .15em .4em; font-size: .85em; }
.prose img { margin: 1.5rem 0; }
.prose hr { border: none; border-top: 1px solid var(--color-border-light); margin: 2.5rem 0; }

/* ── Badge / Tags ──────────────────────────────────────── */
.badge {
  display: inline-block;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: .7rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 24px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge:hover { background: var(--color-brand); color: #fff; text-decoration: none; }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-block;
  background: var(--color-brand);
  color: #fff;
  padding: .55rem 1.25rem;
  border-radius: 0;
  font-size: .8rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: background-color .15s;
}
.btn:hover { background: var(--color-brand-dark); text-decoration: none; color: #fff; }
.btn-secondary { background: var(--color-bg); color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secondary:hover { background: var(--color-surface); color: var(--color-text); }
.btn-danger { background: #dc2626; }
.btn-danger:hover { background: #b91c1c; }

/* ── Admin ─────────────────────────────────────────────── */
.admin-main { padding-top: 2rem; }
.admin-main h1 { font-size: 1.5rem; margin-bottom: 1.5rem; font-weight: 700; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--color-surface); border: 1px solid var(--color-border-light); padding: 1.25rem; text-align: center; }
.stat-number { font-size: 2.5rem; font-weight: 700; color: var(--color-brand); }
.stat-label { color: var(--color-muted); font-size: .8rem; margin-top: .25rem; text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Admin Table ───────────────────────────────────────── */
.admin-table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; }
.admin-table th { background: var(--color-surface); text-align: left; padding: .75rem 1rem; font-size: .75rem; font-weight: 700; color: var(--color-muted); border-bottom: 2px solid var(--color-border-light); text-transform: uppercase; letter-spacing: 0.06em; }
.admin-table td { padding: .75rem 1rem; border-bottom: 1px solid var(--color-border-light); font-size: .9rem; vertical-align: middle; }
.admin-table tr:hover td { background: var(--color-surface); }
.admin-table .actions { display: flex; gap: .5rem; align-items: center; }

.status-published { color: var(--color-brand-dark); font-weight: 600; }
.status-draft { color: var(--color-muted); }

/* ── Admin Form ────────────────────────────────────────── */
.post-form { max-width: 760px; }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: .75rem; font-weight: 700; margin-bottom: .35rem; color: var(--color-text); text-transform: uppercase; letter-spacing: 0.06em; }
.form-group input[type=text],
.form-group input[type=url],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: .6rem .85rem;
  border: 1px solid var(--color-border-light);
  border-radius: 0;
  font-size: .95rem;
  font-family: var(--font-sans);
  background: #fff;
  transition: border-color .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 2px rgba(107, 142, 90, 0.15);
}
.form-group textarea { min-height: 360px; resize: vertical; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: .875rem; }
.form-group .hint { font-size: .8rem; color: var(--color-muted); margin-top: .3rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.upload-area { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.hero-preview { margin-top: .75rem; }
.hero-preview img { max-width: 320px; max-height: 200px; object-fit: cover; border: 1px solid var(--color-border-light); }
.upload-status { font-size: .85rem; color: var(--color-muted); }

.form-actions { display: flex; gap: .75rem; align-items: center; padding-top: .5rem; border-top: 1px solid var(--color-border-light); margin-top: 1.5rem; }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
  .container { padding: 0 1.25rem; }
  .nav-brand { font-size: 1.5rem; }
  .nav-brand img { height: 36px; width: 36px; }
  .nav-categories { flex-wrap: wrap; justify-content: center; }
  .nav-categories a { padding: 8px 12px; font-size: .7rem; }
  .posts-list { grid-template-columns: 1fr; }
  .posts-list > .post-card:first-child { grid-template-columns: 1fr; }
  .posts-list > .post-card:first-child .post-card-image { min-height: 260px; height: 260px; }
  .posts-list > .post-card:first-child .post-card-title { font-size: 1.5rem; }
  .post-header h1 { font-size: 2rem; }
  .post-hero { max-height: 320px; }
  .form-row { grid-template-columns: 1fr; }
}
