/*
 * This is a manifest file that'll be compiled into application.css.
 */

/* ── Variables ───────────────────────────────────────────────── */

:root {
  --text:       #111827;
  --text-muted: #6b7280;
  --border:     #e5e7eb;
  --bg:         #fff;
  --bg-subtle:  #f9fafb;
  --font-sans:  system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
  --font-mono:  ui-monospace, "SF Mono", Menlo, monospace;
  --max-width:  720px;
  --radius:     6px;
}

/* ── Reset ───────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ── Site wrapper ────────────────────────────────────────────── */

.site-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.site-main {
  flex: 1;
  padding: 3rem 0 4rem;
}

/* ── Header ──────────────────────────────────────────────────── */

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-name {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--text);
}

/* ── Footer ──────────────────────────────────────────────────── */

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

.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-footer p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.site-footer a {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
}

.site-footer a:hover { color: var(--text); }

/* ── Flash ───────────────────────────────────────────────────── */

.flash {
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.flash-notice { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.flash-alert  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Post list (home page) ───────────────────────────────────── */

.page-heading {
  margin: 0 0 2.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-item {
  padding: 1.6rem 0;
  border-top: 1px solid var(--border);
}

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

.post-item-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.35;
}

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

.post-item-title a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-date {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.empty-state {
  color: var(--text-muted);
  padding: 3rem 0;
  text-align: center;
  font-size: 0.95rem;
}

/* ── Post detail ─────────────────────────────────────────────── */

.post-header {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.post-header h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.6rem, 5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.post-body {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  line-height: 1.8;
  color: #1f2937;
}

.post-body p { margin: 0 0 1.5em; }
.post-body p:last-child { margin-bottom: 0; }

.post-back {
  display: inline-block;
  margin-top: 2.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
}

.post-back:hover { color: var(--text); }

/* ── Admin shared ────────────────────────────────────────────── */

.admin-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.admin-heading-row h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.admin-footer-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
}

.admin-footer-nav a { color: var(--text-muted); text-decoration: none; }
.admin-footer-nav a:hover { color: var(--text); }

/* ── Buttons ─────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.9rem;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}

.btn-primary { background: var(--text); color: #fff; }
.btn-primary:hover { background: #374151; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: #9ca3af; }

.btn-danger {
  background: transparent;
  color: #dc2626;
  border-color: #fecaca;
}
.btn-danger:hover { background: #fef2f2; }

/* ── Admin table ─────────────────────────────────────────────── */

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

.admin-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0 0 0.65rem;
  border-bottom: 2px solid var(--border);
}

.admin-table td {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-table td:last-child {
  text-align: right;
}

.admin-table .col-title { width: 50%; }
.admin-table .col-actions { width: 30%; }

.td-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  align-items: center;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
}

.badge-published { background: #dcfce7; color: #166534; }
.badge-draft     { background: var(--bg-subtle); color: var(--text-muted); border: 1px solid var(--border); }

/* ── Forms ───────────────────────────────────────────────────── */

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
}

.form-input, .form-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}

.form-input:focus, .form-textarea:focus {
  outline: none;
  border-color: #6b7280;
}

.form-textarea {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.65;
  min-height: 420px;
  resize: vertical;
}

.form-checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.form-actions { display: flex; align-items: center; gap: 0.75rem; }

.error-list {
  padding: 0.75rem 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: #991b1b;
}

.error-list ul { margin: 0.35rem 0 0; padding-left: 1.25rem; }
.error-list li + li { margin-top: 0.2rem; }

/* ── Login ───────────────────────────────────────────────────── */

.login-page {
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: flex-start;
  padding-top: 6rem;
}

.login-card {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}

.login-card h1 {
  margin: 0 0 1.5rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
