:root {
  --paper: #f2e5d2;
  --surface: #fbf2e4;
  --ink: #2b1b13;
  --coffee: #3a2419;
  --muted: #746150;
  --line: #d8c3a8;
  --clay: #9a563b;
  --sage: #6f725c;
  --oat: #e2cba9;
  --cream: #fff8ed;
  --shadow: 0 18px 45px rgba(58, 36, 25, 0.14);
  --article-body-width: 66ch;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 248, 237, 0.76), transparent 34%),
    linear-gradient(180deg, #f5ead9 0%, var(--paper) 42%, #ebd7bd 100%);
  color: var(--ink);
  font-family: "Nunito Sans", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--ink);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  letter-spacing: 0;
}

p {
  margin: 0;
}

header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(242, 229, 210, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 28px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.logo svg {
  width: 31px;
  height: 31px;
}

.nav-links {
  display: flex;
  gap: 28px;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 600;
  list-style: none;
}

.nav-links a {
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--ink);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-link,
.text-button {
  border: 0;
  background: transparent;
  color: var(--clay);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.admin-link:hover,
.text-button:hover {
  color: var(--coffee);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--coffee);
  color: var(--cream);
}

.btn-primary:hover {
  background: var(--clay);
}

.btn-ghost {
  border-color: var(--line);
  background: rgba(255, 250, 242, 0.58);
  color: var(--ink);
}

.btn-ghost:hover {
  border-color: var(--ink);
  background: var(--surface);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(420px, 1.08fr);
  gap: 58px;
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
  padding: 82px 28px 76px;
}

.eyebrow,
.section-kicker,
.cat-label {
  color: var(--sage);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 12ch;
  margin-top: 12px;
  font-size: clamp(3.25rem, 6.6vw, 5.55rem);
  font-weight: 500;
  line-height: 0.98;
}

.hero h1 em {
  color: var(--clay);
  font-style: italic;
  font-weight: 600;
}

.hero p.lede {
  max-width: 50ch;
  margin-top: 24px;
  color: var(--muted);
  font-size: 1.03rem;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.hero-art {
  position: relative;
}

.hero-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: var(--shadow);
}

.hero-note {
  position: absolute;
  right: 24px;
  bottom: 24px;
  max-width: 220px;
  padding: 18px;
  border: 1px solid rgba(222, 210, 193, 0.82);
  border-radius: 8px;
  background: rgba(255, 248, 237, 0.9);
  color: var(--muted);
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
}

.wave {
  display: none;
}

section {
  scroll-margin-top: 80px;
}

.categories {
  padding: 76px 28px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(251, 242, 228, 0.72);
}

.section-head {
  max-width: 1180px;
  margin: 0 auto 30px;
}

.section-head h2 {
  margin-top: 8px;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
}

.post-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.filter-btn {
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 248, 237, 0.54);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 800;
}

.filter-btn.active,
.filter-btn:hover {
  border-color: var(--coffee);
  background: var(--coffee);
  color: var(--cream);
}

.cat-grid,
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
}

.cat-card {
  min-height: 290px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--cream);
}

.cat-card .icon {
  display: none;
}

.cat-card h3 {
  margin-top: 66px;
  font-size: 1.55rem;
  line-height: 1.15;
}

.cat-card p {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.96rem;
}

.cat-card .tag {
  display: inline-flex;
  margin-top: 24px;
  color: var(--clay);
  font-weight: 700;
}

.cat-card:nth-child(1) {
  background: linear-gradient(180deg, rgba(255, 248, 237, 0.3), var(--cream)), #ead4b5;
}

.cat-card:nth-child(2) {
  background: linear-gradient(180deg, rgba(255, 248, 237, 0.24), var(--cream)), #e4c8a2;
}

.cat-card:nth-child(3) {
  background: linear-gradient(180deg, rgba(255, 248, 237, 0.24), var(--cream)), #dcc09a;
}

.posts {
  max-width: 1180px;
  margin: 0 auto;
  padding: 82px 28px;
}

.post-grid {
  margin-top: 30px;
}

.post-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(45, 36, 29, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.post-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.post-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.post-thumb {
  display: block;
  height: 210px;
  background-size: cover !important;
  background-position: center !important;
}

.post-thumb svg {
  display: none;
}

.post-card .cat-label,
.post-card-title,
.post-card-copy,
.post-card p,
.post-card .read-more {
  margin-left: 20px;
  margin-right: 20px;
}

.post-card .cat-label {
  display: block;
  margin-top: 20px;
  color: var(--sage);
}

.post-card-title {
  display: block;
  margin-top: 7px;
  color: var(--ink);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.22;
}

.post-card-copy {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.post-card .read-more {
  display: inline-flex;
  margin-top: 20px;
  margin-bottom: 22px;
  color: var(--clay);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.post-detail {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 28px 88px;
}

.post-reader {
  padding: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 248, 237, 0.72);
  box-shadow: var(--shadow);
}

.post-reader h2 {
  max-width: 12ch;
  margin-top: 14px;
  font-size: clamp(2.8rem, 7vw, 5rem);
  line-height: 0.98;
}

.reader-date {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.reader-body {
  width: 100%;
  max-width: var(--article-body-width);
  margin-top: 30px;
  color: var(--muted);
  font-size: 1.04rem;
}

.reader-body p + p {
  margin-top: 18px;
}

.comments {
  margin-top: 46px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.comments-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.comments-head h3 {
  font-size: 2rem;
}

#comment-count,
.empty-comments {
  color: var(--muted);
  font-size: 0.92rem;
}

.comment-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.comment {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--cream);
}

.comment div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--coffee);
  font-size: 0.92rem;
}

.comment span {
  color: var(--muted);
}

.comment p {
  margin-top: 8px;
  color: var(--muted);
}

.comment-form {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.comment-form input,
.comment-form textarea,
.post-form input,
.post-form select,
.post-form textarea,
.admin-login input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--cream);
  color: var(--ink);
  font: inherit;
}

.comment-form textarea,
.post-form textarea {
  resize: vertical;
}

.about-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  align-items: stretch;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px 88px;
}

.about-copy,
.about-card,
.admin-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 248, 237, 0.62);
}

.about-copy {
  padding: 42px;
}

.about-copy h2 {
  max-width: 14ch;
  margin-top: 10px;
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  line-height: 0.98;
}

.about-copy p {
  max-width: 62ch;
  margin-top: 22px;
  color: var(--muted);
  font-size: 1.03rem;
}

.about-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 28px;
  background: var(--coffee);
  color: var(--cream);
}

.about-card span {
  color: #d9be8f;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.about-card p {
  margin-top: 14px;
  color: rgba(255, 248, 237, 0.78);
}

.admin-section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px 88px;
}

.admin-panel {
  padding: 30px;
}

.admin-login {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px) auto;
  gap: 12px;
  align-items: center;
}

.admin-login p,
.admin-toolbar p {
  color: var(--muted);
}

.fine-print {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.84rem;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.post-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.post-form label,
.post-form .rich-editor-label {
  display: grid;
  gap: 7px;
  color: var(--coffee);
  font-size: 0.9rem;
  font-weight: 800;
}

.post-form .rich-editor-label,
.form-actions {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.danger {
  color: #8b3629;
}

.admin-status,
.login-status {
  color: var(--sage);
  font-size: 0.9rem;
  font-weight: 800;
}

.save-prompt {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--sage);
  font-size: 0.9rem;
  font-weight: 800;
}

.save-prompt[hidden] {
  display: none;
}

.save-prompt button {
  min-height: 30px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--cream);
  color: var(--coffee);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
}

.save-prompt button:hover {
  border-color: var(--coffee);
  background: var(--coffee);
  color: var(--cream);
}

.login-status {
  grid-column: 1 / -1;
  color: #8b3629;
}

.no-posts {
  grid-column: 1 / -1;
  padding: 48px 0;
  color: var(--muted);
  text-align: center;
}

.postcard-section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px 88px;
}

.postcard {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  overflow: hidden;
  border-radius: 10px;
  background: var(--coffee);
  color: var(--cream);
}

.postcard-left,
.postcard-right {
  padding: 42px;
}

.postcard-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

.postcard-left h2 {
  color: var(--cream);
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1;
}

.postcard-left p {
  max-width: 42ch;
  color: rgba(252, 248, 240, 0.75);
}

.postcard .section-kicker {
  color: #c9d2c0;
}

.postcard-divider,
.stamp {
  display: none;
}

form.signup {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: start;
}

form.signup input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid rgba(252, 248, 240, 0.22);
  border-radius: 999px;
  background: rgba(252, 248, 240, 0.08);
  color: var(--cream);
  font: inherit;
}

form.signup input::placeholder {
  color: rgba(252, 248, 240, 0.58);
}

form.signup input:focus {
  outline: 2px solid rgba(252, 248, 240, 0.54);
  outline-offset: 2px;
}

form.signup .btn-primary {
  background: var(--cream);
  color: var(--ink);
}

.fine {
  grid-column: 1 / -1;
  color: rgba(252, 248, 240, 0.58);
  font-size: 0.82rem;
}

footer {
  padding: 54px 28px 30px;
  background: #201914;
  color: var(--cream);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: 40px;
  max-width: 1180px;
  margin: 0 auto;
  padding-bottom: 34px;
  border-bottom: 1px solid rgba(252, 248, 240, 0.16);
}

.footer-logo {
  margin-bottom: 10px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.48rem;
  font-weight: 600;
}

.footer-mark {
  width: 23px;
  height: 23px;
  display: inline-block;
  margin-right: 7px;
  vertical-align: -5px;
}

footer p {
  max-width: 34ch;
  color: rgba(252, 248, 240, 0.65);
  font-size: 0.94rem;
}

footer h4 {
  margin: 0 0 12px;
  color: rgba(252, 248, 240, 0.78);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

footer ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

footer a {
  color: rgba(252, 248, 240, 0.66);
  font-size: 0.93rem;
  text-decoration: none;
}

footer a:hover {
  color: var(--cream);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  max-width: 1180px;
  margin: 0 auto;
  padding-top: 22px;
  color: rgba(252, 248, 240, 0.45);
  font-size: 0.8rem;
}

@media (max-width: 920px) {
  .nav {
    padding: 16px 22px;
  }

  .nav-links {
    display: none;
  }

  .nav-actions {
    margin-left: auto;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 34px;
    padding: 48px 22px 58px;
  }

  .hero h1 {
    max-width: 12ch;
  }

  .hero-art {
    order: -1;
  }

  .cat-grid,
  .post-grid,
  .footer-grid,
  .about-section {
    grid-template-columns: 1fr;
  }

  .cat-card {
    min-height: 220px;
  }

  .cat-card h3 {
    margin-top: 30px;
  }

  .postcard {
    grid-template-columns: 1fr;
  }

  form.signup {
    grid-template-columns: 1fr;
  }

  .admin-login,
  .post-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .logo {
    font-size: 1.14rem;
  }

  header .btn {
    display: none;
  }

  .admin-link {
    font-size: 0.82rem;
  }

  .hero h1 {
    font-size: 3.2rem;
  }

  .hero-note {
    position: static;
    max-width: none;
    margin-top: 12px;
  }

  .categories,
  .posts,
  .post-detail,
  .about-section,
  .admin-section,
  .postcard-section,
  footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .post-reader,
  .about-copy,
  .about-card,
  .admin-panel {
    padding: 24px;
  }

  .post-reader h2 {
    font-size: 3rem;
  }

  .postcard-left,
  .postcard-right {
    padding: 30px 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* ---------- STANDALONE PAGES ---------- */
.page-hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 76px 28px 30px;
}

.page-hero h1,
.about-copy h1,
.admin-section h1 {
  max-width: 12ch;
  margin: 10px 0 0;
  color: var(--ink);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(3.2rem, 8vw, 5.6rem);
  font-weight: 500;
  line-height: 0.98;
}

.page-hero p {
  max-width: 54ch;
  margin-top: 18px;
  color: var(--muted);
  font-size: 1.05rem;
}

.page-posts {
  padding-top: 26px;
}

.cat-link {
  color: inherit;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.cat-link:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.standalone {
  padding-top: 76px;
}

.post-open {
  text-decoration: none;
}

@media (max-width: 560px) {
  .page-hero,
  .standalone {
    padding-top: 48px;
  }
}

.comment-status,
.fine-print [data-backend-mode] {
  color: var(--sage);
  font-size: 0.9rem;
  font-weight: 800;
}

/* ---------- RICH POST EDITOR ---------- */
.rich-editor-label {
  grid-column: 1 / -1;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  max-width: calc(var(--article-body-width) + 38px);
  padding: 10px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: rgba(255, 248, 237, 0.7);
}

.editor-toolbar button {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--cream);
  color: var(--coffee);
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 800;
}

.editor-toolbar button:hover {
  border-color: var(--coffee);
  background: var(--coffee);
  color: var(--cream);
}

.editor-toolbar button.active {
  border-color: var(--coffee);
  background: var(--coffee);
  color: var(--cream);
}

.editor-toolbar [data-text-size="small"] {
  font-size: 0.76rem;
}

.editor-toolbar [data-text-size="large"] {
  font-size: 0.94rem;
}

.editor-toolbar [data-text-size="huge"] {
  font-size: 1.04rem;
}

.toolbar-divider {
  width: 1px;
  min-height: 30px;
  background: var(--line);
  margin: 0 2px;
}

.rich-editor {
  width: 100%;
  max-width: calc(var(--article-body-width) + 38px);
  min-height: 280px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 0 0 10px 10px;
  background: var(--cream);
  color: var(--ink);
  font-weight: 500;
  outline: none;
}

.rich-editor:focus {
  border-color: var(--coffee);
  box-shadow: 0 0 0 3px rgba(58, 36, 25, 0.08);
}

.rich-editor p,
.rich-editor ul,
.rich-editor ol,
.rich-editor blockquote,
.rich-editor figure {
  margin: 0 0 16px;
}

.rich-editor h2,
.rich-editor h3 {
  margin: 22px 0 12px;
  font-family: "Cormorant Garamond", Georgia, serif;
  line-height: 1.05;
}

.rich-editor h2 { font-size: 2rem; }
.rich-editor h3 { font-size: 1.55rem; }

.rich-editor a,
.reader-body a {
  color: var(--clay);
  font-weight: 800;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.rich-editor img,
.reader-body img {
  width: 100%;
  border-radius: 10px;
  margin-top: 10px;
  box-shadow: 0 12px 32px rgba(58, 36, 25, 0.12);
}

.rich-editor figure,
.reader-body figure {
  max-width: 100%;
}

.rich-editor figure {
  cursor: grab;
  position: relative;
}

.rich-editor figure:active {
  cursor: grabbing;
}

.rich-editor figure.selected {
  outline: 3px solid rgba(154, 86, 59, 0.28);
  outline-offset: 5px;
}

.rich-editor figure.dragging {
  opacity: 0.55;
}

.rich-editor figure img,
.reader-body figure img {
  width: 100%;
  height: auto;
}

.rich-editor figure[style*="height"] img,
.reader-body figure[style*="height"] img {
  height: 100%;
  object-fit: fill;
}

.figure-resize-handle {
  display: none;
}

.rich-editor figure.selected > .figure-resize-handle {
  position: absolute;
  right: -11px;
  bottom: -11px;
  display: block;
  width: 22px;
  height: 22px;
  border: 2px solid var(--cream);
  border-radius: 50%;
  background: var(--clay);
  box-shadow: 0 6px 16px rgba(58, 36, 25, 0.2);
  cursor: nwse-resize;
  user-select: none;
}

.rich-editor figure.image-align-right.selected > .figure-resize-handle {
  right: auto;
  left: -11px;
  cursor: nesw-resize;
}

body.resizing-figure {
  cursor: nwse-resize;
  user-select: none;
}

.rich-editor figure.image-align-full,
.reader-body figure.image-align-full {
  clear: both;
  float: none;
  margin: 32px 0;
}

.rich-editor figure.image-align-left,
.reader-body figure.image-align-left {
  float: left;
  margin: 8px 24px 18px 0;
}

.rich-editor figure.image-align-right,
.reader-body figure.image-align-right {
  float: right;
  margin: 8px 0 18px 24px;
}

.rich-editor figure.image-size-small,
.reader-body figure.image-size-small {
  width: min(220px, 48%);
}

.rich-editor figure.image-size-medium,
.reader-body figure.image-size-medium {
  width: min(340px, 58%);
}

.rich-editor figure.image-size-large,
.reader-body figure.image-size-large {
  width: 100%;
}

.rich-editor figure.image-align-left.image-size-large,
.rich-editor figure.image-align-right.image-size-large,
.reader-body figure.image-align-left.image-size-large,
.reader-body figure.image-align-right.image-size-large {
  width: min(420px, 58%);
}

.rich-editor figcaption,
.reader-body figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-style: italic;
  text-align: center;
}

.editor-help {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.draft-sync-status {
  color: var(--sage);
  font-size: 0.84rem;
  font-weight: 800;
}

.reader-body h2,
.reader-body h3 {
  max-width: 15ch;
  margin: 34px 0 14px;
  color: var(--coffee);
  font-family: "Cormorant Garamond", Georgia, serif;
  line-height: 1.04;
}

.reader-body h2 { font-size: clamp(2.1rem, 5vw, 3.3rem); }
.reader-body h3 { font-size: clamp(1.65rem, 4vw, 2.3rem); }

.reader-body ul,
.reader-body ol {
  margin: 18px 0 0 22px;
  padding: 0;
}

.reader-body li + li {
  margin-top: 8px;
}

.reader-body figure {
  margin: 32px 0;
}

.reader-body::after,
.rich-editor::after {
  content: "";
  display: block;
  clear: both;
}

.reader-body blockquote {
  margin: 30px 0;
  padding: 18px 22px;
  border-left: 4px solid var(--clay);
  background: rgba(255, 248, 237, 0.7);
  color: var(--coffee);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.45rem;
  line-height: 1.25;
}

.post-preview-panel {
  margin-top: 34px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 248, 237, 0.62);
}

.post-preview-panel[hidden] {
  display: none;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.preview-reader {
  box-shadow: none;
}

.recovery-panel {
  margin-top: 34px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 248, 237, 0.62);
}

.recovery-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.recovery-head h2 {
  margin-top: 4px;
  font-size: 2rem;
}

.recovery-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.recovery-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  color: var(--muted);
}

.recovery-item {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(216, 195, 168, 0.72);
  border-radius: 8px;
  background: var(--cream);
}

.recovery-item div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: baseline;
  justify-content: space-between;
}

.recovery-item strong {
  color: var(--coffee);
}

.recovery-item span,
.recovery-item small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.recovery-item .btn {
  justify-self: start;
  min-height: 36px;
  padding: 9px 14px;
}

/* ---------- ADMIN LOGIN GATE ---------- */
.admin-nav {
  justify-content: center;
}

.admin-page .admin-gate {
  min-height: calc(100vh - 78px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 48px;
}

.admin-page .admin-panel {
  width: min(100%, 1040px);
}

.admin-login-card:not([hidden]) {
  max-width: 420px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 10px 0;
}

.admin-login-card h1 {
  margin: 0 0 6px;
  color: var(--ink);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(2.4rem, 7vw, 3.4rem);
  font-weight: 500;
  line-height: 1;
  text-align: center;
}

.admin-login-card .btn {
  width: 100%;
}

.admin-editor-head {
  margin-bottom: 28px;
}

.analytics-panel {
  margin-top: 34px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 248, 237, 0.62);
}

.analytics-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.analytics-head h2 {
  margin-top: 4px;
  font-size: 2rem;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.analytics-grid div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--cream);
}

.analytics-grid span,
.analytics-list small {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.analytics-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--coffee);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 2.2rem;
  font-weight: 600;
  line-height: 1;
}

.analytics-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.analytics-lists h3 {
  margin-bottom: 8px;
  font-size: 1.4rem;
}

.analytics-list {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.analytics-row {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  overflow: hidden;
  padding: 11px 12px;
  border: 1px solid rgba(216, 195, 168, 0.7);
  border-radius: 8px;
  background: rgba(255, 248, 237, 0.72);
}

.analytics-row::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--bar-width, 0%);
  background: linear-gradient(90deg, rgba(154, 86, 59, 0.22), rgba(217, 190, 143, 0.18));
  pointer-events: none;
}

.analytics-row span {
  position: relative;
  min-width: 0;
  z-index: 1;
}

.analytics-row strong,
.analytics-row small {
  overflow-wrap: anywhere;
}

.analytics-row b {
  position: relative;
  z-index: 1;
  color: var(--coffee);
}

.rich-editor.drag-over {
  border-color: var(--clay);
  background: rgba(255, 248, 237, 0.92);
  box-shadow: 0 0 0 4px rgba(154, 86, 59, 0.12);
}

@media (max-width: 640px) {
  .analytics-grid,
  .analytics-lists {
    grid-template-columns: 1fr;
  }

  .rich-editor figure.image-align-left,
  .rich-editor figure.image-align-right,
  .reader-body figure.image-align-left,
  .reader-body figure.image-align-right {
    float: none;
    width: 100%;
    margin: 28px 0;
  }
}
