:root {
  --bg: #fbfaf7; --surface: #ffffff; --ink: #24211d; --muted: #6f6a62; --line: #e7e2d9;
  --accent: #2f6f6a; --accent-soft: #e4efed; --warn: #9a5b12; --warn-soft: #fbf0df; --danger: #a33a2c;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 18px/1.7 var(--serif); }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
.wrap { max-width: 42rem; margin: 0 auto; padding: 0 1.25rem; }
body.owner .wrap { max-width: 72rem; }
.site-header { border-top: 4px solid var(--accent); padding: 2.5rem 0 1.5rem; }
.site-title { font-size: 1.6rem; font-weight: 600; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.tagline { margin: .2rem 0 0; color: var(--muted); font-family: var(--sans); font-size: .95rem; }
main { padding-bottom: 3rem; min-height: 60vh; }
.site-footer { border-top: 1px solid var(--line); padding: 1.5rem 0 2.5rem; color: var(--muted); font: .85rem/1.5 var(--sans); }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.entry-list { list-style: none; padding: 0; margin: 1rem 0 0; }
.entry-item { padding: 1.6rem 0; border-bottom: 1px solid var(--line); }
.entry-item:first-child { padding-top: .5rem; }
.entry-item h2 { margin: .15rem 0 .4rem; font-size: 1.45rem; line-height: 1.3; font-weight: 600; }
.entry-item h2 a { color: var(--ink); text-decoration: none; }
.entry-item h2 a:hover { color: var(--accent); }
time { font: .8rem/1.4 var(--sans); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.excerpt { margin: 0; color: #4a4640; }
.sample-tag { display: inline-block; margin-top: .5rem; font: 600 .7rem/1 var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--warn); background: var(--warn-soft); padding: .3rem .5rem; border-radius: 3px; }

.entry header { margin: .5rem 0 2rem; }
.entry h1 { font-size: 2.2rem; line-height: 1.2; margin: .3rem 0 .4rem; letter-spacing: -0.015em; }
.prose { font-size: 1.1rem; }
.prose p { margin: 0 0 1.2em; }
.prose h2 { font-size: 1.4rem; margin: 2rem 0 .6rem; line-height: 1.3; }
.prose h3 { font-size: 1.15rem; margin: 1.6rem 0 .5rem; }
.prose blockquote { margin: 1.5rem 0; padding: .1rem 0 .1rem 1.2rem; border-left: 3px solid var(--accent); color: #4a4640; font-style: italic; }
.prose img { max-width: 100%; height: auto; border-radius: 4px; }
.prose code { font-size: .88em; background: #f1eee8; padding: .1em .35em; border-radius: 3px; }
.prose pre { background: #f1eee8; padding: 1rem; overflow-x: auto; border-radius: 4px; }
.prose pre code { background: none; padding: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem auto; width: 40%; }
.back { margin-top: 3rem; font-family: var(--sans); font-size: .95rem; }

/* Writing side */
body.owner, .card, .narrow { font-family: var(--sans); font-size: 16px; line-height: 1.55; }
.owner h1, .narrow h1 { font-family: var(--serif); font-weight: 600; font-size: 1.7rem; margin: .5rem 0; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar h2 { margin: 0; font-size: 1.1rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.narrow { max-width: 26rem; margin: 2rem auto; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 1.5rem; }
.stack { display: grid; gap: 1rem; }
label { display: grid; gap: .35rem; font: 600 .85rem/1.3 var(--sans); color: var(--muted); }
input[type=text], input[type=password], input[type=date], input[type=url], textarea {
  width: 100%; font: 400 1rem/1.5 var(--sans); color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 6px; padding: .6rem .75rem; }
input:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.btn { display: inline-block; font: 600 .95rem/1 var(--sans); padding: .7rem 1.1rem; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.subtle { background: transparent; }
.btn.danger { color: var(--danger); border-color: #e9c9c4; background: #fff; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
form.inline { display: inline; }
.error { color: var(--danger); background: #fbeae7; padding: .6rem .8rem; border-radius: 6px; }
.notice { color: var(--accent); background: var(--accent-soft); padding: .6rem .8rem; border-radius: 6px; }
.badge { display: inline-block; font: 600 .75rem/1 var(--sans); padding: .35rem .6rem; border-radius: 999px; white-space: nowrap; }
.badge.pending { background: var(--warn-soft); color: var(--warn); }
.badge.posted { background: var(--accent-soft); color: var(--accent); }
.dash-list { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.dash-item { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.dash-item:last-child { border-bottom: 0; }
.dash-title { font-weight: 600; font-size: 1.05rem; color: var(--ink); text-decoration: none; }
.dash-actions { display: flex; gap: .9rem; align-items: center; font-size: .9rem; }
.dash-item .sample-tag { margin: 0 0 0 .3rem; }
.empty { padding: 1rem 1.25rem; color: var(--muted); list-style: none; }

.editor { display: grid; gap: 1rem; }
.meta-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.meta-row .grow { flex: 1 1 20rem; }
.panes { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.pane { display: grid; grid-template-rows: auto 1fr; gap: .35rem; min-width: 0; }
.pane-label { font: 600 .85rem/1.3 var(--sans); color: var(--muted); }
textarea { min-height: 28rem; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .95rem; line-height: 1.6; }
.preview { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: .8rem 1.2rem; min-height: 28rem; overflow: auto; font-family: var(--serif); font-size: 1.05rem; line-height: 1.7; color: var(--ink); }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row input[type=url] { flex: 1 1 18rem; width: auto; }
.substack { margin-top: 2rem; }
.danger-zone { margin-top: 1.5rem; text-align: right; }

@media (max-width: 760px) {
  body { font-size: 17px; }
  .site-header { padding: 1.75rem 0 1rem; }
  .entry h1 { font-size: 1.8rem; }
  .panes { grid-template-columns: 1fr; }
  textarea, .preview { min-height: 16rem; }
}
