/* ============================================================
   有机教会 — Scriptorium Article Theme
   Shared stylesheet for all organicchurch/posts/*.html
   Matches the homepage Scriptorium design direction.
   ============================================================ */

:root {
  --bg:           #FAF6EC;
  --bg-grain:     #F3ECDB;
  --surface:      #F4EEDF;
  --surface-2:    #EFE7D4;
  --text:         #241B11;
  --muted:        #6A5C49;
  --faint:        #94866F;
  --accent:       #8A3517;
  --accent-ink:   #732A11;
  --accent2:      #4A6741;
  --border:       #E2D8C3;
  --rule:         #D9CDB4;
  --quote-bg:     #F1E8D3;
  --mark:         rgba(138,53,23,0.10);
  --shadow:       rgba(48,33,16,0.13);
  --shadow-card:  rgba(48,33,16,0.10);
  --shadow-deep:  rgba(48,33,16,0.22);

  --font-body:  'Noto Serif SC', 'Songti SC', 'Source Han Serif SC', Georgia, serif;
  --font-ui:    'Noto Sans SC', 'PingFang SC', system-ui, sans-serif;
  --font-latin: 'EB Garamond', 'Noto Serif SC', Georgia, serif;

  --measure: 720px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.85;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-image:
    radial-gradient(circle at 18% 12%, var(--bg-grain) 0, transparent 42%),
    radial-gradient(circle at 82% 78%, var(--bg-grain) 0, transparent 46%);
  background-attachment: fixed;
}

::selection { background: var(--mark); color: var(--accent-ink); }

a { color: inherit; text-decoration: none; }
ul { list-style: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ===== Reading progress bar (olive→oxblood, like book reader) ===== */
.progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  z-index: 9999;
  transition: width 0.12s linear;
}

/* ===== Site Nav — matches homepage ===== */
.site-nav {
  position: sticky;
  top: 0;
  height: 52px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px) saturate(1.1);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  z-index: 500;
  padding: 0 20px;
}
.site-nav .nav-link {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
  position: relative;
  letter-spacing: 0.02em;
}
.site-nav .nav-link:hover { color: var(--accent); }
.site-nav .nav-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: -5px;
  width: 0; height: 1.5px;
  background: var(--accent);
  transition: width 0.25s ease;
}
.site-nav .nav-link:hover::after { width: 100%; }
.site-nav .nav-link.active {
  color: var(--accent);
  font-weight: 600;
}
.site-nav .nav-link.active::after {
  width: 100%;
}

/* ===== Article Layout ===== */
.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

.article-container {
  padding: 64px 0 96px;
}

.article-header {
  margin-bottom: 48px;
}

.article-eyebrow {
  font-family: var(--font-latin);
  font-size: 12px;
  font-style: italic;
  color: var(--accent2);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px;
}
.article-eyebrow::before {
  content: "";
  width: 24px; height: 1px;
  background: var(--accent2);
}

.post-title {
  font-family: var(--font-body);
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 24px;
  letter-spacing: 0.01em;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--faint);
  margin-bottom: 8px;
}

.author-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.author-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-latin);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.post-meta time {
  font-family: var(--font-latin);
  font-size: 14px;
  font-style: italic;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.post-meta .meta-sep,
.post-meta > div:not(.author-info):not(.category-tags) {
  color: var(--rule);
  font-size: 12px;
}

.category-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.category-tag {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.featured-image-container {
  width: 100%;
  margin-bottom: 48px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 14px 40px -18px var(--shadow-deep);
}
.featured-image {
  width: 100%;
  height: auto;
  max-height: 460px;
  object-fit: cover;
  display: block;
}

/* ===== Article Content — Scriptorium reading ===== */
.article-content {
  font-family: var(--font-body);
  font-size: 17px;
  color: var(--text);
  line-height: 1.9;
  letter-spacing: 0.01em;
}

.article-content > p:first-of-type::first-letter {
  font-family: var(--font-latin);
  font-weight: 600;
  font-size: 3.6em;
  float: left;
  line-height: 0.86;
  padding: 6px 10px 0 0;
  color: var(--accent);
}

.article-content p {
  margin-bottom: 28px;
}

.article-content h2 {
  font-family: var(--font-body);
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  margin: 48px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

.article-content h3 {
  font-family: var(--font-body);
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin: 36px 0 12px;
}

.article-content h4 {
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin: 28px 0 10px;
}

.article-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s;
}
.article-content a:hover {
  text-decoration-color: var(--accent);
}

.article-content blockquote {
  margin: 36px 0;
  padding: 20px 28px;
  background: var(--quote-bg);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  font-style: italic;
  color: var(--text);
  position: relative;
}
.article-content blockquote p {
  margin-bottom: 0;
}
.article-content blockquote p + p { margin-top: 14px; }

.article-content ul, .article-content ol {
  margin-bottom: 28px;
  padding-left: 28px;
}
.article-content li {
  margin-bottom: 10px;
  line-height: 1.8;
}
.article-content ul li::marker { color: var(--accent2); }
.article-content ol li::marker {
  font-family: var(--font-latin);
  font-style: italic;
  color: var(--accent);
}

.article-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 36px auto;
  border-radius: 4px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px -12px var(--shadow-card);
}

.article-content strong { color: var(--text); font-weight: 600; }
.article-content em { font-style: italic; }

.article-content code {
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 0.9em;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--accent-ink);
}

.article-content pre {
  margin: 28px 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.6;
}
.article-content pre code {
  background: transparent;
  padding: 0;
}

.article-content table {
  width: 100%;
  margin: 28px 0;
  border-collapse: collapse;
  font-size: 15px;
}
.article-content th, .article-content td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  text-align: left;
}
.article-content th {
  background: var(--surface);
  font-weight: 600;
}

/* WP block elements */
.article-content .wp-block-media-text {
  display: grid;
  gap: 20px;
  margin: 32px 0;
}

/* Responsive media — force max width */
.article-content img,
.article-content video,
.article-content audio,
.article-content iframe {
  max-width: 100% !important;
  height: auto !important;
  display: block;
  margin: 24px auto;
}
.article-content audio { width: 100%; }

/* ===== Back to Journal ===== */
.back-to-blog {
  margin-top: 72px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 1px solid transparent;
}

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

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-ink); }

/* ===== Footer ===== */
.footer {
  border-top: 1px solid var(--rule);
  padding: 40px 0;
  background: var(--bg);
  text-align: center;
}
.footer p {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--faint);
}
.footer .soli {
  font-family: var(--font-latin);
  font-style: italic;
  color: var(--accent);
}

/* ===== Responsive ===== */

@media (max-width: 768px) {
  .post-title { font-size: 24px; }
  .article-container { padding: 36px 0 64px; }
  .article-content { font-size: 16px; }
  .article-content > p:first-of-type::first-letter { font-size: 3em; }
  .wp-block-media-text {
    display: flex !important;
    flex-direction: column !important;
  }
  .wp-block-media-text__media,
  .wp-block-media-text__content {
    width: 100% !important;
  }
  .container { padding: 0 16px; }
  .back-to-blog { flex-direction: column; align-items: flex-start; }
}

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