/*
  ============================================================
  ARTICLE STYLES, shared by every page in /articles.
  Reuses the color/font variables from css/styles.css (loaded
  first) and adds the reading-page typography on top.

  Same rule as the rest of the site: --font-serif for anything
  read as writing (title, dek, body, pull-quotes, embedded widget
  titles), --font-sans for interface chrome around it (nav, meta,
  labels, form controls, captions).
  ============================================================
*/

.article-container { max-width: 42rem; }

.article-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-text-body);
  text-decoration: none;
  margin-bottom: 2rem;
}
.article-back:hover { color: var(--color-accent); }

.article-flair {
  display: inline-block;
  background: #E3EEF6;
  color: #2C5E85;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  margin: 0 0 0.875rem;
}

.article-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: var(--text-3xl);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--color-text-heading);
  margin-bottom: 0.75rem;
}
@media (min-width: 768px) {
  .article-title { font-size: var(--text-4xl); }
}

.article-dek {
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: italic;
  font-size: var(--text-lg);
  line-height: 1.45;
  color: var(--color-text-body);
  margin: 0 0 1rem;
}

.article-meta {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--color-text-body);
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.article-cover {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0.75rem;
  margin: 1.5rem 0 2rem;
  box-shadow: var(--shadow-md);
}

/* Image placeholder — marks where a real image should be dropped in later.
   Works standalone in the body, or combined with .article-cover for the
   hero spot (that class supplies the sizing/shadow, this supplies the
   dashed "not real yet" treatment). */
.img-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  aspect-ratio: 16 / 9;
  border: 2px dashed var(--color-border);
  border-radius: 0.75rem;
  background: var(--color-surface-soft);
  color: var(--color-text-body);
  margin: 0 0 1.5rem;
  padding: 1.5rem;
  text-align: center;
}
.img-placeholder svg { color: var(--color-accent-soft); flex-shrink: 0; }
.img-placeholder span {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
}

/* In-body screenshots/figures — scoped to a dedicated class (not a blanket
   `.article-body img` selector) so it can't collide with other images that
   happen to live inside .article-body, like the author-box photo. */
.article-figure {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  margin: 0 0 1.5rem;
  box-shadow: var(--shadow-md);
}

.article-body { font-family: var(--font-serif); font-weight: 400; font-size: var(--text-md); line-height: 1.65; color: var(--color-text-body); }
.article-body p { margin: 0 0 1.125rem; }
.article-body h2,
.article-body h3 {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--color-text-heading);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 1.75rem 0 0.75rem;
}
.article-body h2 { font-size: var(--text-xl); }
.article-body h3 { font-size: var(--text-lg); }
.article-body ul { margin: 0 0 1.125rem; padding-left: 1.25rem; }
.article-body li { margin-bottom: 0.5rem; }
.article-body strong { color: var(--color-text-heading); font-weight: 700; }
.article-body code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.85em;
  background: var(--color-surface-soft);
  color: var(--color-accent-strong);
  padding: 0.1em 0.4em;
  border-radius: 0.3em;
}
.article-body hr { border: none; border-top: 1px solid var(--color-border); margin: 1.5rem 0; }

/* LTV calculator embed */
.ltv-calc {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  padding: 1.75rem;
  margin: 0 0 1.75rem;
  box-shadow: var(--shadow-sm);
}
.ltv-calc-title {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-text-heading);
  margin-bottom: 0.375rem;
}
.ltv-calc-sub { font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 400; line-height: 1.4; color: var(--color-text-body); margin: 0 0 1.25rem; }

.ltv-calc-inputs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.ltv-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-heading);
}
.ltv-field input {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--color-text-heading);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 0.5rem 0.65rem;
  width: 100%;
}
.ltv-field input:focus { outline: none; border-color: var(--color-accent-soft); }

.ltv-calc-results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  background: var(--color-surface-soft);
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1.75rem;
}
.ltv-result { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; text-align: center; }
.ltv-result-label {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--color-accent-strong);
}
.ltv-result-value { font-family: var(--font-sans); font-size: var(--text-lg); font-weight: 700; color: var(--color-text-heading); }

.ltv-calc-slider-group { margin-bottom: 1.25rem; }
.ltv-calc-slider-group:last-child { margin-bottom: 0; }
.ltv-slider-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.5rem;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-heading);
}
.ltv-slider-value { color: var(--color-accent); font-weight: 700; flex-shrink: 0; }

.ltv-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 0.5rem;
  border-radius: 999px;
  background: linear-gradient(to right, var(--color-accent) 0%, var(--color-accent) var(--fill, 5%), var(--color-border) var(--fill, 5%), var(--color-border) 100%);
  cursor: pointer;
}
.ltv-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--color-accent);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.ltv-slider::-moz-range-thumb {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--color-accent);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.ltv-slider:disabled { cursor: default; opacity: 0.85; }
.ltv-slider:disabled::-webkit-slider-thumb,
.ltv-slider:disabled::-moz-range-thumb { border-color: var(--color-accent-soft); }

.ltv-calc-note { font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 400; line-height: 1.4; color: var(--color-text-body); margin: 0.5rem 0 0; }

@media (max-width: 480px) {
  .ltv-calc-inputs { grid-template-columns: 1fr; }
  .ltv-calc-results { grid-template-columns: 1fr; }
}

/* Pull-quote / callout */
.callout {
  margin: 0 0 1.25rem;
  border-left: 3px solid var(--color-lavender);
  background: #F1ECF4;
  border-radius: 0 0.5rem 0.5rem 0;
  padding: 0.875rem 1.25rem;
}
.callout p { margin: 0; font-family: var(--font-serif); font-weight: 400; font-size: var(--text-md); line-height: 1.5; font-style: italic; color: var(--color-text-heading); }
.callout p:last-child { margin: 0; }
.callout .callout-src {
  margin-top: 0.5rem;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  font-style: normal;
  color: var(--color-text-body);
}

/* Horizontal bar chart */
.chart-bar-group {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 1.25rem 1.25rem 0.5rem;
  margin: 0 0 0.75rem;
  box-shadow: var(--shadow-sm);
}
.chart-bar-row {
  display: grid;
  grid-template-columns: 168px 1fr 40px;
  align-items: center;
  gap: 0.75rem;
}
.chart-bar-label { font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 600; color: var(--color-text-heading); }
.chart-bar-track { background: var(--color-surface-soft); border-radius: 999px; height: 0.875rem; overflow: hidden; }
.chart-bar-fill { height: 100%; border-radius: 999px; background: var(--color-accent); }
.chart-bar-value { font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 600; color: var(--color-text-body); text-align: right; }
.chart-note { font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 400; line-height: 1.4; color: var(--color-text-body); margin: 0.625rem 0 1.25rem; }

@media (max-width: 480px) {
  .chart-bar-row { grid-template-columns: 100px 1fr 32px; }
}

/* Diverging top-5 lists */
.top-list-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin: 0 0 0.75rem; }
.top-list-head {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--color-accent);
  margin-bottom: 0.75rem;
}
.top-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.top-list li { display: flex; gap: 0.625rem; border-bottom: 1px solid var(--color-border); padding-bottom: 0.5rem; }
.top-list li:last-child { border-bottom: none; padding-bottom: 0; }
.top-list .tl-n { font-family: var(--font-sans); font-weight: 700; color: var(--color-accent); flex-shrink: 0; width: 1.5rem; }
.top-list .tl-t { font-family: var(--font-serif); font-size: var(--text-sm); font-weight: 400; line-height: 1.4; color: var(--color-text-body); }

@media (max-width: 480px) {
  .top-list-grid { grid-template-columns: 1fr; gap: 1.25rem; }
}

/* Interactive vertical process flow diagram */
.flow-interactive {
  display: grid;
  grid-template-columns: minmax(0, 13rem) 1fr;
  gap: 1.5rem;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin: 0 0 1.75rem;
  box-shadow: var(--shadow-sm);
}

.flow-diagram-vertical {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.375rem;
}

.flow-step {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-accent-strong);
  background: var(--color-surface-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.flow-step:hover { background: var(--color-surface-soft-hover); }
.flow-step.is-active {
  background: var(--color-cta);
  color: white;
  border-color: var(--color-cta);
}

.flow-arrow-vertical {
  color: var(--color-accent);
  font-weight: 700;
  text-align: center;
  line-height: 1;
}

.flow-detail {
  border-left: 1px solid var(--color-border);
  padding-left: 1.5rem;
}
.flow-detail-label {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--color-accent);
  margin: 0 0 0.375rem;
}
.flow-detail-title {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-text-heading);
  margin: 0 0 0.5rem;
}
.flow-detail-def { font-family: var(--font-serif); font-weight: 400; font-size: var(--text-sm); line-height: 1.55; color: var(--color-text-body); margin: 0 0 0.875rem; }
.flow-detail-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--color-text-body);
  margin: 0 0 0.625rem;
}
.flow-detail-row:last-child { margin-bottom: 0; }
.flow-detail-row span:first-child {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-accent-strong);
}

@media (max-width: 640px) {
  .flow-interactive { grid-template-columns: 1fr; }
  .flow-detail { border-left: none; border-top: 1px solid var(--color-border); padding-left: 0; padding-top: 1.25rem; }
}

/* Author box, shown at the end of every article */
.author-box {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  padding: 1.5rem;
  margin: 2.5rem 0 0;
  box-shadow: var(--shadow-sm);
}
.author-box-photo {
  width: 6rem;
  height: 6rem;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.author-box-name {
  font-family: var(--font-serif);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text-heading);
  margin: 0 0 0.25rem;
}
.author-box-text { font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 400; line-height: 1.5; color: var(--color-text-body); margin: 0 0 0.625rem; }
.author-box-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--color-cta);
  text-decoration: none;
}
.author-box-cta:hover { text-decoration: underline; }

@media (max-width: 480px) {
  .author-box { flex-direction: column; align-items: flex-start; text-align: left; }
}

/* Word cloud embed */
.wordcloud-panel {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 0.5rem;
  margin: 0 0 0.75rem;
  box-shadow: var(--shadow-sm);
}
.wordcloud-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1000 / 480;
  overflow: hidden;
  border-radius: 0.5rem;
  background: radial-gradient(circle at 50% 42%, var(--color-surface-soft) 0%, transparent 60%), white;
}
.wordcloud-inner { position: absolute; top: 0; left: 0; width: 1000px; height: 480px; transform-origin: top left; }
.wc-word {
  position: absolute;
  white-space: nowrap;
  font-family: var(--font-serif);
  cursor: default;
  line-height: 1;
  transition: opacity 0.15s ease;
}
.wc-word:hover { opacity: 0.65; }
.wordcloud-caption { font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 400; line-height: 1.4; color: var(--color-text-body); margin: 0.75rem 0 1.5rem; }
