/* ========================================================
   500x — Insights
   Shared stylesheet for the insights index and the long-form
   article pages under /insights/blogs/<slug>/.

   Built on the same tokens as case_study.css so an article
   and a case study are recognisably the same site: the same
   near-black ground, the same three type roles (Space Grotesk
   display, Inter body, JetBrains Mono labels), the same nav
   and footer furniture. What differs is the job — a case
   study is a sequence of full-bleed images, an article is a
   single column of text you read top to bottom. So the
   measure is capped at ~68ch and everything else gets out
   of its way.
   ======================================================== */

:root {
  --bg: #0a0a0a;
  --bg-card: #111111;
  --bg-elev: #1a1a1a;
  --ink: #f4f4f0;
  --ink-soft: #a8a8a4;
  --ink-faint: #6b6b68;
  --line: #1f1f1f;
  --line-soft: #2a2a2a;
  --grad: linear-gradient(135deg, #7a3fa8 0%, #2a5cdb 50%, #d94a5e 100%);
  --display: 'Space Grotesk', 'Inter', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --max: 1400px;
  --gutter: 32px;
  --measure: 68ch;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* The reading column. Everything in the article body sits in
   one of these so the measure is enforced in exactly one place. */
.measure {
  max-width: var(--measure);
  margin-left: auto;
  margin-right: auto;
  padding: 0 var(--gutter);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
  font-weight: 500;
}

/* ---------- Nav (matches case_study.css) ---------- */
nav.top {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  backdrop-filter: blur(16px);
  background: rgba(10, 10, 10, 0.5);
  transition: background 0.3s;
}
nav.top.scrolled { background: rgba(10, 10, 10, 0.85); border-bottom: 1px solid var(--line); }
nav.top .brand-mark { height: 32px; }
nav.top .back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  transition: color 0.2s;
}
nav.top .back-link:hover { color: var(--ink); }
nav.top .back-link .arrow { transition: transform 0.3s; }
nav.top .back-link:hover .arrow { transform: translateX(-4px); }

/* ---------- Article masthead ---------- */
.article-head { padding: 180px 0 0; }
.article-head .eyebrow { display: block; margin-bottom: 26px; }
.article-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(38px, 5.4vw, 68px);
  letter-spacing: -0.035em;
  line-height: 1.04;
  margin-bottom: 28px;
  max-width: 20ch;
}
.article-dek {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(19px, 2vw, 24px);
  line-height: 1.45;
  letter-spacing: -0.012em;
  color: var(--ink-soft);
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  margin-top: 36px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.article-meta .sep { color: var(--line-soft); }
.article-meta .by { color: var(--ink-soft); }

/* ---------- Lead image ---------- */
.article-figure {
  max-width: 1100px;
  margin: 64px auto 0;
  padding: 0 var(--gutter);
}
.article-figure .frame {
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-elev);
  aspect-ratio: 1380 / 776;
}
.article-figure img { width: 100%; height: 100%; object-fit: cover; display: block; }
.article-figure figcaption {
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------- Article body ---------- */
/* Vertical padding only — these elements also carry .measure, and a
   padding shorthand here would silently wipe its horizontal gutter. */
.article-body { padding-top: 88px; padding-bottom: 40px; }
.article-body > * + * { margin-top: 24px; }

.article-body h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(26px, 2.9vw, 34px);
  letter-spacing: -0.022em;
  line-height: 1.15;
  color: var(--ink);
  margin-top: 76px;
  margin-bottom: 4px;
}
.article-body h2::before {
  content: '';
  display: block;
  width: 40px;
  height: 1px;
  background: var(--line-soft);
  margin-bottom: 26px;
}
.article-body h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(19px, 1.6vw, 21px);
  letter-spacing: -0.012em;
  line-height: 1.3;
  color: var(--ink);
  margin-top: 44px;
  margin-bottom: 2px;
}
.article-body p {
  font-size: 17px;
  line-height: 1.72;
  color: var(--ink-soft);
}
.article-body p strong { color: var(--ink); font-weight: 600; }
.article-body p em { color: var(--ink); font-style: italic; }
.article-body a[href] {
  color: var(--ink);
  border-bottom: 1px solid var(--line-soft);
  transition: border-color 0.2s;
}
.article-body a[href]:hover { border-bottom-color: var(--ink); }

.article-body ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.article-body li {
  position: relative;
  padding-left: 26px;
  font-size: 17px;
  line-height: 1.72;
  color: var(--ink-soft);
}
.article-body li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 0.72em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-faint);
}
.article-body li strong { color: var(--ink); font-weight: 600; }

/* Enumerated points that the source set as indented paragraphs rather than a
   list. Kept as <p> so the transcription stays word-for-word; the indent is
   what carries the nesting. */
.article-body p.indent { padding-left: 26px; }

/* ---------- In-body figures ---------- */
/* These sit inside .article-body.measure, so they take the reading width
   rather than the full-bleed width of the lead .article-figure. No fixed
   aspect-ratio: the sources are not all one shape. */
.article-body .body-figure {
  margin-top: 44px;
  margin-bottom: 44px;
}
.article-body .body-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: var(--bg-elev);
}

/* ---------- Article foot ---------- */
.article-foot {
  padding-top: 60px;
  margin-top: 40px;
}
.article-foot .rule { border-top: 1px solid var(--line); padding-top: 26px; }
.article-foot .note {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------- Index hero ---------- */
.index-head { padding: 180px 0 0; }
.index-head .eyebrow { display: block; margin-bottom: 26px; }
.index-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(52px, 9vw, 132px);
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin-bottom: 32px;
}
.index-lede {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(20px, 2.2vw, 27px);
  line-height: 1.42;
  letter-spacing: -0.014em;
  color: var(--ink-soft);
  max-width: 42ch;
}
.index-count {
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------- Card grid (index + "more insights") ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 56px 40px;
}
.card-grid.two-up { grid-template-columns: repeat(3, 1fr); }
.index-grid { padding: 80px 0 40px; }

.card { display: block; }
.card .thumb {
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-elev);
  aspect-ratio: 16 / 9;
  margin-bottom: 20px;
}
.card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.82);
  transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.5s;
}
.card:hover .thumb img { transform: scale(1.04); filter: saturate(1); }
.card .card-meta {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}
.card h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 21px;
  letter-spacing: -0.018em;
  line-height: 1.22;
  color: var(--ink);
  margin-bottom: 10px;
  transition: color 0.2s;
}
.card:hover h3 { color: #fff; }
.card p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 42ch;
}

/* ---------- "More insights" band ---------- */
.more { padding: 120px 0 40px; }
.more .head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
  padding-top: 28px;
  margin-bottom: 56px;
}
.more .head h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(26px, 3vw, 38px);
  letter-spacing: -0.026em;
  line-height: 1;
}
.more .head a {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  transition: color 0.2s;
}
.more .head a:hover { color: var(--ink); }

/* ---------- Footer (matches case_study.css) ---------- */
footer { border-top: 1px solid var(--line); padding: 56px 0 28px; background: var(--bg); margin-top: 120px; }
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
.footer-brand .brand-mark { height: 38px; }
.footer-brand .place { margin-top: 16px; font-size: 14px; color: var(--ink-soft); max-width: 32ch; }
.footer-brand .email { margin-top: 16px; font-size: 14px; font-weight: 500; }
.footer-col h5 {
  font-family: var(--mono);
  font-size: 11px; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 14px;
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer-col a { font-size: 13px; color: var(--ink-soft); transition: color 0.2s; }
.footer-col a:hover { color: var(--ink); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--ink-faint);
  font-family: var(--mono);
  letter-spacing: 0.06em;
}

/* ---------- Reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.9s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.reveal.in { opacity: 1; transform: translateY(0); }

/* ========================================================
   Responsive
   ======================================================== */
@media (max-width: 900px) {
  :root { --gutter: 20px; }

  nav.top { padding: 16px 20px; }
  nav.top .brand-mark { height: 26px; }

  .article-head { padding-top: 128px; }
  .article-title { max-width: none; }
  .article-meta { gap: 12px; font-size: 10px; letter-spacing: 0.1em; }

  .article-figure { margin-top: 40px; }
  .article-body { padding-top: 56px; }
  .article-body h2 { margin-top: 56px; }
  .article-body h2::before { margin-bottom: 20px; }
  .article-body h3 { margin-top: 34px; }
  .article-body p, .article-body li { font-size: 16px; }

  .index-head { padding-top: 128px; }
  .index-grid { padding-top: 56px; }

  .card-grid, .card-grid.two-up { grid-template-columns: 1fr; gap: 44px; }
  .more { padding-top: 80px; }
  .more .head { margin-bottom: 36px; }

  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-bottom { flex-direction: column; gap: 10px; }
}

@media (max-width: 600px) {
  .card-grid, .card-grid.two-up { grid-template-columns: 1fr; }
}

/* ========================================================
   Reduced motion
   Anything that moves here is decoration. Under
   prefers-reduced-motion the reveal has to resolve to the
   visible state rather than simply stop animating, or the
   whole article stays at opacity 0.
   ======================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .card .thumb img { transition: none; }
  .card:hover .thumb img { transform: none; }
  nav.top .back-link .arrow { transition: none; }
  nav.top .back-link:hover .arrow { transform: none; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
}

/* Space Grotesk ships no italic, so a UA-default <em> renders as a
   synthesised oblique. Emphasis is tone here, never slant. */
em { font-style: normal; }

/* Body media must never exceed the measure. The scrollytelling article carries
   a <video> with intrinsic width attributes, which overflowed on phones. */
.article-body video.body-figure,
.article-body img.body-figure,
.article-body video,
.article-body img { max-width: 100%; height: auto; }
video.body-figure { display: block; margin: 34px auto; border-radius: 8px; }
