@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,650&family=Source+Sans+3:wght@400;550;650&display=swap");

:root {
  --linen: #f4ece0;
  --paper: #fffaf2;
  --ink: #2f2418;
  --ink-soft: #5b4633;
  --rule: #e4d4c0;
  --terracotta: #b85c38;
  --terracotta-deep: #8f4024;
  --moss: #4f6b52;
  --gold: #c4a35a;
  --shadow: 0 18px 40px rgba(73, 48, 28, 0.08);
  --radius: 20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #fbe8d4 0%, transparent 55%),
    radial-gradient(900px 400px at 110% 0%, #eadcc8 0%, transparent 50%),
    var(--linen);
  line-height: 1.55;
}

img { max-width: 100%; display: block; }
a { color: var(--terracotta-deep); }
button, input, textarea, select { font: inherit; }

.site-header, .site-footer {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
}
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 0 12px;
}
.brand {
  text-decoration: none;
  color: inherit;
}
.brand-kicker {
  margin: 0;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--ink-soft);
}
.brand h1, .brand-title {
  margin: 2px 0 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.45rem;
  font-weight: 650;
}
.who {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.who-name { font-weight: 650; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #efe2cf;
  color: var(--ink-soft);
}
.badge.admin { background: #f3d2c2; color: var(--terracotta-deep); }
.badge.editor { background: #dce6d8; color: var(--moss); }
.badge.draft { background: #f3e4bf; color: #7a5b16; }
.badge.published { background: #dce6d8; color: var(--moss); }

.btn, .btn-link {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary { background: var(--terracotta); color: #fffaf2; }
.btn-primary:hover { background: var(--terracotta-deep); }
.btn-ghost, .btn-link {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
}
.btn-ghost:hover, .btn-link:hover { background: #f7efe4; }
.btn[disabled] { opacity: 0.55; cursor: wait; }

main {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto 64px;
}

.lede { color: var(--ink-soft); max-width: 40rem; }
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin: 12px 0 24px;
}
.toolbar h2 {
  font-family: Fraunces, Georgia, serif;
  font-weight: 650;
  margin: 0;
}

.card, .login-card, .post-card, .empty {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.empty { padding: 36px; color: var(--ink-soft); }

.post-list { display: grid; gap: 16px; }
.post-card {
  padding: 22px 24px;
  display: grid;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}
.post-card:hover { border-color: #d2b89a; }
.post-card h3 {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.45rem;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.post-article { padding: 28px; }
.post-article h2 {
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(2rem, 4vw, 2.8rem);
  margin: 8px 0 12px;
  line-height: 1.15;
}
.post-body {
  font-size: 1.08rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.post-body.is-plain {
  white-space: pre-wrap;
}
.post-body.is-html {
  white-space: normal;
}
.post-body.is-html p {
  margin: 0 0 1em;
}
.post-body.is-html p:last-child {
  margin-bottom: 0;
}
.post-body.is-html img {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  margin: 14px auto;
  display: block;
  background: #f6eee3;
  box-shadow: 0 10px 24px rgba(73, 48, 28, 0.08);
}
.post-body.is-html figure,
.post-body.is-html .wp-caption,
.post-body.is-html .wp-block-image {
  margin: 18px 0;
  max-width: 100%;
}
.post-body.is-html figcaption,
.post-body.is-html .wp-caption-text {
  color: var(--ink-soft);
  font-size: 0.9rem;
  text-align: center;
  margin: 6px 0 0;
}
.post-body.is-html a {
  color: var(--terracotta-deep);
}
.post-body.is-html ul,
.post-body.is-html ol {
  margin: 0 0 1em;
  padding-left: 1.35em;
}
.post-body.is-html li + li {
  margin-top: 0.25em;
}
.post-body.is-html blockquote {
  margin: 16px 0;
  padding: 10px 16px;
  border-left: 3px solid var(--gold);
  color: var(--ink-soft);
  background: #f7efe4;
  border-radius: 0 12px 12px 0;
}
.post-body.is-html h1,
.post-body.is-html h2,
.post-body.is-html h3,
.post-body.is-html h4 {
  font-family: Fraunces, Georgia, serif;
  line-height: 1.2;
  margin: 1.2em 0 0.5em;
}
.post-body.is-html .aligncenter {
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.post-body.is-html .alignleft {
  float: left;
  margin: 0.25em 16px 12px 0;
  max-width: min(46%, 280px);
}
.post-body.is-html .alignright {
  float: right;
  margin: 0.25em 0 12px 16px;
  max-width: min(46%, 280px);
}
.post-body.is-html::after {
  content: "";
  display: block;
  clear: both;
}
.photos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 24px;
}
.photos figure {
  margin: 0;
  background: #f6eee3;
  border-radius: 14px;
  overflow: hidden;
}
.photos img { width: 100%; height: 220px; object-fit: cover; }
.photos figcaption { padding: 8px 10px 12px; color: var(--ink-soft); font-size: 0.88rem; }

.form { display: grid; gap: 14px; padding: 28px; }
label { display: grid; gap: 6px; font-weight: 550; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], textarea, select {
  width: 100%;
  border: 1px solid var(--rule);
  background: #fffdf9;
  border-radius: 12px;
  padding: 11px 12px;
  color: var(--ink);
}
textarea { min-height: 280px; resize: vertical; }
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.hint, .status, .error {
  margin: 0;
  color: var(--ink-soft);
}
.error { color: #9a2d1f; }

.page-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(460px, 100%);
  padding: 36px 32px;
}
.login-card h1 {
  font-family: Fraunces, Georgia, serif;
  font-size: 2.2rem;
  margin: 6px 0 8px;
}
.eyebrow {
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin: 0;
}

.site-footer {
  padding: 8px 0 36px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

@media (max-width: 700px) {
  .site-header, .toolbar { flex-direction: column; align-items: flex-start; }
  .who { justify-content: flex-start; }
  .row { grid-template-columns: 1fr; }
  textarea { min-height: 220px; }
  .post-body.is-html .alignleft,
  .post-body.is-html .alignright {
    float: none;
    max-width: 100%;
    margin: 14px auto;
  }
}

.photo-editor h3 {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-weight: 650;
}
.photo-add { display: flex; align-items: center; gap: 10px; }
.photo-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}
.photo-card {
  width: 140px;
  position: relative;
  background: #f6eee3;
  border: 1px solid var(--rule);
  border-radius: 14px;
  overflow: hidden;
  cursor: grab;
  box-shadow: 0 8px 18px rgba(73, 48, 28, 0.06);
}
.photo-card:active { cursor: grabbing; }
.photo-card.dragging { opacity: 0.45; }
.photo-card.drag-over { outline: 2px solid var(--terracotta); }
.photo-card img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  background: #efe2cf;
}
.photo-filename {
  margin: 6px 8px 4px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.photo-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: var(--terracotta);
  color: #fffaf2;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(73, 48, 28, 0.18);
}
.photo-remove:hover { background: var(--terracotta-deep); }
.photo-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 6px 8px;
}
.btn-mini {
  border: 1px solid var(--rule);
  background: #fffdf9;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.72rem;
  cursor: pointer;
  color: var(--ink-soft);
}
.btn-mini:hover:not([disabled]) { background: #f7efe4; }
.btn-mini[disabled] { opacity: 0.4; cursor: default; }
