/* Base styles */
* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.8; /* Increased for better readability */
  color: #332e28; /* Warm dark gray text */
  background-color: #f9f6f0; /* Soft parchment background */
  margin: 0;
  padding: 0;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Header and footer */
.site-header {
  border-bottom: 1px solid #ddd6c9;
  padding: 1rem 0;
  margin-bottom: 2rem;
}

/* Logo + site name: the name is sized to run most of the way across the header. */
.site-brand {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2.5vw, 1.25rem);
  text-decoration: none;
  color: #723f1c; /* Logo brown */
}
.site-logo {
  width: clamp(56px, 12vw, 88px);
  height: auto;
  flex-shrink: 0;
}
.site-title {
  font-family: 'Cinzel', Georgia, 'Times New Roman', serif;
  font-weight: 600;
  font-size: clamp(1rem, 6vw, 2.9rem);
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-transform: uppercase;
}
@media (max-width: 600px) {
  .site-title { letter-spacing: 0.04em; }
}

.site-header nav ul {
  display: flex;
  flex-wrap: wrap;
  row-gap: 0.25rem;
  list-style: none;
  padding: 0;
  margin: 1rem 0 0 0;
}

.site-header nav li {
  margin-right: 1.5rem;
}

.site-header nav a {
  text-decoration: none;
  white-space: nowrap;
  color: #332e28; /* Warm dark gray text */
}

.site-header nav a:hover {
  text-decoration: underline;
}

.site-footer {
  border-top: 1px solid #ddd6c9;
  padding: 2rem 0;
  margin-top: 3rem;
  text-align: center;
  font-size: 0.9rem;
  color: #7d7466; /* Muted gray */
}

/* Content */
.essay-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid #ddd6c9;
  padding-bottom: 1rem;
}

h1 {
  margin-bottom: 0.5rem;
  font-weight: 700; /* Slightly bolder for better hierarchy */
  font-size: 1.8rem; /* Larger for better visual distinction */
}

h2 {
  margin-top: 2rem;
  font-weight: 600; /* Slightly lighter than h1 */
  color: #4a4339; /* Slightly darker for visual distinction */
  font-size: 1.5rem; /* Larger for better visual distinction */
}

h3 {
  margin-top: 1.5rem;
  font-weight: 600;
  color: #4a4339;
  font-size: 1.25rem; /* Slightly larger than body text */
}

.subtitle {
  font-size: 1.2rem;
  font-style: italic;
  color: #7d7466; /* Muted gray */
  margin-top: 0.25rem;
}

.essay-meta {
  color: #7d7466; /* Muted gray */
  font-size: 0.9rem;
  margin: 0.5rem 0;
}

.tags {
  display: inline-block;
  margin-left: 1rem;
}

.tags a {
  background-color: #e8e2d6; /* Muted parchment */
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.8rem;
  margin-right: 0.5rem;
  color: #332e28; /* Warm dark gray for link text */
}

.tags a:hover {
  background-color: #d8d2c6;
}

/* Link styling with accent color */
a {
  color: #8b4513; /* Muted bronze accent color - fits classical theme better */
  text-decoration: none;
}

a:hover {
  color: #654321; /* Darker bronze on hover */
  text-decoration: underline;
}

.essay-content {
  margin: 2rem 0;
  font-size: 1.05rem; /* Slightly larger for better readability */
  line-height: 1.8; /* Increased for better readability */
}

.essay-content h2 {
  margin-top: 2rem;
}

.related-essays h3 {
  margin-bottom: 1rem;
}

.related-essays ul {
  padding-left: 1.5rem;
}

/* Lists */
.essay-list, .tag-list {
  list-style: none;
  padding: 0;
}

.essay-list li, .tag-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid #ddd6c9;
}

.essay-list li:last-child, .tag-list li:last-child {
  border-bottom: none;
}

/* Responsive */
@media (max-width: 600px) {
  .site-header nav ul {
    flex-direction: column;
  }
  
  .site-header nav li {
    margin-right: 0;
    margin-bottom: 0.5rem;
  }
  
  .container {
    padding: 1rem;
  }
}

/* Dropdown menus: hidden until the tab is clicked/tapped (js/main.js
   toggles .open). Selectors are scoped under .site-header nav so they
   outrank the general ".site-header nav ul { display: flex }" rule above,
   which is what kept every dropdown stuck open. */
.site-header nav .dropdown {
  position: relative;
}

.site-header nav .dropdown-toggle {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: #332e28;
  cursor: pointer;
}

.site-header nav .dropdown-toggle::after {
  content: " \25BE";
  font-size: 0.8em;
}

.site-header nav .dropdown-toggle:hover {
  text-decoration: underline;
}

/* Split tab: the label goes to the page, the small arrow opens the menu. */
.site-header nav .dropdown-arrow {
  padding: 0 0.2rem;
  margin-left: 0.1rem;
}

.site-header nav .dropdown-arrow::after {
  content: "\25BE";
}

/* Home page "Latest Posts" call to action. */
.button-link {
  display: inline-block;
  padding: 0.55rem 1.4rem;
  background: #9a7b4f;
  color: #f9f6f0;
  border-radius: 5px;
  font-weight: bold;
  text-decoration: none;
}

.button-link:hover {
  background: #7d6340;
  text-decoration: none;
}

.site-header nav .dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  flex-direction: column;
  margin: 0.25rem 0 0 0;
  padding: 0.25rem 0;
  min-width: 170px;
  background-color: #f9f6f0;
  border: 1px solid #ddd6c9;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
  z-index: 10;
}

.site-header nav .dropdown.open .dropdown-content {
  display: flex;
}

.site-header nav .dropdown-content li {
  margin: 0;
}

.site-header nav .dropdown-content a {
  display: block;
  padding: 0.4rem 1rem;
  white-space: nowrap;
}

.site-header nav .dropdown-content a:hover {
  background-color: #ddd6c9;
  text-decoration: none;
}

@media (max-width: 600px) {
  .site-header nav .dropdown-content {
    position: static;
    box-shadow: none;
    border: none;
    border-left: 2px solid #ddd6c9;
    margin-left: 0.75rem;
  }
}

/* Placeholder blocks: fill-in-the-blank text for the site owner to replace.
   Dashed outline + label so unfinished spots are easy to find. */
.placeholder {
  border: 2px dashed #c9b99a;
  background-color: #fdfbf6;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  color: #6b6155;
}

.placeholder-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9a7b4f;
}

.placeholder h3 {
  margin: 0.25rem 0;
  color: #332e28;
}

.placeholder p {
  margin: 0.25rem 0 0 0;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1rem 0 2rem 0;
}

.template-grid .placeholder {
  margin: 0;
}

.card-link {
  text-decoration: none;
  color: inherit;
}

.card {
  border: 1px solid #ddd6c9;
  border-radius: 6px;
  padding: 1rem;
  height: 100%;
}

.card-link:hover .card {
  background-color: #f1ebe0;
}

.section-kicker {
  margin-top: -0.5rem;
  color: #9a7b4f;
  font-size: 0.9rem;
}

.empty-note,
.byline {
  color: #6b6155;
  font-style: italic;
}

/* Cover photo: full width for wide photos, but never taller than 420px; tall/portrait
   photos are shown whole (not cropped) and centered. */
.cover-image {
  display: block;
  max-width: 100%;
  max-height: 420px;
  width: auto;
  height: auto;
  margin: 1rem auto;
  border-radius: 6px;
}

/* News: each post as a row, with its cover photo on the left when it has one. */
.news-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.news-cover {
  width: 140px;
  height: 95px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.news-title {
  font-weight: bold;
  font-size: 1.1rem;
}

.news-subtitle,
.news-meta {
  margin: 0.15rem 0 0 0;
}

.news-meta {
  font-size: 0.9rem;
}

@media (max-width: 600px) {
  .news-item {
    flex-direction: column;
  }

  .news-cover {
    width: 100%;
    height: 180px;
  }
}

/* Writer pages */
.writer-photo {
  max-width: 220px;
  border-radius: 6px;
  margin: 0.5rem 0 1rem 0;
}

.writer-intro {
  margin-bottom: 2rem;
}

/* Contact and comment forms */
.comment-form {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #ddd6c9;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: bold;
  margin-bottom: 0.25rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: inherit;
  background-color: #fdfbf6;
  border: 1px solid #c9b99a;
  border-radius: 4px;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: 2px solid #9a7b4f;
  outline-offset: 1px;
}

form button[type="submit"] {
  padding: 0.5rem 1.5rem;
  font: inherit;
  font-weight: bold;
  color: #f9f6f0;
  background-color: #9a7b4f;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

form button[type="submit"]:hover {
  background-color: #7d6340;
}

.comment-notice {
  font-size: 0.9rem;
  color: #6b6155;
}

/* Approved reader comments */
.approved-comments {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #ddd6c9;
}

.approved-comment {
  background-color: #fdfbf6;
  border-left: 3px solid #c9b99a;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
}

.approved-comment p {
  margin: 0.25rem 0;
  white-space: pre-line;
}

.approved-comment-meta {
  font-size: 0.9rem;
  color: #6b6155;
}

.approved-comments + .comment-form {
  margin-top: 1.5rem;
}

.comment-sent {
  color: #4f6b3a;
  font-weight: bold;
}

/* Comment moderation page (/admin/comments/) */
.moderation .moderation-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.moderation .btn-delete {
  background-color: #8a3b2e;
}

.moderation .btn-delete:hover {
  background-color: #6e2e24;
}

.moderation button {
  padding: 0.4rem 1rem;
  font: inherit;
  font-weight: bold;
  color: #f9f6f0;
  background-color: #9a7b4f;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.moderation button:disabled {
  opacity: 0.5;
  cursor: default;
}


/* ---- Writer avatars (social-media style) and topic chips ---- */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  border: 1px solid #ddd6c9;
}

.avatar-sm {
  width: 22px;
  height: 22px;
  vertical-align: middle;
  margin-right: 0.35rem;
}

.avatar-lg {
  width: 96px;
  height: 96px;
}

.avatar-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ddd6c9;
  color: #6b5a42;
  font-weight: bold;
  font-size: 1.1rem;
}

.avatar-sm.avatar-initial {
  font-size: 0.7rem;
}

.post-author {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.4rem 0 0.2rem;
  color: inherit;
  text-decoration: none;
  font-weight: bold;
}

.post-author:hover .post-author-name {
  text-decoration: underline;
}

.byline-author {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.byline-author:hover {
  text-decoration: underline;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-bottom: 1rem;
}

.profile-header h1 {
  margin: 0;
}

.topic-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 2rem;
}

.topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.85rem;
  border: 1px solid #c9b99a;
  border-radius: 999px;
  color: #332e28;
  text-decoration: none;
  font-size: 0.95rem;
}

.topic-chip:hover {
  background: #ddd6c9;
  text-decoration: none;
}

.topic-chip .count {
  font-size: 0.8rem;
  background: #ece5d8;
  border-radius: 999px;
  padding: 0 0.45rem;
}

.topic-chip.empty {
  opacity: 0.55;
}

.post-author + .essay-meta {
  margin-top: 0.15rem;
}
