/* ==========================================================================
   ARMENAG — Armenian Manuscript Theme for Ghost
   Scriptorium precision. Parchment ground. Orthodox clarity.
   ========================================================================== */

:root {
  --parchment: #f4efe6;
  --ink: #211b16;
  --ink-light: #4f4439;
  --ink-muted: #7b6e61;
  --vermillion: #92281d;
  --vermillion-deep: #6f1e16;
  --gold: #b58c35;
  --gold-muted: rgba(181, 140, 53, 0.18);
  --gold-faint: rgba(181, 140, 53, 0.05);
  --lapis: #1a3a5c;
  --body-font: 'EB Garamond', Georgia, serif;
  --heading-font: 'Cormorant Garamond', Georgia, serif;
  --mono-font: 'JetBrains Mono', monospace;
  --content-width: 740px;
  --wide-width: 1100px;
  --post-anchor-offset: 108px;
  --post-toc-top: 92px;
  --post-toc-indent-step: 14px;
}

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

html {
  font-size: 18px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--parchment);
  background-image:
    radial-gradient(42% 34% at 12% 14%, rgba(181, 140, 53, 0.08), transparent 72%),
    radial-gradient(34% 30% at 84% 16%, rgba(181, 140, 53, 0.065), transparent 74%),
    radial-gradient(46% 38% at 52% 48%, rgba(181, 140, 53, 0.055), transparent 76%),
    radial-gradient(38% 34% at 18% 82%, rgba(181, 140, 53, 0.05), transparent 74%),
    radial-gradient(34% 32% at 86% 76%, rgba(181, 140, 53, 0.06), transparent 74%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--body-font);
  line-height: 1.72;
}

.site-main {
  position: relative;
  z-index: 1;
}

a { color: var(--lapis); text-decoration: none; }
a:hover { color: var(--vermillion); }
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 1px solid rgba(146, 40, 29, 0.35);
  outline-offset: 3px;
}
img { max-width: 100%; height: auto; }

/* ==========================================================================
   Progress Bar
   ========================================================================== */

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--vermillion);
  z-index: 9999;
  width: 0%;
  pointer-events: none;
}

/* ==========================================================================
   Navigation
   ========================================================================== */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--gold-muted);
  background: rgba(244, 239, 230, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.site-nav-inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-nav-logo {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.site-nav-logo img { height: 24px; width: auto; }

.site-nav-title {
  font-family: var(--heading-font);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
}

.site-nav-links {
  flex: 1;
  min-width: 0;
}

.site-nav-list {
  list-style: none;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  margin: 0;
  padding: 0;
}

.site-nav-item {
  list-style: none;
}

.site-nav-link {
  font-family: var(--heading-font);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  transition: color 0.2s;
  position: relative;
}

.site-nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--vermillion);
  transition: width 0.25s ease;
}

.site-nav-link:hover,
.site-nav-item.is-current .site-nav-link {
  color: var(--vermillion);
}

.site-nav-link:hover::after,
.site-nav-item.is-current .site-nav-link::after {
  width: 100%;
}

.site-nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.nav-subscribe {
  font-family: var(--heading-font);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--vermillion);
  border: 1px solid var(--vermillion);
  padding: 6px 14px;
  transition: background 0.2s, color 0.2s;
}

.nav-subscribe:hover {
  background: var(--vermillion);
  color: var(--parchment);
}

/* ==========================================================================
   Site Header (homepage, author, tag)
   ========================================================================== */

.site-header {
  text-align: center;
  padding: 48px 28px 0;
  position: relative;
  z-index: 1;
}

.site-header-inner {
  max-width: 860px;
  margin: 0 auto;
}

.site-header-mark {
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  color: var(--gold);
  opacity: 0.55;
}

.site-header-mark .sacred-mark { width: 100%; height: 100%; display: block; }

.site-header-logo { max-height: 36px; margin: 0 auto 14px; display: block; }

.site-header-title {
  font-family: var(--heading-font);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1;
  color: var(--ink);
  margin-bottom: 10px;
}

.site-header-desc {
  font-family: var(--body-font);
  font-size: 0.95rem;
  font-style: italic;
  color: var(--ink-muted);
  line-height: 1.55;
  max-width: 28rem;
  margin: 0 auto 16px;
}

.site-header-rule {
  width: 120px;
  height: 1px;
  background: var(--gold);
  margin: 0 auto;
}

.author-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--gold-muted);
  margin: 0 auto 12px;
}

/* ==========================================================================
   Manuscript TOC (homepage)
   ========================================================================== */

.manuscript-toc {
  max-width: 740px;
  margin: 0 auto;
  padding: 32px 36px 48px;
  position: relative;
  z-index: 1;
  border: 1px solid rgba(181, 140, 53, 0.22);
}

.manuscript-toc-label {
  text-align: center;
  font-family: var(--heading-font);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 20px;
}

.toc-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid rgba(181, 140, 53, 0.1);
  text-decoration: none;
}

.toc-entry:last-child { border-bottom: none; }

.toc-entry:hover .toc-entry-title {
  color: var(--vermillion);
}

.toc-entry-body {
  min-width: 0;
}

.toc-entry-title {
  font-family: var(--heading-font);
  font-size: clamp(1.1rem, 1.6vw, 1.28rem);
  font-weight: 500;
  color: var(--ink);
  display: block;
  line-height: 1.2;
  transition: color 0.2s;
}

.toc-entry-excerpt {
  display: block;
  font-size: 0.88rem;
  color: var(--ink-muted);
  font-style: normal;
  line-height: 1.5;
  margin-top: 3px;
  max-width: 36rem;
}

.toc-entry-meta {
  font-family: var(--heading-font);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  white-space: nowrap;
  text-align: right;
  padding-top: 2px;
}

.toc-entry-tag {
  display: inline-block;
  font-size: 0.52rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--vermillion);
  margin-right: 4px;
}

.toc-entry-tag::after {
  content: '\00b7';
  margin-left: 4px;
  color: var(--gold);
}

.toc-entry-tag:last-of-type::after {
  content: none;
}

/* ==========================================================================
   Card Feed (fallback homepage)
   ========================================================================== */

.post-feed {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 28px 24px;
}

.post-card { border-bottom: 1px solid var(--gold-muted); }
.post-card:last-child { border-bottom: none; }

.post-card-link {
  display: flex;
  gap: 20px;
  padding: 20px 0;
  text-decoration: none;
  align-items: flex-start;
  transition: opacity 0.2s;
}

.post-card-link:hover { opacity: 0.85; }

.post-card-image {
  width: 120px;
  height: 88px;
  flex-shrink: 0;
  background-color: var(--gold-faint);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--gold-muted);
}

.post-card-content { flex: 1; min-width: 0; }

.post-card-tag {
  font-family: var(--heading-font);
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--vermillion);
  display: block;
  margin-bottom: 2px;
}

.post-card-title {
  font-family: var(--heading-font);
  font-size: 1.12rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 3px;
}

.post-card-excerpt {
  font-size: 0.88rem;
  color: var(--ink-light);
  line-height: 1.55;
  margin-bottom: 4px;
}

.post-card-meta {
  font-family: var(--heading-font);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  display: flex;
  gap: 10px;
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 20px 24px;
  text-align: center;
  display: flex;
  justify-content: center;
  gap: 24px;
}

.pagination-link {
  font-family: var(--heading-font);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--vermillion);
}

/* ==========================================================================
   Post Header
   ========================================================================== */

.post-header {
  text-align: left;
  padding: 36px 28px 20px;
  position: relative;
  z-index: 1;
}

.post-header-inner {
  max-width: 760px;
  margin: 0 auto;
}

.post-header-tag {
  font-family: var(--heading-font);
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--vermillion);
  display: block;
  margin-bottom: 8px;
}

.post-title {
  font-family: var(--heading-font);
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: 400;
  letter-spacing: 0.015em;
  color: var(--ink);
  line-height: 1.05;
  margin-bottom: 12px;
}

.post-excerpt {
  font-size: 1.02rem;
  font-style: normal;
  color: var(--ink-light);
  line-height: 1.6;
  max-width: 38rem;
  margin-bottom: 14px;
}

.post-header-rule {
  width: 100%;
  margin: 2px 0 10px;
  color: var(--gold);
  opacity: 0.46;
}

.post-header-rule .sacred-mark,
.header-geometry { width: 100%; height: auto; display: block; }

.post-meta {
  font-family: var(--heading-font);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  display: flex;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: wrap;
}

.post-meta-sep { color: var(--gold); }

/* ==========================================================================
   Feature Image
   ========================================================================== */

.post-feature-image {
  max-width: var(--wide-width);
  margin: 0 auto 40px;
  padding: 0 28px;
}

.post-feature-image img {
  width: 100%;
  display: block;
  border: 1px solid var(--gold-muted);
}

.post-feature-image figcaption {
  font-family: var(--heading-font);
  font-size: 0.78rem;
  color: var(--ink-muted);
  text-align: center;
  margin-top: 6px;
  font-style: italic;
}

/* ==========================================================================
   Post Body (with optional TOC sidebar)
   ========================================================================== */

.post-body {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

.post-body.has-toc {
  max-width: 1120px;
  display: grid;
  grid-template-columns: minmax(196px, 244px) minmax(0, var(--content-width));
  gap: clamp(26px, 4vw, 46px);
  align-items: start;
}

.post-body.has-toc .post-content {
  min-width: 0;
  max-width: var(--content-width);
}

/* ==========================================================================
   Post TOC
   ========================================================================== */

.post-toc {
  display: none;
  min-width: 0;
}

.post-body.has-toc .post-toc {
  display: block;
  position: sticky;
  top: var(--post-toc-top);
  align-self: start;
}

.post-toc[hidden] {
  display: none !important;
}

/* ---- Desktop TOC ---- */

.post-toc-desktop {
  min-width: 0;
}

.post-toc-label {
  font-family: var(--heading-font);
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(181, 140, 53, 0.15);
}

.post-toc-rail,
.post-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.post-toc-rail {
  display: grid;
  gap: 0;
  position: relative;
  padding-left: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  background-image: linear-gradient(
    to bottom,
    transparent,
    rgba(181, 140, 53, 0.3) 10px,
    rgba(181, 140, 53, 0.3) calc(100% - 10px),
    transparent
  );
  background-repeat: no-repeat;
  background-size: 1px calc(100% - 12px);
  background-position: 5px 6px;
}

.post-toc-rail::-webkit-scrollbar {
  display: none;
}

/* Spine: continuous vertical gold ruling line */
.post-toc-rail::before {
  content: none;
}

.post-toc-item {
  margin: 0;
}

.post-toc-item-rail {
  position: relative;
  min-height: 0;
}

.post-toc-link {
  display: block;
  text-decoration: none;
  color: var(--ink-muted);
}

.post-toc-marker {
  position: relative;
  padding: 7px 0;
  color: var(--ink-muted);
}

/* Node markers on the spine (repurposed from marker-bar) */
.post-toc-marker-bar {
  position: absolute;
  left: -15px;
  top: 50%;
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--parchment);
  border: 1.5px solid rgba(181, 140, 53, 0.45);
  transform: translate(-50%, -50%);
  transition: background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  opacity: 1;
}

/* Depth-1 nodes: larger, stronger border */
.post-toc-marker[data-depth="1"] .post-toc-marker-bar {
  width: 8px;
  height: 8px;
  border-width: 1.5px;
  border-color: rgba(181, 140, 53, 0.55);
}

/* Depth-2 nodes */
.post-toc-marker[data-depth="2"] .post-toc-marker-bar {
  border-color: rgba(181, 140, 53, 0.38);
}

/* Depth-3/4 nodes: smaller, subtler */
.post-toc-marker[data-depth="3"] .post-toc-marker-bar,
.post-toc-marker[data-depth="4"] .post-toc-marker-bar {
  width: 5px;
  height: 5px;
  border-color: rgba(181, 140, 53, 0.3);
}

/* Text labels */
.post-toc-text {
  display: block;
  line-height: 1.3;
  color: inherit;
  transition: color 0.2s ease;
  padding-left: calc(var(--toc-depth, 0) * 10px);
}

/* Depth-1 text: heading font, prominent */
.post-toc-marker[data-depth="1"] .post-toc-text {
  font-family: var(--heading-font);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-light);
}

/* Depth-2 text: body font, slightly smaller */
.post-toc-marker[data-depth="2"] .post-toc-text {
  font-family: var(--body-font);
  font-size: 0.8rem;
  font-weight: 400;
  color: rgba(79, 68, 57, 0.82);
}

/* Depth-3/4 text: smaller, italic, subdued */
.post-toc-marker[data-depth="3"] .post-toc-text,
.post-toc-marker[data-depth="4"] .post-toc-text {
  font-family: var(--body-font);
  font-size: 0.75rem;
  font-weight: 400;
  font-style: italic;
  color: rgba(79, 68, 57, 0.65);
}

/* Hover: highlight node and text */
.post-toc-rail .post-toc-link:hover,
.post-toc-rail .post-toc-link:focus-visible {
  color: var(--ink);
}

.post-toc-rail .post-toc-link:hover .post-toc-marker-bar,
.post-toc-rail .post-toc-link:focus-visible .post-toc-marker-bar {
  border-color: var(--gold);
  background: rgba(181, 140, 53, 0.15);
}

.post-toc-rail .post-toc-link:hover .post-toc-text,
.post-toc-rail .post-toc-link:focus-visible .post-toc-text {
  color: var(--ink);
}

/* Selection: gold accent when user selects text in a section */
.post-toc-marker.is-selecting .post-toc-marker-bar {
  background: rgba(181, 140, 53, 0.2);
  border-color: var(--gold);
}

.post-toc-marker.is-selecting .post-toc-text {
  color: var(--gold);
}

/* Active: vermillion node and text (overrides selection) */
.post-toc-marker.is-active {
  color: var(--vermillion-deep);
}

.post-toc-marker.is-active .post-toc-marker-bar {
  background: var(--vermillion-deep);
  border-color: var(--vermillion-deep);
  box-shadow: 0 0 0 2.5px rgba(111, 30, 22, 0.1);
}

.post-toc-marker.is-active .post-toc-text {
  color: var(--vermillion-deep);
}

/* ---- Mobile TOC ---- */

.post-toc-mobile {
  display: none;
  margin: 0 0 28px;
  border-left: 2px solid rgba(181, 140, 53, 0.28);
  border-radius: 0 3px 3px 0;
  background: rgba(181, 140, 53, 0.03);
}

.post-toc-mobile-summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  gap: 2px;
  padding: 14px 36px 14px 16px;
  position: relative;
}

.post-toc-mobile-summary::-webkit-details-marker {
  display: none;
}

/* Chevron instead of + */
.post-toc-mobile-summary::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--gold);
  border-bottom: 1.5px solid var(--gold);
  transform: translateY(-60%) rotate(45deg);
  transition: transform 0.22s ease;
}

.post-toc-mobile[open] .post-toc-mobile-summary::after {
  transform: translateY(-40%) rotate(-135deg);
}

.post-toc-mobile-label {
  font-family: var(--heading-font);
  font-size: 0.54rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.post-toc-mobile-current {
  display: block;
  padding-right: 10px;
  font-family: var(--heading-font);
  font-size: 0.96rem;
  line-height: 1.08;
  color: var(--ink);
}

.post-toc-mobile-summary:hover .post-toc-mobile-current,
.post-toc-mobile-summary:focus-visible .post-toc-mobile-current {
  color: var(--vermillion-deep);
}

.post-toc-list-mobile {
  margin-top: 0;
  padding: 6px 0 10px 16px;
  border-top: 1px solid rgba(181, 140, 53, 0.1);
}

.post-toc-list-mobile .post-toc-link {
  padding: 6px 0 6px calc(14px + (var(--toc-depth, 0) * 10px));
  position: relative;
}

/* Mobile dot markers */
.post-toc-list-mobile .post-toc-link::before {
  content: '';
  position: absolute;
  left: calc(2px + (var(--toc-depth, 0) * 10px));
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(181, 140, 53, 0.35);
  transform: translateY(-50%);
  transition: background 0.2s ease;
}

.post-toc-list-mobile .post-toc-link.is-selecting .post-toc-text {
  color: var(--gold);
}

.post-toc-list-mobile .post-toc-link.is-selecting::before {
  background: var(--gold);
}

.post-toc-list-mobile .post-toc-link.is-active {
  color: var(--vermillion-deep);
}

.post-toc-list-mobile .post-toc-link.is-active::before {
  background: var(--vermillion-deep);
}

.post-toc-list-mobile .post-toc-link.is-active .post-toc-text {
  color: var(--vermillion-deep);
}

@media (prefers-reduced-motion: reduce) {
  .post-toc-marker-bar,
  .post-toc-text,
  .post-toc-mobile-summary::after,
  .post-toc-list-mobile .post-toc-link::before {
    transition: none;
  }
}

/* ==========================================================================
   Post Content — Typography System
   ========================================================================== */

.post-content,
.post-content.gh-content,
.gh-content {
  overflow: visible !important;
}

.post-content p {
  font-size: 1.05rem;
  line-height: 1.78;
  margin-bottom: 18px;
  text-align: left;
  hyphens: none;
}

.post-content > p:first-of-type,
.post-content h1 + p,
.post-content h2 + p,
.post-content h3 + p,
.post-content h4 + p {
  position: relative;
  overflow: visible;
}

.post-content h1 + p::before,
.post-content h2 + p::before,
.post-content h3 + p::before,
.post-content h4 + p::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-1 -1 26 26'%3E%3Cg fill='%23b58c35' transform='translate(12 12)'%3E%3Cpath d='M0-9.2C1.8-9.2 2.9-7.9 2.9-6.3C2.9-5 1.9-3.8 0-2.2C-1.9-3.8-2.9-5-2.9-6.3C-2.9-7.9-1.8-9.2 0-9.2Z'/%3E%3Cpath d='M0-9.2C1.8-9.2 2.9-7.9 2.9-6.3C2.9-5 1.9-3.8 0-2.2C-1.9-3.8-2.9-5-2.9-6.3C-2.9-7.9-1.8-9.2 0-9.2Z' transform='rotate(45)'/%3E%3Cpath d='M0-9.2C1.8-9.2 2.9-7.9 2.9-6.3C2.9-5 1.9-3.8 0-2.2C-1.9-3.8-2.9-5-2.9-6.3C-2.9-7.9-1.8-9.2 0-9.2Z' transform='rotate(90)'/%3E%3Cpath d='M0-9.2C1.8-9.2 2.9-7.9 2.9-6.3C2.9-5 1.9-3.8 0-2.2C-1.9-3.8-2.9-5-2.9-6.3C-2.9-7.9-1.8-9.2 0-9.2Z' transform='rotate(135)'/%3E%3Cpath d='M0-9.2C1.8-9.2 2.9-7.9 2.9-6.3C2.9-5 1.9-3.8 0-2.2C-1.9-3.8-2.9-5-2.9-6.3C-2.9-7.9-1.8-9.2 0-9.2Z' transform='rotate(180)'/%3E%3Cpath d='M0-9.2C1.8-9.2 2.9-7.9 2.9-6.3C2.9-5 1.9-3.8 0-2.2C-1.9-3.8-2.9-5-2.9-6.3C-2.9-7.9-1.8-9.2 0-9.2Z' transform='rotate(225)'/%3E%3Cpath d='M0-9.2C1.8-9.2 2.9-7.9 2.9-6.3C2.9-5 1.9-3.8 0-2.2C-1.9-3.8-2.9-5-2.9-6.3C-2.9-7.9-1.8-9.2 0-9.2Z' transform='rotate(270)'/%3E%3Cpath d='M0-9.2C1.8-9.2 2.9-7.9 2.9-6.3C2.9-5 1.9-3.8 0-2.2C-1.9-3.8-2.9-5-2.9-6.3C-2.9-7.9-1.8-9.2 0-9.2Z' transform='rotate(315)'/%3E%3Ccircle r='1.8'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  vertical-align: -0.1em;
  opacity: 0.85;
}

.post-dropcap-paragraph::before {
  content: none !important;
}

.post-dropcap-letter {
  float: left;
  font-family: var(--heading-font);
  font-size: 3.8rem;
  line-height: 0.82;
  font-weight: 500;
  color: var(--vermillion);
  margin: 0.06em 0.1em 0 0;
  position: relative;
}

.post-dropcap-letter::after {
  content: '';
  position: absolute;
  top: -1px;
  left: -3px;
  width: 0.25em;
  height: 0.25em;
  border-top: 1px solid var(--gold);
  border-left: 1px solid var(--gold);
  opacity: 0.2;
  pointer-events: none;
}

/* Heading hierarchy: 1.8 / 1.4 / 1.15 / 0.95 — clear steps */
.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  scroll-margin-top: var(--post-anchor-offset);
}

.post-content h1 {
  font-family: var(--heading-font);
  font-size: 1.8rem;
  font-weight: 400;
  letter-spacing: 0.015em;
  color: var(--ink);
  text-align: left;
  margin: 48px 0 12px;
  line-height: 1.1;
}

.post-content h2 {
  font-family: var(--heading-font);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--ink);
  margin: 40px 0 10px;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.post-content h3 {
  font-family: var(--heading-font);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  margin: 32px 0 8px;
  line-height: 1.2;
}

.post-content h4 {
  font-family: var(--heading-font);
  font-size: 0.95rem;
  font-weight: 600;
  font-style: normal;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin: 28px 0 8px;
}

.post-content a {
  color: var(--lapis);
  border-bottom: 1px solid rgba(26, 58, 92, 0.18);
  transition: border-color 0.2s;
}

.post-content a:hover { border-color: var(--lapis); }
.post-content strong { font-weight: 600; }

.post-content blockquote {
  margin: 24px 0;
  padding: 4px 0 4px 16px;
  border-left: 2px solid var(--gold);
  background: transparent;
  position: relative;
}

.post-content blockquote::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0.3;
}

.post-content blockquote p {
  font-style: normal;
  color: var(--ink);
  text-align: left;
}

.post-content blockquote p:last-child { margin-bottom: 0; }

.post-content ul, .post-content ol {
  margin: 16px 0;
  padding-left: 26px;
}

.post-content li {
  margin-bottom: 6px;
  line-height: 1.72;
}

.post-content ul li::marker { color: var(--gold); }
.post-content ol li::marker { color: var(--vermillion); font-weight: 600; }

.post-content hr { display: none; }

.hr-sacred {
  margin: 44px auto;
  width: 36px;
  height: 36px;
  color: var(--gold);
  opacity: 0.4;
}

.hr-sacred .sacred-mark { width: 100%; height: 100%; display: block; }

.post-content figure { margin: 28px 0; }

.post-content figure img {
  display: block;
  border: 1px solid var(--gold-muted);
}

.post-content figcaption {
  font-family: var(--heading-font);
  font-size: 0.8rem;
  color: var(--ink-muted);
  text-align: center;
  margin-top: 6px;
  font-style: italic;
}

.post-content .kg-width-wide {
  max-width: var(--wide-width);
  margin-left: calc(50% - var(--wide-width) / 2);
  margin-right: calc(50% - var(--wide-width) / 2);
}

.post-content .kg-width-full {
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.post-content code {
  font-family: var(--mono-font);
  font-size: 0.84em;
  color: var(--vermillion-deep);
  background: rgba(178, 34, 34, 0.04);
  padding: 1px 5px;
  border-radius: 2px;
}

.post-content pre {
  background: rgba(42, 24, 16, 0.035);
  border: 1px solid rgba(42, 24, 16, 0.07);
  padding: 18px 22px;
  margin: 22px 0;
  overflow-x: auto;
  font-family: var(--mono-font);
  font-size: 0.8rem;
  line-height: 1.6;
}

.post-content pre code {
  background: none;
  color: var(--ink);
  padding: 0;
  border-radius: 0;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 22px 0;
  font-size: 0.9rem;
}

.post-content th {
  font-family: var(--heading-font);
  font-weight: 600;
  text-align: left;
  padding: 8px 12px;
  border-bottom: 2px solid var(--gold);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--vermillion-deep);
}

.post-content td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--gold-muted);
}

.post-content .footnotes {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--gold-muted);
  font-size: 0.86rem;
  color: var(--ink-light);
}

.post-content .footnotes ol {
  padding-left: 22px;
}

.post-content .footnotes li {
  margin-bottom: 10px;
}

.post-content .footnotes p {
  font-size: 0.92rem;
  line-height: 1.65;
  margin-bottom: 0;
}

.post-content .footnotes .footnote-backref {
  color: var(--vermillion);
  margin-left: 4px;
}

.post-content sup a {
  color: var(--vermillion);
  font-weight: 600;
  font-size: 0.8em;
  border: none;
  cursor: pointer;
}

/* Footnote hover tooltip — manuscript marginalia style */
.footnote-tooltip {
  position: fixed;
  width: min(300px, calc(100vw - 32px));
  background: var(--parchment);
  border-left: 2px solid rgba(181, 140, 53, 0.35);
  border-top: none;
  border-right: none;
  border-bottom: none;
  padding: 10px 16px 10px 14px;
  font-family: var(--body-font);
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--ink-light);
  z-index: 60;
  pointer-events: none;
  opacity: 0;
  transform: translateX(4px);
  box-shadow: 4px 6px 24px rgba(33, 27, 22, 0.06);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.footnote-tooltip::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0.5;
}

.footnote-tooltip.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.footnote-tooltip p {
  font-size: 0.82rem;
  line-height: 1.6;
  margin-bottom: 6px;
  font-style: italic;
  color: var(--ink-light);
}

.footnote-tooltip p:last-child {
  margin-bottom: 0;
}

.footnote-tooltip a {
  color: var(--lapis);
  font-size: 0.78rem;
  word-break: break-all;
}

/* Footnote reference superscript styling */
.post-content sup a[href^="#fn"] {
  color: var(--vermillion-deep);
  font-family: var(--heading-font);
  font-weight: 600;
  font-size: 0.85em;
  text-decoration: none;
  border-bottom: none;
  padding: 0 2px;
  transition: color 0.15s ease;
}

.post-content sup a[href^="#fn"]:hover {
  color: var(--vermillion);
}

.post-content .kg-callout-card {
  margin: 22px 0;
  padding: 16px 20px;
  border: 1px solid var(--gold-muted);
  background: var(--gold-faint);
}

.post-content .kg-bookmark-card {
  margin: 22px 0;
  border: 1px solid var(--gold-muted);
}

.post-content .kg-bookmark-container {
  display: flex;
  text-decoration: none;
  color: var(--ink);
}

.post-content .kg-bookmark-content { padding: 12px; flex: 1; }

.post-content .kg-bookmark-title {
  font-family: var(--heading-font);
  font-weight: 600;
  font-size: 0.9rem;
}

.post-content .kg-bookmark-description {
  font-size: 0.8rem;
  color: var(--ink-light);
  margin-top: 3px;
}

.post-content .kg-bookmark-metadata {
  font-size: 0.7rem;
  color: var(--ink-muted);
  margin-top: 4px;
}

.post-content .kg-bookmark-thumbnail img {
  width: 120px;
  height: 100%;
  object-fit: cover;
}

.post-content .kg-button-card { text-align: center; margin: 22px 0; }

.post-content .kg-btn {
  font-family: var(--heading-font);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 9px 24px;
  border: 1px solid var(--vermillion);
  color: var(--vermillion);
  background: transparent;
  transition: background 0.2s, color 0.2s;
  cursor: pointer;
}

.post-content .kg-btn:hover {
  background: var(--vermillion);
  color: var(--parchment);
}

/* ==========================================================================
   Post Footer
   ========================================================================== */

.post-footer {
  max-width: var(--content-width);
  margin: 36px auto 0;
  padding: 0 28px 40px;
  text-align: center;
}

.post-footer-ornament {
  width: 60px;
  height: 60px;
  margin: 0 auto 20px;
  color: var(--gold);
  opacity: 0.5;
}

.post-footer-ornament .sacred-mark { width: 100%; height: 100%; display: block; }

.interlace-ornament { width: 100%; height: auto; display: block; }
.interlace-strand { opacity: 0.3; }
.interlace-dot { opacity: 0.25; }

.interlace-ornament.is-breathing .interlace-strand {
  animation: interlace-breathe 8s ease-in-out infinite;
}

.interlace-ornament.is-breathing .interlace-strand:nth-child(2) {
  animation-delay: -4s;
}

.interlace-ornament.is-breathing .interlace-dot {
  animation: interlace-dot-breathe 8s ease-in-out infinite;
  animation-delay: -2s;
}

@keyframes interlace-breathe {
  0%, 100% { stroke: var(--gold); opacity: 0.3; }
  50% { stroke: #8a6a20; opacity: 0.2; }
}

@keyframes interlace-dot-breathe {
  0%, 100% { fill: var(--gold); opacity: 0.25; }
  50% { fill: #8a6a20; opacity: 0.15; }
}

.geo-animate {
  transform-origin: center center;
  transform-box: fill-box;
  --geo-breathe-duration: 5s;
  --geo-breathe-delay: 0s;
  --geo-breathe-settle: 0.7s;
  --geo-breathe-scale: 1.08;
  --geo-breathe-rise: -0.28px;
  --geo-breathe-floor: 0.945;
}

.geo-animate.is-drifting {
  animation: sacred-breathe var(--geo-breathe-duration) linear infinite;
  animation-delay: calc(var(--geo-breathe-delay) + var(--geo-breathe-settle));
}

.geo-animate [data-layer] {
  transform-origin: center center;
  transform-box: fill-box;
}

.geo-animate.is-drifting [data-layer] {
  animation: geo-layer-breathe var(--geo-layer-duration, 5s) linear infinite;
  animation-delay: calc(var(--geo-layer-delay, 0s) + var(--geo-breathe-settle));
}

@keyframes sacred-breathe {
  0%, 100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  42% {
    opacity: var(--geo-breathe-floor);
    transform: translateY(var(--geo-breathe-rise)) scale(var(--geo-breathe-scale));
  }
}

@keyframes geo-layer-breathe {
  0%, 100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  42% {
    opacity: calc(1 - var(--geo-layer-dim, 0.04));
    transform: translateY(var(--geo-layer-lift, -0.18px)) scale(var(--geo-layer-scale, 1.001));
  }
}

@media (prefers-reduced-motion: reduce) {
  .interlace-strand,
  .interlace-dot,
  .geo-animate circle,
  .geo-animate path,
  .geo-animate line,
  .geo-animate.is-drifting {
    animation: none !important;
  }
}

.post-tags {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.post-tag {
  font-family: var(--heading-font);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border: 1px solid var(--gold-muted);
  padding: 3px 10px;
  transition: color 0.2s, border-color 0.2s;
}

.post-tag:hover {
  color: var(--vermillion);
  border-color: var(--vermillion);
}

.post-comments {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 24px 36px;
}

/* ==========================================================================
   Site Footer
   ========================================================================== */

.site-footer {
  border-top: 1px solid rgba(181, 140, 53, 0.15);
  padding: 32px 28px 40px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.home-template .site-footer { border-top: none; }

.site-footer-inner {
  max-width: var(--wide-width);
  margin: 0 auto;
}

.site-footer-mark {
  width: 44px;
  height: 44px;
  margin: 0 auto 8px;
  color: var(--gold);
  opacity: 0.5;
}

.site-footer-mark .sacred-mark { width: 100%; height: 100%; display: block; }

.site-footer-name {
  font-family: var(--heading-font);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.site-footer-copy {
  display: none;
}

/* Hide portal button */
.gh-portal-triggerbtn-iframe { display: none !important; }

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

@media (max-width: 959px) {
  .post-body.has-toc {
    max-width: var(--content-width);
    display: block;
  }

  .post-body.has-toc .post-toc {
    display: block;
    position: static;
    top: auto;
    margin-bottom: 0;
  }

  .post-body.has-toc .post-content {
    padding-bottom: 104px;
  }

  .post-toc-desktop {
    display: none;
  }

  .post-toc-mobile {
    display: block;
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-width: min(420px, calc(100vw - 32px));
    margin: 0 auto;
    border: 1px solid rgba(181, 140, 53, 0.22);
    border-radius: 16px;
    background: rgba(244, 239, 230, 0.975);
    box-shadow: 0 14px 36px rgba(33, 27, 22, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 140;
  }

  .post-toc-mobile-summary {
    padding: 12px 40px 12px 14px;
  }

  .post-toc-mobile-current {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .post-toc-mobile[open] {
    max-width: min(520px, calc(100vw - 24px));
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    background: rgba(244, 239, 230, 0.992);
  }

  .post-toc-mobile[open] .post-toc-mobile-current {
    white-space: normal;
  }

  .post-toc-list-mobile {
    max-height: min(52vh, 360px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .post-content .kg-width-wide,
  .post-content .kg-width-full {
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }
}

@media (min-width: 960px) {
  .post-toc-mobile {
    display: none;
  }
}

@media (max-width: 768px) {
  html { font-size: 16px; }

  .site-nav-inner {
    gap: 12px;
    padding: 12px 16px;
  }

  .site-nav-links { display: none; }

  .post-card-link { flex-direction: column; gap: 10px; }
  .post-card-image { width: 100%; height: 160px; }

  .toc-entry {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .toc-entry-meta {
    text-align: left;
    padding-top: 0;
  }
}

@media (max-width: 480px) {
  .site-header { padding: 28px 16px 6px; }
  .post-header { padding: 32px 16px 18px; }
  .post-body { padding: 0 16px; }
  .post-title { letter-spacing: 0.01em; }
  .manuscript-toc { padding: 20px 18px 28px; margin-left: 12px; margin-right: 12px; }
}
