/* Dispatches — restyled to match page.love/blog: Inter + Source Serif 4,
   cool-slate palette, centered ~640px reading column. */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,300..700&display=swap");

:root {
  --paper:  #f8fafc;
  --ink:    #020618;
  --body:   #45556c;
  --soft:   #64748b;
  --faint:  #94a3b8;
  --line:   #e2e8f0;
  --accent: #020618;
  --accent-soft: #eef2f6;
  --page:   44rem;
  --measure: 42rem;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--paper); color: var(--body);
  font-family: var(--sans); font-size: 1.0625rem; line-height: 1.65; letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { color: var(--ink); font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; margin: 0; }
h1 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.035em; }

/* chrome — Pagelove wordmark left, links right (matches page.love) */
.site-nav { display: flex; align-items: center; justify-content: space-between; max-width: var(--page); margin: 0 auto; padding: 20px clamp(1.2rem, 5vw, 2rem); min-height: 68px; }
.site-logo { display: inline-flex; align-items: center; }
.site-logo img { display: block; width: 112px; height: 28px; }
.nav-links { display: flex; gap: 1.75rem; font-family: var(--sans); font-size: 0.95rem; letter-spacing: -0.01em; }
.nav-links a { color: var(--ink); text-decoration: none; }
.nav-links a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* layout */
.wrap { max-width: var(--page); margin: 0 auto; padding: 2rem clamp(1.2rem, 5vw, 2rem) 5rem; }
.reading { max-width: var(--page); margin: 0 auto; padding: 2.5rem clamp(1.2rem, 5vw, 2rem) 5rem; }
.page-title { font-family: var(--serif); font-weight: 400; font-size: clamp(2.2rem, 6vw, 3.25rem); line-height: 1.05; letter-spacing: -0.04em; color: var(--ink); margin-bottom: 0.5rem; }
.page-sub { font-family: var(--sans); color: var(--soft); font-size: 0.95rem; margin: 0 0 2.4rem; }
.byline, .post-meta { font-family: var(--sans); font-size: 0.8rem; color: var(--soft); }
.byline a, .post-meta a { color: var(--soft); }

/* home excerpts */
.excerpts { display: flex; flex-direction: column; gap: 2.6rem; max-width: none; margin: 0; }
.excerpt h2 { font-family: var(--serif); font-weight: 500; font-size: 1.9rem; line-height: 1.12; letter-spacing: -0.025em; margin-bottom: 0.4rem; }
.excerpt h2 a { color: var(--ink); text-decoration: none; }
.excerpt h2 a:hover { text-decoration: underline; text-underline-offset: 3px; }
.excerpt .byline { margin-bottom: 0.7rem; }
.excerpt p.lede { margin: 0 0 0.6rem; color: var(--body); }
.excerpt .more { font-family: var(--sans); font-size: 0.9rem; font-weight: 600; text-decoration: none; }
.excerpt .more:hover { text-decoration: underline; text-underline-offset: 3px; }
.divider { border: none; border-top: 1px solid var(--line); margin: 0; }

/* archive */
.archive-month { font-family: var(--sans); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); margin: 2.2rem 0 0.5rem; }
.archive-month:first-child { margin-top: 0; }
.archive-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.archive-row a { color: var(--ink); font-size: 1.05rem; text-decoration: none; }
.archive-row a:hover { text-decoration: underline; text-underline-offset: 3px; }
.archive-row time { font-family: var(--sans); font-size: 0.8rem; color: var(--faint); white-space: nowrap; }

/* post page */
.post article > h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(2.4rem, 6.5vw, 3.5rem); line-height: 1.04; letter-spacing: -0.045em; margin-bottom: 0.6rem; }
.post article > .byline { margin-bottom: 2.5rem; padding-bottom: 2rem; border-bottom: 1px solid var(--line); }
.post article [itemprop="excerpt"] { display: none; }
.post article [itemprop="body"] { font-size: 1.0625rem; color: var(--body); }
.post article [itemprop="body"] p { margin: 0 0 1.3rem; }
.post article [itemprop="body"] h2 { font-family: var(--sans); font-weight: 600; font-size: 1.2rem; letter-spacing: -0.015em; color: var(--ink); margin: 2.6rem 0 0.9rem; }
.post article [itemprop="body"] h3 { font-family: var(--sans); font-weight: 600; font-size: 1.05rem; letter-spacing: -0.01em; color: var(--ink); margin: 2rem 0 0.7rem; }
.post article [itemprop="body"] a { color: var(--ink); }
.post article [itemprop="body"] blockquote { margin: 1.5rem 0; padding-left: 1.2rem; border-left: 3px solid var(--line); color: var(--soft); font-style: italic; }
.post article [itemprop="body"] ul, .post article [itemprop="body"] ol { margin: 0 0 1.3rem 1.3rem; padding: 0; }
.post article [itemprop="body"] li { margin: 0 0 0.4rem; }
.post article [itemprop="body"] code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88em; background: var(--accent-soft); padding: 0.1em 0.4em; border-radius: 4px; }
.post article [itemprop="body"] pre { background: #0f172a; color: #e2e8f0; padding: 1rem 1.2rem; border-radius: 8px; overflow-x: auto; margin: 1.5rem 0; font-size: 0.86rem; line-height: 1.6; }
.post article [itemprop="body"] pre code { background: none; padding: 0; color: inherit; font-size: 1em; }
.post-figure { margin: 2rem 0; }
.post-figure img { display: block; max-width: 100%; height: auto; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 1rem; }
.post article > .post-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 2.5rem; }
.tag-chip { font-family: var(--sans); font-size: 0.8rem; line-height: 1; color: var(--soft); text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 0.4em 0.75em; }
.tag-chip::before { content: "#"; opacity: 0.5; }
.tag-chip:hover { color: var(--ink); border-color: var(--ink); text-decoration: none; }
.post article > .comments-title { font-family: var(--sans); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); margin: 3rem 0 1rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.comment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1.3rem; }
.comment .comment-meta { font-family: var(--sans); font-size: 0.85rem; color: var(--soft); margin: 0 0 0.2rem; }
.comment .comment-meta strong { color: var(--ink); font-weight: 600; }
.comment [itemprop="body"] { font-size: 1rem; }
.comment [itemprop="body"] p { margin: 0; }
.comment-list:empty::after { content: "No comments yet."; color: var(--faint); font-style: italic; }
.post-missing { display: block; padding-top: 0.5rem; }
.post > article ~ .post-missing { display: none; }
.post .comment-form { display: none; }
.post > article ~ .comment-form { display: flex; }
.back { font-family: var(--sans); font-size: 0.9rem; color: var(--soft); display: inline-block; margin-top: 2.5rem; text-decoration: none; }
.back:hover { text-decoration: underline; text-underline-offset: 3px; }

/* comment form */
.comment-form { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 0.8rem; max-width: var(--measure); }
.comment-form h3 { font-family: var(--sans); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.comment-form input, .comment-form textarea, .editor input, .editor textarea, .editor select {
  font-family: var(--sans); font-size: 1rem; padding: 0.6rem 0.7rem; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink); width: 100%;
}
.comment-form textarea, .editor textarea { resize: vertical; min-height: 5rem; line-height: 1.6; }
.comment-form input:focus, .comment-form textarea:focus, .editor input:focus, .editor textarea:focus, .editor select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(2,6,24,.08); }
.comment-form .row { display: flex; gap: 0.8rem; align-items: center; }
.form-note { font-family: var(--sans); font-size: 0.82rem; color: var(--faint); margin: 0; min-height: 1.2em; }
.form-note[data-tone="err"] { color: #b91c1c; }

.btn { font-family: var(--sans); font-size: 0.9rem; font-weight: 600; color: #f8fafc; background: var(--ink); border: 1px solid var(--ink); border-radius: 10px; padding: 0.6rem 1.2rem; cursor: pointer; align-self: flex-start; }
.btn:hover { background: #1e293b; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); background: transparent; }
.btn-ghost.danger { color: #b91c1c; }

/* admin */
.admin-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.6rem; flex-wrap: wrap; }
.admin-actions { display: flex; align-items: center; gap: 0.6rem; }
.admin-list { list-style: none; margin: 0; padding: 0; }
.admin-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.admin-row .a-title { font-weight: 600; color: var(--ink); }
.admin-row .a-slug { font-family: var(--sans); font-size: 0.78rem; color: var(--faint); }
.a-status { font-family: var(--sans); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.15em 0.55em; border-radius: 999px; margin-left: 0.55rem; vertical-align: 0.1em; }
.a-status--Draft { background: #fef3c7; color: #92400e; }
.a-status--Published { background: #dcfce7; color: #166534; }
.admin-row .a-actions { display: flex; gap: 0.5rem; font-family: var(--sans); }
.admin-row .a-actions button { font-family: var(--sans); font-size: 0.82rem; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 0.25rem 0.6rem; cursor: pointer; color: var(--soft); }
.admin-row .a-actions button:hover { border-color: var(--ink); color: var(--ink); }

/* editor modal */
.editor-scrim { position: fixed; inset: 0; background: rgba(2,6,24,.4); z-index: 50; display: grid; place-items: center; padding: 2vh 2vw; overflow: hidden; }
.editor { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 30px 80px -40px rgba(2,6,24,.5); width: min(1400px, 96vw); height: 96vh; max-height: 96vh; padding: 1.4rem 1.6rem; display: flex; flex-direction: column; gap: 0.7rem; }
.editor h2 { font-family: var(--serif); font-weight: 500; font-size: 1.4rem; }
.editor label { display: flex; flex-direction: column; gap: 0.3rem; font-family: var(--sans); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); }
.editor .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.editor .body-field { display: flex; flex-direction: column; gap: 0.3rem; flex: 1 1 auto; min-height: 0; }
.editor .body-head { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; }
.editor .field-label { font-family: var(--sans); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); }
.editor .raw-toggle { flex-direction: row; align-items: center; gap: 0.4rem; text-transform: none; letter-spacing: 0; font-size: 0.72rem; color: var(--soft); cursor: pointer; }
.editor .raw-toggle input[type="checkbox"] { width: auto; min-height: 0; padding: 0; margin: 0; border: 0; border-radius: 0; background: none; box-shadow: none; appearance: auto; -webkit-appearance: auto; }
.editor textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; }
.editor .rich-body, .editor .raw-body { flex: 1 1 auto; min-height: 8rem; width: 100%; overflow: auto; }
.rich-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem; }
.rich-toolbar[hidden] { display: none; }
.rt-btn { font-family: var(--sans); font-size: 0.8rem; padding: 0.3rem 0.5rem; min-width: 1.9rem; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--body); cursor: pointer; line-height: 1; }
.rt-btn:hover { background: var(--line); color: var(--ink); }
.rt-b { font-weight: 700; }
.rt-i { font-style: italic; }
.rt-u { text-decoration: underline; }
.rt-sep { width: 1px; align-self: stretch; background: var(--line); margin: 0.15rem 0.2rem; }
.rich-body { border: 1px solid var(--line); border-top: none; border-radius: 0 0 8px 8px; background: #fff; padding: 1rem 1.2rem; font-family: var(--serif); font-size: 1.02rem; line-height: 1.75; color: var(--ink); outline: none; }
.rich-body:focus { border-color: var(--ink); }
.rich-body:empty::before { content: attr(data-placeholder); color: var(--faint); }
.rich-body > :first-child { margin-top: 0; }
.rich-body h2 { font-family: var(--serif); font-weight: 500; font-size: 1.5rem; margin: 1.4rem 0 0.5rem; }
.rich-body h3 { font-family: var(--serif); font-weight: 500; font-size: 1.2rem; margin: 1.1rem 0 0.4rem; }
.rich-body p { margin: 0 0 0.9rem; }
.rich-body blockquote { border-left: 3px solid var(--line); margin: 1rem 0; padding-left: 1rem; color: var(--soft); font-style: italic; }
.rich-body ul, .rich-body ol { margin: 0 0 0.9rem 1.5rem; }
.rich-body li { margin: 0.2rem 0; }
.rich-body img { max-width: 100%; height: auto; }
.rich-body figure { margin: 1.2rem 0; }
.rich-body pre { background: #0f172a; color: #e2e8f0; padding: 1rem 1.2rem; border-radius: 8px; overflow-x: auto; font-size: 0.86rem; }
.rich-body a { color: var(--accent); }
/* Write-first editor layout: prominent title, status pill, collapsible metadata */
.editor-head { display: flex; align-items: flex-start; gap: 1rem; }
.editor .title-input { flex: 1 1 auto; width: 100%; font-family: var(--serif); font-weight: 500; font-size: 1.8rem; line-height: 1.25; border: none; background: none; padding: 0.15rem 0; color: var(--ink); }
.editor .title-input:focus { outline: none; }
.editor .title-input::placeholder { color: var(--faint); }
.status-seg { display: inline-flex; flex: none; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: #fff; margin-top: 0.35rem; }
.seg-btn { font-family: var(--sans); font-size: 0.76rem; letter-spacing: 0.02em; padding: 0.35rem 0.85rem; border: none; background: none; color: var(--soft); border-radius: 999px; cursor: pointer; line-height: 1; transition: color .15s, background .15s; }
.seg-btn:hover { color: var(--ink); }
.seg-btn.active { background: var(--ink); color: var(--paper); }
.editor-details { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.editor-details > summary { list-style: none; cursor: pointer; padding: 0.5rem 0.8rem; display: flex; align-items: center; gap: 0.55rem; }
.editor-details > summary::-webkit-details-marker { display: none; }
.editor-details > summary::before { content: "▸"; color: var(--faint); font-size: 0.7rem; }
.editor-details[open] > summary::before { content: "▾"; }
.editor-details[open] > summary { border-bottom: 1px solid var(--line); }
.sum-label { font-family: var(--sans); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--body); }
.sum-hint { font-family: var(--sans); font-size: 0.78rem; color: var(--faint); }
.details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; padding: 0.8rem; }
.details-grid > label:last-child { grid-column: 1 / -1; }
.body-bar { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.3rem 0.5rem; border: 1px solid var(--line); border-bottom: none; border-radius: 8px 8px 0 0; background: #fff; }
.editor .raw-body { border-top: none; border-radius: 0 0 8px 8px; }
.editor-actions { display: flex; gap: 0.6rem; margin-top: 0.6rem; }

.site-foot { font-family: var(--sans); max-width: var(--page); margin: 4rem auto 0; padding: 2rem clamp(1.2rem, 5vw, 2rem); color: var(--faint); font-size: 0.8rem; border-top: 1px solid var(--line); }
.empty-note { color: var(--faint); font-style: italic; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
