:root {
  --ink: #1a1a1a;
  --muted: #5c5c5c;
  --paper: #f7f5f1;
  --card: #ffffff;
  --line: #d9d4cb;
  --accent: #1f4b3a;
  --accent-2: #0f2e24;
  --danger: #8b1e1e;
  --max: 44rem;
  --wide: 64rem;
  --font: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Avenir Next", "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 10% -10%, #e8efe9 0%, transparent 55%),
    linear-gradient(180deg, #fbfaf7 0%, var(--paper) 40%, #efebe3 100%);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.55;
  min-height: 100vh;
}

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

.wrap {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}
.wrap.wide { width: min(100% - 2rem, var(--wide)); }

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
  width: min(100% - 2rem, var(--wide));
}
.brand {
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--ink);
  font-size: 1.05rem;
}
.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  font-family: var(--sans);
  font-size: 0.92rem;
}
.site-header nav a { text-decoration: none; color: var(--muted); }
.site-header nav a:hover { color: var(--ink); }

main.wrap { padding: 2rem 0 4rem; }

.article-header h1,
.page > h1,
.admin h1 {
  font-size: clamp(1.6rem, 2.5vw, 2.2rem);
  line-height: 1.2;
  margin: 0 0 1rem;
}

.edit-link { font-family: var(--sans); font-size: 0.85rem; margin-top: -0.5rem; }

.prose :first-child { margin-top: 0; }
.prose h2, .prose h3 {
  line-height: 1.25;
  margin-top: 1.8rem;
}
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li { margin: 0.35rem 0; }
.prose img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem 0;
  border: 1px solid var(--line);
  background: #fff;
}
.prose figure { margin: 1.25rem 0; }
.prose figcaption {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.4rem;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.prose th, .prose td {
  border: 1px solid var(--line);
  padding: 0.45rem 0.55rem;
  vertical-align: top;
}
.prose blockquote {
  margin: 1rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.recent, .journal-list {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.recent h2 { font-size: 1.2rem; }
.recent ul, .journal-list { padding-left: 1.1rem; }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem 0 2.5rem;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.85rem;
}

/* Admin */
.admin-card, .admin {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.25rem 1.35rem 1.6rem;
  box-shadow: 0 10px 30px rgba(30, 40, 30, 0.04);
}
.admin-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.stack { display: grid; gap: 0.9rem; }
.stack label, .editor label {
  display: grid;
  gap: 0.35rem;
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--muted);
}
input[type="text"], input[type="email"], input[type="password"], select, textarea {
  font: inherit;
  font-family: var(--sans);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  background: #fff;
  width: 100%;
}
textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.45;
}
button, .button {
  font-family: var(--sans);
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 0.7rem 1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .button:hover { background: var(--accent-2); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; } }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.9rem;
}
.admin-table th, .admin-table td {
  text-align: left;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.muted { color: var(--muted); font-family: var(--sans); font-size: 0.9rem; }
.error { color: var(--danger); font-family: var(--sans); }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.85em; }
