/* AspiringPeasant — post content styles.
   .gh-content wraps Ghost's rendered post HTML. Ported from
   mocks/components/ghost.css, then extended to cover Ghost's real card DOM
   (the mocks' gallery/callout markup didn't match actual Ghost output) and
   the cards the mocks left unstyled. Net-new surfaces are marked. */

.gh-content { max-width: 62ch; margin: 0 auto; font-size: 18.5px; line-height: 1.72; color: var(--text-body); }
.gh-content p { margin: 0 0 1.4em; }
.gh-content h2 { font-size: 30px; margin: 1.6em 0 0.6em; }
.gh-content h3 { font-size: 24px; margin: 1.5em 0 0.5em; }
.gh-content h4, .gh-content h5, .gh-content h6 { font-family: var(--font-display); font-weight: 500; color: var(--text-display); line-height: var(--leading-snug); }
.gh-content h4 { font-size: 20px; margin: 1.5em 0 0.5em; }
.gh-content h5 { font-size: 17.5px; margin: 1.4em 0 0.4em; }
.gh-content h6 { font-family: var(--font-ui); font-size: 12px; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-muted); margin: 1.6em 0 0.5em; }
.gh-content ul, .gh-content ol { margin: 0 0 1.4em; padding-left: 1.3em; }
.gh-content li { margin-bottom: 0.4em; }
.gh-content li ul, .gh-content li ol { margin: 0.4em 0 0; }
.gh-content em { font-style: italic; }
.gh-content strong { font-weight: 600; color: var(--text-display); }
.gh-content mark { background: var(--c-sun-100); color: inherit; padding: 0 2px; border-radius: 2px; }
.gh-content kbd { font-family: var(--font-mono); font-size: 0.8em; background: var(--bg-inset); border: 1px solid var(--border-soft); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; }

/* Signature divider: hairline with a gap cut for a terracotta dot */
.gh-content hr { border: 0; margin: 2.6em auto; width: 140px; height: 9px; position: relative; }
.gh-content hr::before {
  content: ""; position: absolute; left: 0; right: 0; top: 4px; height: 1px;
  background: linear-gradient(90deg, var(--border-soft) 0 calc(50% - 14px), transparent calc(50% - 14px) calc(50% + 14px), var(--border-soft) calc(50% + 14px));
}
.gh-content hr::after { content: ""; position: absolute; left: 50%; top: 0; transform: translateX(-50%); width: 9px; height: 9px; border-radius: 50%; background: var(--accent-warm); }

/* Voice blockquote: centered italic Lora with accent underline */
.gh-content blockquote { margin: 2.2em 0; padding: 0; border: 0; text-align: center; font-family: var(--font-display); font-style: italic; font-size: 26px; line-height: 1.4; color: var(--text-display); }
.gh-content blockquote::after { content: ""; display: block; width: 48px; height: 2px; background: var(--accent-warm); margin: 18px auto 0; }
.gh-content blockquote p { margin: 0 0 0.6em; }
.gh-content blockquote p:last-child { margin-bottom: 0; }

/* Figures & images */
.gh-content figure { margin: 2.2em 0; }
.gh-content figure img, .gh-content .kg-image { width: 100%; border-radius: var(--radius-md); display: block; }
.gh-content figcaption { font-family: var(--font-text); font-style: italic; font-size: 14.5px; color: var(--text-muted); text-align: center; margin-top: 10px; }
.gh-content .kg-width-wide { width: calc(100% + 160px); margin-left: -80px; }
.gh-content .kg-width-full { width: 100vw; margin-left: calc(50% - 50vw); max-width: none; }
.gh-content .kg-width-full img { border-radius: 0; }

/* Code */
.gh-content pre { background: var(--bg-inset); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 16px 18px; font-family: var(--font-mono); font-size: 14px; overflow: auto; }
.gh-content code { font-family: var(--font-mono); font-size: 0.85em; background: var(--bg-inset); padding: 2px 6px; border-radius: 4px; }
.gh-content pre code { background: none; padding: 0; }

/* Tables (net-new — unstyled in mocks) */
.gh-content table { width: 100%; border-collapse: collapse; margin: 2.2em 0; font-size: 15px; }
.gh-content th { font-family: var(--font-ui); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--c-stone-3); }
.gh-content td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); }

/* Gallery — Ghost's real DOM: .kg-gallery-card > container > row > image
   (card_assets provides the flex ratios; we add the gaps + radii) */
.gh-content .kg-gallery-card { margin: 2.2em 0; }
.gh-content .kg-gallery-container { display: flex; flex-direction: column; gap: 8px; }
.gh-content .kg-gallery-row { display: flex; flex-direction: row; justify-content: center; gap: 8px; }
.gh-content .kg-gallery-image { border-radius: 6px; overflow: hidden; }
.gh-content .kg-gallery-image img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 0; }

/* Bookmark card */
.gh-content .kg-bookmark-card { margin: 2.2em 0; }
.gh-content .kg-bookmark-card a.kg-bookmark-container, .gh-content .kg-bookmark-card a {
  display: flex; border: 1px solid var(--border-soft); border-radius: var(--radius-md); overflow: hidden;
  text-decoration: none; color: inherit; background: var(--bg-card); box-shadow: var(--shadow-soft);
  transition: box-shadow var(--dur-drift) var(--ease-drift);
}
.gh-content .kg-bookmark-card a:hover { box-shadow: var(--shadow-lift); color: inherit; }
.gh-content .kg-bookmark-content { display: flex; flex-direction: column; align-items: flex-start; padding: 16px 20px; flex: 1; }
.gh-content .kg-bookmark-title { font-family: var(--font-display); font-size: 19px; color: var(--text-display); }
.gh-content .kg-bookmark-description { font-family: var(--font-text); font-size: 14px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.gh-content .kg-bookmark-metadata { display: flex; align-items: center; gap: 6px; font-family: var(--font-ui); font-size: 12px; letter-spacing: 0.06em; color: var(--text-faint); margin-top: 10px; }
.gh-content .kg-bookmark-icon { width: 18px; height: 18px; border-radius: 3px; }
.gh-content .kg-bookmark-author, .gh-content .kg-bookmark-publisher { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gh-content .kg-bookmark-publisher::before { content: "·"; margin-right: 6px; }
.gh-content .kg-bookmark-thumbnail { width: 190px; flex-shrink: 0; }
.gh-content .kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }

/* Callout — Ghost's real DOM: .kg-callout-card > .kg-callout-emoji + .kg-callout-text */
.gh-content .kg-callout-card { display: flex; gap: 12px; align-items: baseline; background: var(--callout-bg); border: 1px solid var(--callout-border); border-radius: var(--radius-md); padding: 16px 20px; font-size: 16px; margin: 2.2em 0; }
.gh-content .kg-callout-emoji { font-size: 18px; line-height: 1.25; }
.gh-content .kg-callout-text { font-family: var(--font-text); }
/* Color variants (net-new — designer-extrapolated from the warm original; low-chroma per palette rules) */
.gh-content .kg-callout-card-yellow, .gh-content .kg-callout-card-accent { background: var(--callout-bg); border-color: var(--callout-border); }
.gh-content .kg-callout-card-blue { background: oklch(0.94 0.018 230); border-color: oklch(0.87 0.035 235); }
.gh-content .kg-callout-card-green { background: oklch(0.94 0.02 140); border-color: oklch(0.87 0.035 140); }
.gh-content .kg-callout-card-red { background: oklch(0.94 0.02 30); border-color: oklch(0.87 0.04 30); }
.gh-content .kg-callout-card-pink { background: oklch(0.94 0.02 350); border-color: oklch(0.88 0.035 350); }
.gh-content .kg-callout-card-purple { background: oklch(0.94 0.02 300); border-color: oklch(0.88 0.035 300); }
.gh-content .kg-callout-card-grey, .gh-content .kg-callout-card-white { background: var(--bg-inset); border-color: var(--border-soft); }
[data-theme="dark"] .gh-content .kg-callout-card-blue { background: oklch(0.28 0.045 250); border-color: oklch(0.38 0.05 248); }
[data-theme="dark"] .gh-content .kg-callout-card-green { background: oklch(0.28 0.04 140); border-color: oklch(0.38 0.045 140); }
[data-theme="dark"] .gh-content .kg-callout-card-red { background: oklch(0.28 0.045 30); border-color: oklch(0.38 0.05 30); }
[data-theme="dark"] .gh-content .kg-callout-card-pink { background: oklch(0.28 0.04 350); border-color: oklch(0.38 0.045 350); }
[data-theme="dark"] .gh-content .kg-callout-card-purple { background: oklch(0.28 0.04 300); border-color: oklch(0.38 0.045 300); }
[data-theme="dark"] .gh-content .kg-callout-card-grey, [data-theme="dark"] .gh-content .kg-callout-card-white { background: var(--bg-inset); border-color: var(--border-soft); }

/* Button card */
.gh-content .kg-button-card { display: flex; justify-content: center; margin: 2.4em 0; }
.gh-content .kg-button-card.kg-align-left { justify-content: flex-start; }
.gh-content .kg-button-card .kg-btn {
  display: inline-flex; align-items: center; font-family: var(--font-ui); font-weight: 500; font-size: 14px; line-height: 1;
  padding: 11px 20px; border-radius: var(--radius-sm); text-decoration: none;
  transition: background var(--dur-drift) var(--ease-drift);
}
.gh-content .kg-button-card .kg-btn-accent { background: var(--c-sun-500); color: oklch(0.985 0.008 85); }
.gh-content .kg-button-card .kg-btn-accent:hover { background: var(--c-sun-700); color: oklch(0.985 0.008 85); }

/* Remaining cards — harmonized (net-new; no bespoke design in mocks) */
.gh-content .kg-embed-card { margin: 2.2em 0; display: flex; flex-direction: column; }
.gh-content .kg-embed-card iframe { max-width: 100%; border-radius: var(--radius-md); }
.gh-content .kg-video-card, .gh-content .kg-audio-card, .gh-content .kg-file-card, .gh-content .kg-product-card { margin: 2.2em 0; }
.gh-content .kg-video-card video { width: 100%; border-radius: var(--radius-md); display: block; }
.gh-content .kg-audio-card { background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius-md); }
.gh-content .kg-file-card a { text-decoration: none; }
.gh-content .kg-file-card-container { display: flex; align-items: center; gap: 12px; background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius-md); padding: 14px 18px; }
.gh-content .kg-file-card-title { font-family: var(--font-ui); font-weight: 500; font-size: 15px; color: var(--text-display); }
.gh-content .kg-file-card-caption { font-size: 13px; color: var(--text-muted); }
.gh-content .kg-file-card-metadata { font-family: var(--font-ui); font-size: 12px; color: var(--text-faint); }
.gh-content .kg-product-card-container { background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius-md); padding: 20px; }
.gh-content .kg-product-card-title { font-family: var(--font-display); font-size: 19px; color: var(--text-display); }
.gh-content .kg-product-card-description { font-size: 14px; color: var(--text-muted); }
.gh-content .kg-toggle-card { background: var(--bg-inset); border: 1px solid var(--border-soft); border-radius: var(--radius-md); padding: 16px 20px; margin: 2.2em 0; }
.gh-content .kg-toggle-heading-text { font-family: var(--font-display); font-weight: 500; font-size: 19px; color: var(--text-display); }
.gh-content .kg-toggle-content { font-size: 16px; }
.gh-content .kg-header-card { border-radius: var(--radius-md); margin: 2.2em 0; }
.gh-content .kg-signup-card { background: var(--grad-haze); border: 1px solid var(--border-soft); border-radius: var(--radius-md); padding: 32px; margin: 2.2em 0; text-align: center; }
.gh-content .kg-signup-card h2 { margin-top: 0; }

/* ---------------------------------------------------------------------------
   Footnotes (net-new design — built from theme primitives; flag for review).
   Ghost renders Markdown-card [^1] as sup.footnote-ref links + a per-card
   section.footnotes; footnotes.js renumbers across cards and merges them
   into one .ap-endnotes section, then powers the hover popover. */

.gh-content sup { font-size: 0.72em; line-height: 0; vertical-align: super; }
.gh-content sub { font-size: 0.72em; line-height: 0; vertical-align: sub; }
.gh-content .footnote-ref a, .gh-content sup a[href^="#ap-fn"] {
  font-family: var(--font-ui);
  font-weight: 500;
  text-decoration: none;
  color: var(--accent-warm-strong);
  padding: 1px 3px;
}
.gh-content .footnote-ref a:hover, .gh-content sup a[href^="#ap-fn"]:hover { color: var(--link-hover); }

/* Merged endnotes block (replaces Ghost's per-card sections) */
.ap-endnotes { margin-top: 3.2em; }
.ap-endnotes__rule { display: flex; align-items: center; gap: 16px; margin-bottom: 1.6em; }
.ap-endnotes__rule::before, .ap-endnotes__rule::after { content: ""; flex: 1; height: 1px; background: var(--border-soft); }
.ap-endnotes__label { font-family: var(--font-ui); font-size: 11px; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-muted); }
.ap-endnotes ol { margin: 0; padding-left: 1.6em; }
/* empty anchors kept so links in already-sent emails still resolve after the
   footnotes are renumbered (see footnotes.js); must not affect layout */
.ap-fn-alias { display: inline; scroll-margin-top: 90px; }
.ap-endnotes li { font-size: 15px; line-height: 1.6; color: var(--text-muted); margin-bottom: 0.6em; }
.ap-endnotes li p { display: inline; margin: 0; }
.ap-endnotes li:target { color: var(--text-body); }
.ap-endnotes .footnote-backref { text-decoration: none; margin-left: 4px; }

/* Hover popover */
.ap-fn-popover {
  position: absolute;
  z-index: 60;
  max-width: min(420px, calc(100vw - 32px));
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lift);
  padding: 14px 18px;
  font-family: var(--font-text);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-body);
  opacity: 0;
  transform: translateY(4px);
  /* 200ms (not --dur-drift 400ms) for hover responsiveness — flagged deviation */
  transition: opacity 200ms var(--ease-drift), transform 200ms var(--ease-drift);
  pointer-events: none;
}
.ap-fn-popover.is-open { opacity: 1; transform: none; pointer-events: auto; }
.ap-fn-popover--below { transform: translateY(-4px); }
.ap-fn-popover--below.is-open { transform: none; }
.ap-fn-popover p { margin: 0 0 0.6em; }
.ap-fn-popover p:last-child { margin-bottom: 0; }
