@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Autumnal (default) — overridden inline per-request based on the admin's chosen theme */
  --pine: #3E2723;
  --pine-light: #5D4037;
  --heading: #3E2723;
  --russet: #C1440E;
  --russet-dark: #9C3610;
  --moss: #C08A28;
  --parchment: #FBF0E1;
  --parchment-dark: #F0DFC4;
  --surface: #FBF8F0;
  --ink: #3A2B22;
  --ink-soft: #6B5646;
  --trail: #A67C52;
  --header-text: #FBF0E1;
  --error-bg: #FBE6DD;
  --error-border: #C1440E;
  --error-text: #9C3610;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--parchment);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

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

h1, h2, h3 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  color: var(--heading);
  margin: 0 0 0.4em;
}

.wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 20px 60px;
}
.wrap-wide { max-width: 1040px; }

/* Homepage layout with photo sidebar */
.home-layout { display: flex; gap: 28px; align-items: flex-start; }
.home-main { flex: 1; min-width: 0; }
.home-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--parchment-dark);
  border-radius: 4px;
  padding: 16px;
}
.photo-banner {
  display: block;
  margin-bottom: 12px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--parchment-dark);
}
.photo-banner img { width: 100%; height: 120px; object-fit: cover; display: block; }
.photo-banner-caption {
  font-size: 0.78rem;
  color: var(--ink-soft);
  padding: 6px 8px;
  background: var(--parchment);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Header */
header.site {
  /* Fixed to match the logo's navy background so it blends regardless of the active site theme */
  background: #142238;
  border-bottom: 4px solid #2A4870;
}
header.site .inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
header.site .brand {
  display: flex;
  align-items: center;
}
header.site .brand-logo { height: 84px; width: auto; display: block; }
header.site nav a {
  color: var(--header-text);
  margin-left: 16px;
  font-size: 0.92rem;
  font-weight: 500;
}
header.site nav a:hover { text-decoration: underline; }
header.site nav span.who {
  color: var(--header-text);
  font-size: 0.88rem;
  margin-left: 16px;
}

/* Stamp / log aesthetic */
.stamp {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.field-note {
  border: 1px solid var(--trail);
  border-left: 4px solid var(--russet);
  background: var(--surface);
  border-radius: 3px;
  padding: 16px 18px;
  margin: 18px 0;
}

.rank-badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--moss);
  color: #fff;
  padding: 2px 7px;
  border-radius: 2px;
  vertical-align: middle;
}

/* Category cards */
.category-list { margin-top: 24px; }
.category-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--parchment-dark);
  border-left: 5px solid var(--pine);
  border-radius: 4px;
  padding: 16px 20px;
  margin-bottom: 14px;
  transition: border-color 0.15s, transform 0.1s;
}
.category-card:hover {
  border-left-color: var(--russet);
  text-decoration: none;
  transform: translateX(2px);
}
.category-card h3 { margin-bottom: 4px; font-size: 1.15rem; }
.category-card p { margin: 0; color: var(--ink-soft); font-size: 0.92rem; }
.category-card .meta { margin-top: 8px; font-size: 0.78rem; color: var(--trail); }

/* Thread list */
.thread-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--parchment-dark);
}
.thread-row .title { font-weight: 600; color: var(--ink); }
.thread-row .title:hover { color: var(--russet-dark); }
.thread-row .pin { color: var(--russet); font-size: 0.8rem; margin-right: 5px; }
.thread-row .sub { font-size: 0.82rem; color: var(--ink-soft); margin-top: 2px; }
.thread-row .count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--trail);
  white-space: nowrap;
}

/* Posts */
.post {
  display: flex;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--parchment-dark);
}
.post .author-col {
  width: 130px;
  flex-shrink: 0;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}
.post .author-col .name { font-weight: 600; color: var(--heading); }
.post .body-col { flex: 1; min-width: 0; }
.post .body-col .meta { font-size: 0.76rem; color: var(--trail); margin-bottom: 6px; }
.post .body-col .text { white-space: pre-wrap; word-wrap: break-word; }
.post .body-col .photo { max-width: 100%; border-radius: 4px; margin-top: 10px; display: block; border: 1px solid var(--parchment-dark); }

input[type=file] {
  display: block;
  width: 100%;
  padding: 8px 0;
  font-size: 0.88rem;
}
.photo-preview { margin-top: 8px; }
.photo-preview img { max-width: 160px; max-height: 160px; border-radius: 4px; border: 1px solid var(--trail); display: block; }

/* Hero / homepage */
.hero { text-align: center; padding: 22px 10px 6px; }
.hero h1 { font-size: 2rem; }
.hero-mission { max-width: 560px; margin: 12px auto 0; color: var(--ink-soft); }
.cta-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }

/* Media library */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-top: 20px; }
.media-card { background: var(--surface); border: 1px solid var(--parchment-dark); border-radius: 4px; overflow: hidden; }
.media-card img { width: 100%; height: 120px; object-fit: cover; display: block; }
.media-card video { width: 100%; height: 160px; display: block; background: #000; }
.media-file-icon {
  height: 120px; display: flex; align-items: center; justify-content: center;
  background: var(--parchment-dark); font-size: 0.78rem; padding: 8px; text-align: center; word-break: break-word;
}
.media-meta { padding: 10px; font-size: 0.85rem; }
.media-meta .sub { color: var(--trail); font-size: 0.75rem; margin-top: 2px; }

/* Avatars */
.avatar { border-radius: 50%; object-fit: cover; display: inline-block; vertical-align: middle; flex-shrink: 0; }
.avatar-placeholder {
  background: var(--moss); color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-family: 'Space Grotesk', sans-serif;
}

/* Forms */
label { display: block; font-weight: 600; margin: 14px 0 5px; font-size: 0.9rem; }
input[type=text], input[type=password], textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--trail);
  border-radius: 3px;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--surface); color: var(--ink);
}
textarea { min-height: 130px; resize: vertical; }
input:focus, textarea:focus {
  outline: 2px solid var(--moss);
  outline-offset: 1px;
}

button, .btn {
  display: inline-block;
  background: var(--russet);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 3px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  font-family: inherit;
}
button:hover, .btn:hover { background: var(--russet-dark); text-decoration: none; }
.btn.secondary { background: var(--pine); }
.btn.secondary:hover { background: var(--pine-light); }

.error-box {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
  padding: 10px 14px;
  border-radius: 3px;
  margin: 14px 0;
  font-size: 0.9rem;
}
.notice-box {
  background: var(--surface);
  border: 1px solid var(--moss);
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 3px;
  margin: 14px 0;
  font-size: 0.9rem;
}
.unread-badge {
  display: inline-block;
  background: var(--russet);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  vertical-align: middle;
}

.breadcrumb {
  font-size: 0.85rem;
  color: var(--trail);
  margin: 20px 0 4px;
}
.breadcrumb a { color: var(--trail); }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

footer.site {
  text-align: center;
  padding: 30px 20px;
  font-size: 0.78rem;
  color: var(--trail);
}

@media (max-width: 560px) {
  .post { flex-direction: column; gap: 6px; }
  .post .author-col { width: auto; display: flex; align-items: center; gap: 8px; }
  header.site .brand-logo { height: 56px; }
}

@media (max-width: 860px) {
  .home-layout { flex-direction: column; }
  .home-sidebar { width: 100%; }
  .photo-banner { display: inline-block; width: calc(50% - 6px); margin-right: 6px; vertical-align: top; }
}
