:root {
  --paper: #faf6ef;
  --card: #fffdf9;
  --ink: #2c2723;
  --muted: #7a7068;
  --line: #e8dfd2;
  --accent: #a4553d;
  --accent-dark: #8a4430;
  --sage: #6b8170;
  --serif-display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --serif: "Lora", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
img { max-width: 100%; }
.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 24px; }
.wrap.wide { max-width: 900px; }
main { flex: 1; padding-bottom: 72px; }

/* ---------- header / footer ---------- */
.site-header { border-bottom: 1px solid var(--line); background: rgba(250, 246, 239, 0.92); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; max-width: 900px; }
.brand { font-family: var(--serif-display); font-size: 26px; font-weight: 600; font-style: italic; color: var(--ink); letter-spacing: 0.2px; white-space: nowrap; }
.brand:hover { color: var(--accent); }
.nav { display: flex; align-items: center; gap: 22px; font-size: 14px; }
.nav a, .nav button.linklike { color: var(--muted); font-weight: 500; }
.nav a:hover, .nav a.active, .nav button.linklike:hover { color: var(--ink); }
.nav a.pill { background: var(--accent); color: #fff; padding: 7px 16px; border-radius: 999px; }
.nav a.pill:hover { background: var(--accent-dark); color: #fff; }
button.linklike { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }

.site-footer { border-top: 1px solid var(--line); padding: 28px 0 36px; color: var(--muted); font-size: 13px; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; max-width: 900px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--ink); }

/* ---------- home ---------- */
.hero { text-align: center; padding: 84px 0 56px; }
.hero h1 { font-family: var(--serif-display); font-style: italic; font-weight: 500; font-size: clamp(44px, 8vw, 76px); line-height: 1.05; margin: 0 0 18px; letter-spacing: -0.5px; }
.hero p { font-family: var(--serif); font-size: 19px; color: var(--muted); max-width: 520px; margin: 0 auto; }
.flourish { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 36px auto 0; color: var(--sage); }
.flourish::before, .flourish::after { content: ""; width: 64px; height: 1px; background: var(--line); }

.post-list { display: grid; gap: 28px; }
.post-card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; color: var(--ink); transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease; }
.post-card:hover { transform: translateY(-2px); box-shadow: 0 14px 34px -18px rgba(70, 45, 25, 0.35); border-color: #dccfbd; color: var(--ink); }
.post-card .cover { aspect-ratio: 16 / 7; width: 100%; object-fit: cover; display: block; }
.post-card .inner { padding: 28px 32px 30px; }
.meta { font-size: 12.5px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--sage); font-weight: 600; }
.post-card h2 { font-family: var(--serif-display); font-weight: 600; font-size: 34px; line-height: 1.15; margin: 8px 0 10px; }
.post-card p { font-family: var(--serif); color: #5b524b; margin: 0 0 14px; font-size: 16.5px; line-height: 1.7; }
.read-more { font-size: 14px; font-weight: 600; color: var(--accent); }
.empty { text-align: center; padding: 48px 24px; color: var(--muted); font-family: var(--serif); font-size: 18px; background: var(--card); border: 1px dashed var(--line); border-radius: 14px; }
.loading { text-align: center; color: var(--muted); padding: 64px 0; font-family: var(--serif); font-style: italic; }

/* ---------- article ---------- */
.article { padding-top: 56px; }
.article header { text-align: center; margin-bottom: 36px; }
.article h1 { font-family: var(--serif-display); font-weight: 600; font-size: clamp(38px, 6.5vw, 58px); line-height: 1.1; margin: 12px 0 0; letter-spacing: -0.3px; }
.article .cover { width: 100%; border-radius: 14px; margin-bottom: 40px; display: block; }
.prose { font-family: var(--serif); font-size: 19px; line-height: 1.85; color: #37302b; overflow-wrap: break-word; }
.prose p { margin: 0 0 1.35em; }
.prose h2 { font-family: var(--serif-display); font-size: 34px; font-weight: 600; line-height: 1.2; margin: 1.6em 0 0.5em; color: var(--ink); }
.prose h3 { font-family: var(--serif-display); font-size: 27px; font-weight: 600; line-height: 1.25; margin: 1.5em 0 0.4em; color: var(--ink); }
.prose blockquote { margin: 1.6em 0; padding: 4px 0 4px 24px; border-left: 3px solid var(--accent); font-style: italic; color: #5b524b; font-size: 21px; }
.prose img { border-radius: 10px; display: block; margin: 1.6em auto; height: auto; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.35em; }
.prose li { margin-bottom: 0.4em; }
.prose a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.article-footer { margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--line); text-align: center; font-size: 15px; }
.banner { background: #fbf0d9; border: 1px solid #ecd9ae; color: #6d5516; border-radius: 10px; padding: 10px 16px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 28px; }

/* ---------- forms / buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 14.5px var(--sans); padding: 10px 20px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s; }
.btn:hover { border-color: #cdbfac; color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn.danger { color: #a33a2a; }
.btn.small { padding: 6px 14px; font-size: 13px; }
.btn:disabled { opacity: 0.55; cursor: default; }

.auth-card { max-width: 420px; margin: 72px auto 0; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 40px 36px; box-shadow: 0 20px 44px -28px rgba(70, 45, 25, 0.35); }
.auth-card h1 { font-family: var(--serif-display); font-size: 36px; font-weight: 600; margin: 0 0 6px; text-align: center; }
.auth-card .sub { text-align: center; color: var(--muted); margin: 0 0 26px; font-size: 14.5px; }
label { display: block; font-size: 13px; font-weight: 600; color: #5b524b; margin: 0 0 6px; }
input[type="text"], input[type="email"], input[type="password"] { width: 100%; font: 16px var(--sans); padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); margin-bottom: 18px; }
input:focus { outline: 2px solid rgba(164, 85, 61, 0.35); outline-offset: 1px; border-color: var(--accent); }
.auth-card .btn { width: 100%; padding: 12px; font-size: 15.5px; }
.auth-card .alt { text-align: center; margin-top: 18px; font-size: 14px; }
.error { background: #fbeae6; border: 1px solid #f0c9c0; color: #8f2f1f; border-radius: 10px; padding: 10px 14px; font-size: 14px; margin-bottom: 18px; }
.hint { color: var(--muted); font-size: 13px; margin: -10px 0 18px; }

/* ---------- dashboard ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 48px 0 28px; }
.page-head h1 { font-family: var(--serif-display); font-size: 44px; font-weight: 600; margin: 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.rows { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .title { font-family: var(--serif-display); font-size: 24px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.row .title:hover { color: var(--accent); }
.row .when { font-size: 13px; color: var(--muted); margin-top: 4px; }
.row .actions { flex-wrap: nowrap; flex-shrink: 0; }
.status { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; padding: 2px 9px; border-radius: 999px; margin-right: 8px; vertical-align: 2px; }
.status.published { background: #e3ede5; color: #3f6249; }
.status.draft { background: #f3e9d6; color: #7a5d1c; }

.tagline-box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 22px 20px; margin-bottom: 24px; }
.tagline-box label span { font-weight: 400; color: var(--muted); margin-left: 6px; }
.tagline-row { display: flex; gap: 10px; }
.tagline-row input { margin-bottom: 0; flex: 1; min-width: 0; font-family: var(--serif); }
.tagline-row .btn { flex-shrink: 0; }

/* ---------- editor ---------- */
.editor { padding-top: 36px; }
.editor-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 28px; }
.editor-bar .back { color: var(--muted); font-size: 14px; font-weight: 500; }
.title-input { width: 100%; border: 0 !important; outline: 0 !important; background: transparent !important; font: 600 clamp(34px, 6vw, 50px)/1.15 var(--serif-display) !important; color: var(--ink); padding: 0 !important; margin-bottom: 18px !important; }
.title-input::placeholder { color: #c9bdad; }
.cover-box { margin-bottom: 22px; }
.cover-box img { width: 100%; border-radius: 12px; display: block; margin-bottom: 10px; }
.editor .ql-toolbar.ql-snow { border: 1px solid var(--line); border-radius: 12px 12px 0 0; background: var(--card); position: sticky; top: 64px; z-index: 10; font-family: var(--sans); }
.editor .ql-container.ql-snow { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; background: #fff; font-size: 19px; }
.editor .ql-editor { min-height: 420px; padding: 28px 30px; font-family: var(--serif); font-size: 19px; line-height: 1.85; color: #37302b; }
.editor .ql-editor.ql-blank::before { font-style: italic; color: #c0b4a4; left: 30px; }
.editor .ql-editor p { margin: 0 0 1.1em; }
.editor .ql-editor h2 { font-family: var(--serif-display); font-size: 34px; font-weight: 600; margin: 0.8em 0 0.4em; }
.editor .ql-editor h3 { font-family: var(--serif-display); font-size: 27px; font-weight: 600; margin: 0.8em 0 0.4em; }
.editor .ql-editor blockquote { border-left: 3px solid var(--accent); padding-left: 24px; font-style: italic; color: #5b524b; margin: 1em 0; }
.editor .ql-editor img { border-radius: 10px; display: block; margin: 1em auto; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 50; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: #8f2f1f; }

@media (max-width: 600px) {
  .wrap { padding: 0 18px; }
  .hero { padding: 56px 0 40px; }
  .brand { font-size: 22px; }
  .nav { gap: 14px; font-size: 13px; }
  .post-card .inner { padding: 22px 22px 24px; }
  .post-card h2 { font-size: 28px; }
  .prose, .editor .ql-editor { font-size: 17.5px; }
  .auth-card { padding: 30px 22px; margin-top: 40px; }
  .row { flex-direction: column; align-items: flex-start; }
  .tagline-row { flex-direction: column; }
  .editor .ql-editor { padding: 20px 18px; }
  .editor .ql-editor.ql-blank::before { left: 18px; }
}
