:root {
  color-scheme: light dark;
  --bg: #f7f5f2;
  --fg: #22201d;
  --muted: #6b6560;
  --accent: #a6603a;
  --card-bg: #ffffff;
  --border: #e4ddd4;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1a18;
    --fg: #ece7e1;
    --muted: #a49c92;
    --accent: #d68a5e;
    --card-bg: #262320;
    --border: #3a352f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Georgia, 'Times New Roman', serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.site-header .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: bold;
  font-size: 1.25rem;
  color: var(--fg);
  text-decoration: none;
}

.nav-logo {
  height: 32px;
  width: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: #ffffff;
  display: block;
}

.site-header nav a {
  margin-left: 1rem;
  color: var(--muted);
  text-decoration: none;
}

.site-header nav a:hover { color: var(--accent); }

.admin-strip {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1.5rem;
  background: var(--accent);
}

.admin-strip .button {
  background: var(--fg);
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
}

.admin-strip a,
.admin-strip .link-button {
  color: #fff;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem;
}

.container.with-sidebar {
  max-width: 1040px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  align-items: start;
}

.about-sidebar {
  position: sticky;
  top: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}

.about-sidebar h1 {
  font-size: 1.25rem;
  margin-top: 0;
}

.about-sidebar .entry-body {
  font-size: 0.9rem;
}

@media (max-width: 900px) {
  .container.with-sidebar {
    display: block;
    max-width: 720px;
  }

  .about-sidebar {
    display: none;
  }
}

.entry-card, .entry-detail {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.draft-banner {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.75rem;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.entry-type {
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.entry-author {
  font-weight: 600;
  color: var(--fg);
}

.entry-body {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.about-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1.5rem 0;
}

.about-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.about-links a:hover {
  text-decoration: underline;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.photo-grid img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
}

/* Feed and entry-detail views: every photo is exactly the post's width,
   stacked one after another (not tiled into columns) — a single photo
   fills the post, and each additional photo does the same underneath it,
   sized by its own aspect ratio (no cropping, no height cap). */
.photo-grid.entry-photos {
  grid-template-columns: 1fr;
}

.gallery-grid figure { margin: 0; }
.gallery-grid figcaption {
  font-size: 0.8rem;
  color: var(--muted);
}

.read-more, .back-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.pager {
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
}

.pager a {
  color: var(--accent);
  text-decoration: none;
}

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

.admin-form label {
  display: block;
  margin-bottom: 1rem;
}

.admin-form input[type="text"],
.admin-form input[type="password"],
.admin-form textarea,
.admin-form select {
  width: 100%;
  padding: 0.5rem;
  margin-top: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card-bg);
  color: var(--fg);
  font-family: inherit;
}

.admin-form .checkbox { display: flex; align-items: center; gap: 0.5rem; }
.admin-form .checkbox input { width: auto; }

button, .button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-size: 0.95rem;
}

.link-button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  font-size: 0.9rem;
}

.link-button.danger { color: #b23b3b; }

.inline-form { display: inline; }

.admin-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th, .admin-table td {
  text-align: left;
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.row-actions a, .row-actions button {
  margin-right: 0.5rem;
}

.error, .error-list { color: #b23b3b; }
.error-page { text-align: center; padding: 3rem 1rem; }

.hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
}

.reactions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0;
}

.reaction {
  background: var(--card-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.reaction span { font-size: 0.85rem; color: var(--muted); }

.reaction.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.reaction.active span { color: #fff; }

.comments { margin-top: 2rem; }

.comment-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.comment-pending { border-style: dashed; }

.comment-author { font-weight: 600; margin: 0 0 0.25rem; }

.comment-body { white-space: pre-wrap; word-wrap: break-word; margin: 0; }

.comment-form { margin-top: 1rem; }

.notice {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  color: var(--muted);
}

.badge {
  background: #fff;
  color: var(--accent);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 700;
  margin-left: 0.25rem;
}
