/* Insights section — listing + article. Built on the same tokens as the service pages
   (clone.css defines them; service-page.css supplies the nav/footer/button classes). */

/* ---------- Listing hero ---------- */
.insights-hero { padding: 72px 0 40px; }
.insights-eyebrow { margin: 0 0 14px; color: var(--accent-blue-link); font-family: var(--font-label); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.insights-hero h1 { margin: 0; max-width: 16ch; font-family: var(--font-display); font-size: clamp(2.6rem, 4.2vw, 4rem); line-height: 1.03; letter-spacing: -.04em; }
.insights-lead { max-width: 60ch; margin: 22px 0 0; color: var(--text-body); font-size: clamp(1.02rem, 1.5vw, 1.2rem); }

/* ---------- Controls ---------- */
.insights-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; padding-block: 24px 32px; border-bottom: 1px solid var(--hairline); }
.insights-search { position: relative; flex: 1 1 260px; max-width: 360px; }
.insights-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; fill: none; stroke: var(--text-muted); stroke-width: 1.8; stroke-linecap: round; }
.insights-search input { width: 100%; min-height: 46px; padding: 0 16px 0 42px; border: 1px solid var(--hairline-strong); border-radius: var(--r-pill); background: var(--surface); color: var(--text-primary); font-family: inherit; font-size: 15px; }
.insights-search input:focus { outline: none; border-color: var(--accent-blue); }
.insights-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.insight-filter { min-height: 38px; padding: 0 16px; border: 1px solid var(--hairline-strong); border-radius: var(--r-pill); background: transparent; color: var(--text-body); font-family: inherit; font-size: 13px; cursor: pointer; transition: color .15s, border-color .15s, background .15s; }
.insight-filter:hover { color: var(--text-primary); border-color: var(--text-muted); }
.insight-filter.is-active { color: var(--accent-ember-ink); background: var(--accent-ember); border-color: var(--accent-ember); font-weight: 600; }

/* ---------- Card grid ---------- */
.insights-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; padding-block: 40px 96px; }
.insight-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--hairline); border-radius: var(--r-xl); background: var(--surface); text-decoration: none; color: inherit; transition: transform .18s ease, border-color .18s ease; }
.insight-card:hover { transform: translateY(-3px); border-color: var(--hairline-strong); }
.insight-card-media { aspect-ratio: 16 / 9; overflow: hidden; background: var(--canvas-soft); }
.insight-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.insight-card-body { display: flex; flex-direction: column; gap: 10px; padding: 22px 22px 24px; flex: 1; }
.insight-card-meta { color: var(--text-muted); font-family: var(--font-label); font-size: 12px; letter-spacing: .04em; }
.insight-card h3 { margin: 0; font-family: var(--font-display); font-size: 20px; line-height: 1.22; letter-spacing: -.02em; }
.insight-card p { margin: 0; color: var(--text-body); font-size: 14px; line-height: 1.55; }
.insight-card-tags { margin-top: auto; padding-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.insight-tag { padding: 4px 10px; border-radius: var(--r-pill); background: var(--surface-elevated); color: var(--text-body); font-family: var(--font-label); font-size: 11px; letter-spacing: .03em; }
.insights-empty { padding: 40px 0 96px; color: var(--text-muted); font-size: 16px; }

/* ---------- Article page ---------- */
.insight-article { padding: 48px 0 96px; }
.insight-article-inner { max-width: 760px; }
.insight-back { display: inline-block; margin-bottom: 28px; color: var(--text-body); font-size: 14px; text-decoration: none; }
.insight-back:hover { color: var(--text-primary); }
.insight-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 18px; }
.insight-date { color: var(--text-muted); font-family: var(--font-label); font-size: 13px; letter-spacing: .04em; }
.insight-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.insight-article h1 { margin: 0; font-family: var(--font-display); font-size: clamp(2.2rem, 3.8vw, 3.4rem); line-height: 1.06; letter-spacing: -.035em; }
.insight-lead { margin: 22px 0 0; color: var(--text-body); font-size: clamp(1.1rem, 1.7vw, 1.35rem); line-height: 1.5; }
.insight-byline { margin: 20px 0 0; color: var(--text-muted); font-family: var(--font-label); font-size: 13px; letter-spacing: .04em; }
.insight-hero-media { margin: 34px 0 0; border-radius: var(--r-xl); overflow: hidden; aspect-ratio: 16 / 8; }
.insight-hero-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.insight-body { margin-top: 40px; font-size: 1.08rem; line-height: 1.75; color: var(--text-body); }
.insight-body h2 { margin: 44px 0 14px; color: var(--text-primary); font-family: var(--font-display); font-size: 1.7rem; line-height: 1.2; letter-spacing: -.02em; }
.insight-body h3 { margin: 32px 0 10px; color: var(--text-primary); font-size: 1.25rem; }
.insight-body p { margin: 0 0 18px; }
.insight-body ul, .insight-body ol { margin: 0 0 20px; padding-left: 24px; display: grid; gap: 8px; }
.insight-body li { padding-left: 4px; }
.insight-body strong { color: var(--text-primary); }
.insight-body blockquote { margin: 28px 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--accent-blue); }
.insight-body blockquote p { margin: 0; color: var(--text-primary); font-family: var(--font-display); font-size: 1.3rem; line-height: 1.4; letter-spacing: -.01em; }
.insight-more { margin-bottom: clamp(40px, 6vw, 64px); }
.insight-more-label { margin: 0 0 20px; color: var(--text-muted); font-family: var(--font-label); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.insight-more-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }

.insight-cta { margin-top: 56px; padding: 36px; display: grid; gap: 20px; justify-items: start; border: 1px solid var(--hairline-strong); border-radius: var(--r-xl); background: var(--canvas-soft); }
.insight-cta h2 { margin: 0; font-family: var(--font-display); font-size: 1.6rem; letter-spacing: -.02em; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .insights-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .insights-grid { grid-template-columns: 1fr; }
  .insight-more-grid { grid-template-columns: 1fr; }
  .insights-controls { flex-direction: column; align-items: stretch; }
  .insights-search { max-width: none; }
}

/* ================================================================== *
 * Article reading experience (added): progress bar, TOC rail, margin
 * sidenotes, and the highlight-to-share pill. The prose styles above
 * (.insight-body h2/p/ul/blockquote…) are unchanged; this only adds the
 * surrounding layout. Wired by insights.js.
 * ================================================================== */

.insight-article { --measure: 640px; --gutter: 250px; --gutter-gap: 36px; --toc-w: 180px; --shell-gap: 44px; padding-top: 40px; }

/* Reading-progress bar under the sticky nav. */
.insight-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 70; pointer-events: none; }
.insight-progress > i { display: block; height: 100%; width: 0; background: var(--accent-blue); transition: width .1s linear; }

/* Header: centred, narrower than the body block below it. */
.insight-head { max-width: 720px; margin: 0 auto; padding: 0 24px; }
.insight-head .insight-meta { margin-top: 22px; }
.insight-head h1 { font-family: var(--font-display); font-size: clamp(2.2rem, 3.8vw, 3.4rem); line-height: 1.06; letter-spacing: -.035em; }
.insight-head .insight-hero-media { margin-top: 34px; }

/* Shell: sticky TOC + content. */
.insight-shell { max-width: calc(var(--toc-w) + var(--shell-gap) + var(--measure) + var(--gutter-gap) + var(--gutter) + 48px); margin: clamp(40px, 6vw, 64px) auto 0; padding: 0 24px; display: grid; grid-template-columns: 1fr; gap: 30px; align-items: start; }

.insight-toc { position: sticky; top: 96px; align-self: start; }
.insight-toc-label { margin: 0 0 14px; color: var(--text-muted); font-family: var(--font-label); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.insight-toc ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; border-left: 1px solid var(--hairline); }
.insight-toc a { display: block; padding: 7px 0 7px 16px; margin-left: -1px; border-left: 2px solid transparent; color: var(--text-muted); font-size: 13.5px; line-height: 1.35; text-decoration: none; transition: color .15s ease, border-color .15s ease; }
.insight-toc a:hover { color: var(--text-primary); }
.insight-toc a.is-sub { padding-left: 28px; font-size: 12.5px; }
.insight-toc a.is-active { color: var(--text-primary); border-left-color: var(--accent-blue); font-weight: 600; }

/* Content holds the prose (constrained to the measure) and, on wide screens, the sidenotes
   absolutely positioned in the gutter to its right. */
.insight-content { position: relative; }
.insight-article .insight-body { margin-top: 0; max-width: var(--measure); }
.insight-body h2 { scroll-margin-top: 90px; }
.insight-body h3 { scroll-margin-top: 90px; }

/* Sidenotes. Numbers are explicit in the markup (the build assigns them), so nothing here relies
   on CSS counters, which would break once a note is pulled out of flow. */
.insight-sidenote-ref { cursor: pointer; color: var(--accent-blue-link); font-weight: 600; font-size: .72em; vertical-align: super; line-height: 0; }
.insight-sidenote-ref:focus-visible { outline: 3px solid var(--accent-blue); outline-offset: 2px; border-radius: 3px; }
.insight-sidenote { color: var(--text-muted); font-size: 14px; line-height: 1.5; }
.insight-sidenote-num { margin-right: 6px; color: var(--accent-blue-link); font-family: var(--font-label); font-size: 11px; font-weight: 600; vertical-align: super; }
.insight-sidenote a { color: var(--accent-blue-link); }

@media (min-width: 1200px) {
  .insight-shell { grid-template-columns: var(--toc-w) minmax(0, 1fr); gap: var(--shell-gap); }
  /* Float each note level with its reference; insights.js sets `top`. */
  .insight-sidenote { position: absolute; left: calc(var(--measure) + var(--gutter-gap)); width: var(--gutter); margin: 0; }
}
@media (max-width: 1199px) {
  .insight-content { max-width: var(--measure); margin: 0 auto; }
  /* Ref becomes a toggle; the note expands inline under the paragraph. */
  .insight-sidenote { display: none; margin-top: 1.1em; padding: 14px 16px; border-left: 2px solid var(--accent-blue); background: var(--canvas-soft); border-radius: 0 var(--r-md) var(--r-md) 0; }
  .insight-sidenote.is-open { display: block; }
  .insight-toc { position: static; top: auto; }
  .insight-toc-inner { border: 1px solid var(--hairline); border-radius: var(--r-lg); background: var(--canvas-soft); }
  .insight-toc-label { margin: 0; padding: 14px 18px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
  .insight-toc-label::after { content: '⌄'; font-size: 16px; transition: transform .2s ease; }
  .insight-toc[data-open='false'] .insight-toc-label::after { transform: rotate(-90deg); }
  .insight-toc[data-open='false'] ol { display: none; }
  .insight-toc ol { border-left: 0; padding: 4px 12px 14px; }
  .insight-toc a { padding: 8px 10px; border-left: 0; border-radius: var(--r-sm); }
  .insight-toc a.is-active { background: var(--surface-elevated); border-left: 0; }
}

/* End matter: CTA in the reading measure. */
.insight-end { max-width: calc(var(--measure) + 2 * 40px); margin: clamp(56px, 8vw, 96px) auto 0; padding: 0 24px 96px; }
.insight-end .insight-cta { margin-top: 0; }

/* Highlight-to-share pill (fixed, positioned from the selection rect by insights.js). */
.insight-share { position: fixed; z-index: 90; transform: translate(-50%, -100%); margin-top: -10px; display: none; }
.insight-share.is-visible { display: block; }
.insight-share-inner { display: inline-flex; align-items: center; padding: 4px; border: 1px solid var(--glass-border); border-radius: var(--r-pill); background: var(--glass-bg); backdrop-filter: blur(14px); box-shadow: var(--shadow-elev); white-space: nowrap; }
.insight-share button { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border: 0; border-radius: var(--r-pill); background: none; color: var(--text-primary); font-family: var(--font-body); font-size: 13px; font-weight: 600; cursor: pointer; }
.insight-share button:hover { background: var(--surface-elevated); }
.insight-share svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.insight-share::after { content: ''; position: absolute; left: 50%; bottom: -6px; width: 12px; height: 12px; transform: translateX(-50%) rotate(45deg); background: var(--glass-bg); border-right: 1px solid var(--glass-border); border-bottom: 1px solid var(--glass-border); }

@media (prefers-reduced-motion: reduce) {
  .insight-progress > i { transition: none; }
}

/* Sidenote types. `note` is a numbered footnote; def/stat/ref are margin asides distinguished by
   a small kind label rather than a number. */
.insight-sidenote-kind { display: block; margin-bottom: 5px; color: var(--accent-blue-link); font-family: var(--font-label); font-size: 10px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; }
.insight-sidenote[data-kind='def'] strong { color: var(--text-primary); }
.insight-stat-value { display: block; font-family: var(--font-display); font-size: 1.9rem; line-height: 1.02; letter-spacing: -.03em; color: var(--text-primary); }
.insight-stat-label { display: block; margin-top: 5px; color: var(--text-muted); font-size: 13px; line-height: 1.45; }
.insight-sidenote-link { display: inline-flex; align-items: baseline; gap: 5px; color: var(--accent-blue-link); font-weight: 600; text-decoration: none; }
.insight-sidenote-link::after { content: '→'; transition: transform .18s ease; }
.insight-sidenote-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.insight-sidenote-link:hover::after { transform: translateX(3px); }

/* Body figures (from Notion image blocks). Sit in the reading measure; on wide screens they may
   bleed a little into the gutter so they breathe without dominating. */
.insight-figure { margin: 32px 0; }
.insight-figure img { width: 100%; height: auto; display: block; border-radius: var(--r-lg); background: var(--canvas-soft); }
.insight-figure figcaption { margin-top: 10px; color: var(--text-muted); font-size: 13px; line-height: 1.45; }
@media (min-width: 1200px) {
  /* Let a body figure extend past the text measure toward the sidenote gutter. */
  .insight-figure { width: calc(var(--measure) + var(--gutter-gap) + var(--gutter) * 0.55); max-width: none; }
}

/* Margin figures (the [[fig: …]] sidenote type). */
.insight-sidenote-img { width: 100%; height: auto; display: block; margin-bottom: 8px; border-radius: var(--r-md); background: var(--canvas-soft); }
.insight-sidenote-figcap { display: block; color: var(--text-muted); font-size: 12px; line-height: 1.45; }

/* An article with no headings drops its (empty) contents rail. */
.insight-toc.is-empty { display: none; }
