/* Shared blog post styles. Pair with custom.css and js/post.js. */

html.post-page {
  overflow-x: clip;
}

.post {
  width: 100%;
}

.post .section__header {
  max-width: none;
}

.post-meta {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin: 0 0 0.85rem;
}

.post-byline,
.post-credit {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin: 0 0 0.65rem;
  line-height: 1.55;
  max-width: 56rem;
}

.post-byline a,
.post-credit a {
  color: var(--accent);
}

.post-credit {
  margin-bottom: 1.25rem;
}

.post-prose {
  color: var(--text-secondary);
  font-size: 1.02rem;
  line-height: 1.65;
  margin: 0 0 1.35rem;
  max-width: 56rem;
}

.post-prose p {
  margin: 0 0 0.85rem;
}

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

.post-prose a {
  color: var(--accent);
}

.post-heading {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-primary, inherit);
  margin: 1.75rem 0 0.85rem;
  max-width: 56rem;
}

.post-heading:first-of-type {
  margin-top: 1.25rem;
}

/* Compact factual strip */
.post-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 0 0 1.5rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--surface-border);
  border-bottom: 1px solid var(--surface-border);
  max-width: 56rem;
}

.post-stats__item {
  display: grid;
  gap: 2px;
  min-width: 6.5rem;
}

.post-stats__value {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary, inherit);
  line-height: 1.2;
}

.post-stats__label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* Component definition rows */
.post-parts {
  list-style: none;
  padding: 0;
  margin: 0 0 0.5rem;
  display: grid;
  gap: 0.95rem;
  max-width: 56rem;
}

.post-parts li {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.98rem;
  line-height: 1.55;
}

.post-parts strong {
  display: block;
  color: var(--text-primary, inherit);
  font-weight: 600;
  font-size: 0.98rem;
  margin-bottom: 0.2rem;
}

.post-howto,
.post-callouts {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  display: grid;
  gap: 0.85rem;
  max-width: 56rem;
}

.post-howto li,
.post-callouts li {
  color: var(--text-secondary);
  font-size: 0.98rem;
  line-height: 1.55;
  margin: 0;
}

.post-howto strong,
.post-callouts strong {
  color: var(--text-primary, inherit);
  font-weight: 600;
}

.post-callouts li + li {
  padding-top: 0.85rem;
  border-top: 1px solid var(--surface-border);
}

/* Full-bleed figure; inner frame matches .page width */
.post-figure {
  position: relative;
  width: 100vw;
  max-width: 100vw;
  margin: 0.75rem 0 0.85rem;
  margin-left: calc(50% - 50vw);
  background: #0b0b0b;
  overflow: hidden;
}

[data-theme="light"] .post-figure {
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.06),
    0 -1px 0 rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .post-figure {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04),
    0 -1px 0 rgba(255, 255, 255, 0.04);
}

.post-figure__frame {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 32px);
  box-sizing: border-box;
}

.post-figure__frame iframe {
  display: block;
  width: 100%;
  max-width: 100%;
  border: 0;
  background: #0b0b0b;
  aspect-ratio: 1040 / 920;
  height: auto;
  min-height: 560px;
}

.post-figure__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  margin: 0 0 1.5rem;
}

.post-figure__actions a {
  font-size: 0.92rem;
  color: var(--accent);
}

.post-note {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0 0 0.85rem;
  max-width: 56rem;
}

.post-notes {
  margin: 0 0 1.35rem;
  max-width: 56rem;
  display: grid;
  gap: 0.75rem;
}

.post-notice {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0 0 1.75rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  max-width: 56rem;
}

.post-sources {
  border-top: 1px solid var(--surface-border);
  padding-top: 1.25rem;
  margin-top: 0.25rem;
  max-width: 56rem;
}

.post-sources h2 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  margin: 0 0 0.65rem;
  font-weight: 600;
}

.post-sources ul {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--text-secondary);
  display: grid;
  gap: 0.45rem;
  font-size: 0.92rem;
  line-height: 1.5;
}

.post-sources a {
  color: var(--accent);
}

/* Inline term tooltips */
.term {
  position: relative;
  cursor: help;
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent);
  color: inherit;
}

.term:focus {
  outline: none;
}

.term:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.term__tip {
  position: absolute;
  z-index: 40;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  width: max(12rem, min(20rem, 70vw));
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--surface-border);
  background: var(--surface-solid, var(--surface));
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 400;
  line-height: 1.45;
  text-align: left;
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.12s ease, visibility 0.12s ease;
}

.term__tip[data-open="true"] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.term__tip[data-place="below"] {
  bottom: auto;
  top: calc(100% + 10px);
}

.term__tip a {
  color: var(--accent);
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
}

@media (max-width: 720px) {
  .post-figure__frame iframe {
    min-height: 480px;
  }

  .post-stats__item {
    min-width: 45%;
  }
}

/* Hover bridge so the pointer can reach links inside a tooltip */
.term__tip::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 12px;
}
.post-prose sup.cite, sup.cite { font-size: 0.7em; line-height: 0; margin-left: 1px; }
sup.cite a { text-decoration: none; color: var(--text-secondary); }
sup.cite a:hover { text-decoration: underline; }
.post-sources ol { padding-left: 1.4rem; }
.post-sources li:target { background: color-mix(in srgb, currentColor 8%, transparent); border-radius: 4px; }
.post-figure__credit { font-size: 0.85rem; color: var(--text-secondary); margin-top: 0.4rem; }

/* Post header: author and date, set apart from the body */
.post-header-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.25rem 1rem;
  margin: 0.25rem 0 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--surface-border);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.post-header-meta__author { font-weight: 600; color: var(--text-primary, inherit); }
.post-header-meta__with { font-weight: 400; color: var(--text-secondary); margin-left: 0.35rem; }
.post-parts__where { display: block; margin-top: 0.3rem; font-size: 0.8rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent, #d97706); }
.post-callouts__implication { display: block; margin-top: 0.3rem; font-size: 0.8rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent, #5eead4); }
.post-figure__btn { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.4rem 0.85rem; border: 1px solid var(--surface-border); border-radius: 999px; font-size: 0.82rem; text-decoration: none; color: var(--text-secondary); transition: color .15s, border-color .15s, background .15s; }
.post-figure__btn:hover, .post-figure__btn:focus-visible { color: var(--text-primary, inherit); border-color: currentColor; background: color-mix(in srgb, currentColor 6%, transparent); }
.post-header-meta__updated { margin-left: 0.75rem; opacity: 0.75; }
.post-notice { font-style: italic; border: 0 !important; background: none !important; padding: 0 !important; box-shadow: none !important; color: var(--text-secondary); }

/* Blog posts: flat off-white in light mode instead of the site gradient */
html[data-theme="light"] body { background: #f5f1e8; }
