:root {
  --ink: #1a1a1a;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --bg: #ffffff;
  --maxw: 720px;
  --radius: 8px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- layout ---- */
.site-header {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 20px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.brand {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.site-header nav a { margin-left: 18px; font-size: 15px; }

.content {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 8px 20px 80px;
}

.site-footer {
  max-width: var(--maxw);
  margin: 40px auto 0;
  padding: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.muted { color: var(--muted); }
.empty { color: var(--muted); }

/* ---- post list ---- */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.post-link { font-size: 19px; font-weight: 600; color: var(--ink); }
.post-date { color: var(--muted); font-size: 14px; white-space: nowrap; }

/* ---- single post ---- */
.post-title { font-size: 34px; line-height: 1.15; letter-spacing: -0.02em; margin: 12px 0 6px; }
.post-meta { display: flex; align-items: baseline; gap: 14px; margin-bottom: 28px; }
.post-meta .post-date { margin: 0; }
.edit-link { font-size: 14px; }
.draft-flag {
  display: inline-block; background: #fef3c7; color: #92400e;
  font-size: 13px; padding: 3px 10px; border-radius: 999px; margin: 0 0 8px;
}

.post-body { font-size: 18px; }
.post-body h2 { font-size: 26px; margin: 1.6em 0 .4em; letter-spacing: -0.01em; }
.post-body h3 { font-size: 21px; margin: 1.4em 0 .3em; }
.post-body p { margin: 0 0 1.1em; }
.post-body ul, .post-body ol { margin: 0 0 1.1em; padding-left: 1.4em; }
.post-body blockquote {
  margin: 1.2em 0; padding: 4px 0 4px 18px;
  border-left: 3px solid var(--line); color: var(--muted);
}
.post-body img { max-width: 100%; height: auto; border-radius: var(--radius); }
.post-body a { text-decoration: underline; }

/* ---- image alignment (shared by editor + rendered post) ---- */
.img-center { display: block; margin: 1.2em auto; }
.img-left  { float: left;  margin: .3em 1.2em 1em 0; max-width: 50%; }
.img-right { float: right; margin: .3em 0 1em 1.2em; max-width: 50%; }

/* ---- buttons ---- */
.btn {
  display: inline-block;
  background: var(--ink); color: #fff;
  padding: 9px 16px; border-radius: var(--radius);
  font-size: 15px; border: 0; cursor: pointer; font-weight: 500;
}
.btn:hover { text-decoration: none; opacity: .9; }
.btn-plain { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-google { background: #fff; color: var(--ink); border: 1px solid var(--line); }

/* ---- login ---- */
.login-card {
  max-width: 360px; margin: 60px auto; text-align: center;
  border: 1px solid var(--line); border-radius: 12px; padding: 34px 28px;
}
.login-card h1 { margin: 0 0 6px; font-size: 24px; }
.error { color: #b91c1c; font-size: 14px; margin: 10px 0; }

/* ---- admin list ---- */
.admin-head { display: flex; align-items: center; justify-content: space-between; }
.admin-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 15px; }
.admin-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.admin-table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.row-actions { display: flex; gap: 14px; align-items: center; white-space: nowrap; }
.row-actions form { margin: 0; }
.link-danger { background: none; border: 0; color: #b91c1c; cursor: pointer; font-size: 15px; padding: 0; }
.link-danger:hover { text-decoration: underline; }
.badge { font-size: 12px; padding: 3px 9px; border-radius: 999px; }
.badge.live { background: #dcfce7; color: #166534; }
.badge.draft { background: #f3f4f6; color: #4b5563; }

/* ---- editor ---- */
.editor-form { display: flex; flex-direction: column; }
.title-input {
  border: 0; outline: 0; width: 100%;
  font-size: 30px; font-weight: 700; letter-spacing: -0.02em;
  padding: 8px 0; margin-bottom: 8px;
}
.title-input::placeholder { color: #cbd5e1; }

.toolbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px; margin-bottom: 12px;
}
.toolbar button {
  min-width: 34px; height: 32px; padding: 0 9px;
  border: 0; background: transparent; border-radius: 6px;
  cursor: pointer; font-size: 14px; color: var(--ink);
}
.toolbar button:hover { background: #f3f4f6; }
.toolbar button.is-active { background: #e0e7ff; color: var(--accent); }
.toolbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }

.editor {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; min-height: 320px;
}
.editor .ProseMirror { outline: 0; min-height: 300px; font-size: 18px; }
.editor .ProseMirror:focus { outline: 0; }
.editor .ProseMirror > * + * { margin-top: .2em; }
.editor .ProseMirror h2 { font-size: 26px; margin: 1em 0 .3em; }
.editor .ProseMirror h3 { font-size: 21px; margin: .9em 0 .3em; }
.editor .ProseMirror ul, .editor .ProseMirror ol { padding-left: 1.4em; }
.editor .ProseMirror blockquote { border-left: 3px solid var(--line); padding-left: 16px; color: var(--muted); }
.editor .ProseMirror img { max-width: 100%; height: auto; border-radius: var(--radius); }
.editor .ProseMirror img.ProseMirror-selectednode { outline: 2px solid var(--accent); }
/* placeholder-ish empty look */
.editor .ProseMirror p.is-empty:first-child::before { color: #cbd5e1; }

.editor-actions {
  display: flex; align-items: center; gap: 18px; margin-top: 18px;
}
.publish-toggle { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); }
.date-field { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); }
.date-field input { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); }
.editor-actions .btn { margin-left: 0; }
.editor-actions { flex-wrap: wrap; }

/* ---- responsive ---- */
@media (max-width: 600px) {
  body { font-size: 16px; }
  .post-title { font-size: 27px; }
  .title-input { font-size: 24px; }
  .img-left, .img-right { float: none; max-width: 100%; margin: 1.2em auto; display: block; }
}
