/* Articles & research: shared styles for /research and every article page.
   Loaded after /styles.css. Colours and fonts are the same as the home page. */

:root {
  color-scheme: light;
  --paper: #F4F0E8;
  --card: #FBF8F2;
  --band: #EFEAE0;
  --ink: #171410;
  --ink-2: #3c382f;
  --ink-3: #57524a;
  --muted: #6b6558;
  --hair: rgba(23, 20, 16, .14);
  --accent: #C63F16;
  --mark-gray: #8A8272;
}

.r-page { font-family: 'Space Grotesk', sans-serif; line-height: 1.5; overflow-x: hidden; }

/* ---------- nav (matches the home page) ---------- */
.r-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(12px);
  background: rgba(244, 240, 232, .82);
  border-bottom: 1px solid rgba(23, 20, 16, .1);
}
.r-nav {
  max-width: 1160px; margin: 0 auto;
  padding: 16px clamp(20px, 5vw, 44px);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.r-brand { display: flex; align-items: center; gap: 11px; font-weight: 600; letter-spacing: -.01em; font-size: 15px; }
.r-brand-mark {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--ink); color: var(--paper);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; font-family: 'Newsreader', serif;
}
.r-links { display: flex; align-items: center; gap: clamp(14px, 3vw, 30px); flex-wrap: wrap; }
.r-links a { font-size: 14px; color: #5c564b; }
.r-links a:hover { color: var(--ink); }
.r-links a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.r-links a.r-cta {
  font-weight: 500; color: var(--ink);
  padding: 9px 18px; border: 1px solid var(--ink); border-radius: 100px; transition: .2s;
}
.r-links a.r-cta:hover { background: var(--ink); color: var(--paper); }

.r-kicker {
  font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); font-weight: 600;
}

/* ---------- research index ---------- */
.r-index { max-width: 1160px; margin: 0 auto; padding: clamp(48px, 8vw, 96px) clamp(20px, 5vw, 44px) clamp(56px, 8vw, 104px); }
.r-index h1 {
  font-family: 'Newsreader', serif; font-weight: 300;
  font-size: clamp(34px, 5.4vw, 60px); line-height: 1.05; letter-spacing: -.02em;
  margin-top: 18px; max-width: 16em; text-wrap: balance;
}
.r-index .lede { font-size: clamp(16px, 1.6vw, 18.5px); color: #4a453c; max-width: 36em; margin-top: 20px; line-height: 1.6; }
.r-list { display: grid; gap: 16px; margin-top: clamp(32px, 5vw, 56px); }

.r-card {
  display: block; background: var(--card);
  border: 1px solid var(--hair); border-radius: 16px;
  padding: clamp(22px, 3.4vw, 34px); transition: .25s;
}
.r-card:hover { transform: translateY(-4px); box-shadow: 0 14px 34px rgba(23, 20, 16, .09); }
.r-card-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.r-card-meta .r-tag { letter-spacing: .1em; text-transform: uppercase; color: var(--accent); font-weight: 600; font-size: 12px; }
.r-card h2, .r-card h3 {
  font-family: 'Newsreader', serif; font-weight: 400;
  font-size: clamp(24px, 3vw, 34px); line-height: 1.14; letter-spacing: -.01em;
  margin-top: 14px; max-width: 22em; text-wrap: balance;
}
.r-card p { font-size: 15.5px; color: var(--ink-3); line-height: 1.6; margin-top: 12px; max-width: 46em; }
.r-card-facts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.r-card-facts span { font-size: 13px; padding: 6px 12px; background: var(--band); border-radius: 100px; color: var(--ink-2); }
.r-card-more { display: inline-block; margin-top: 20px; font-size: 14px; font-weight: 600; color: var(--accent); }
.r-note { font-size: 14px; color: var(--muted); margin-top: 22px; }

/* ---------- article ---------- */
.article { max-width: 760px; margin: 0 auto; padding: clamp(40px, 7vw, 84px) clamp(20px, 5vw, 44px) clamp(56px, 8vw, 96px); }
.article-back { font-size: 13.5px; color: var(--muted); font-weight: 500; }
.article-back:hover { color: var(--ink); }
.article h1 {
  font-family: 'Newsreader', serif; font-weight: 300;
  font-size: clamp(36px, 5.8vw, 62px); line-height: 1.04; letter-spacing: -.02em;
  margin-top: 16px; text-wrap: balance;
}
.article h1 em { font-style: italic; color: var(--accent); }
.article .dek { font-size: clamp(17px, 1.9vw, 20.5px); color: var(--ink-3); line-height: 1.55; margin-top: 20px; max-width: 34em; }
.article .byline {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  font-size: 13.5px; color: var(--muted); margin-top: 22px;
  padding-bottom: 26px; border-bottom: 1px solid var(--hair);
}
.article .byline b { color: var(--ink); font-weight: 600; }
.article .byline i { font-style: normal; opacity: .45; }

.prose p, .prose li {
  font-family: 'Newsreader', serif; font-weight: 400;
  font-size: clamp(18.5px, 1.6vw, 20px); line-height: 1.62; color: var(--ink-2);
}
.prose p { margin-top: 1.05em; text-wrap: pretty; }
.prose h2 {
  font-family: 'Newsreader', serif; font-weight: 400;
  font-size: clamp(27px, 3.2vw, 36px); line-height: 1.14; letter-spacing: -.012em;
  color: var(--ink); margin-top: 2em; text-wrap: balance;
}
.prose ul { margin: .7em 0 0; padding-left: 1.15em; }
.prose li { margin-top: .5em; padding-left: .15em; }
.prose li::marker { color: var(--accent); }
.prose strong { font-weight: 500; color: var(--ink); }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose .lead { font-size: clamp(20px, 2vw, 23px); line-height: 1.5; color: var(--ink); margin-top: 1.3em; }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 2em; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--hair); border-radius: 14px; padding: 18px 18px 20px; }
.stat-value { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: clamp(27px, 3.4vw, 34px); letter-spacing: -.02em; color: var(--ink); line-height: 1.05; }
.stat-label { font-size: 13px; color: var(--ink-3); line-height: 1.45; margin-top: 9px; }

/* figures */
.fig { margin: 2.1em 0 0; background: var(--card); border: 1px solid var(--hair); border-radius: 16px; padding: clamp(18px, 3vw, 28px); }
.fig-title { font-weight: 600; font-size: 16px; color: var(--ink); line-height: 1.35; }
.fig-sub { font-size: 13.5px; color: var(--muted); line-height: 1.5; margin-top: 4px; }
.fig figcaption { font-size: 13px; color: var(--muted); line-height: 1.55; margin-top: 16px; }
.prose .fig + ul, .prose .fig + p { margin-top: 1.5em; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; font-size: 13px; color: var(--ink-3); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; background: var(--mark-gray); display: inline-block; }
.legend i.hi { background: var(--accent); }

/* horizontal bars: one row per item, value at the bar tip */
.bars { margin-top: 16px; display: grid; gap: 4px; }
.bar-row {
  display: grid; grid-template-columns: minmax(118px, 36%) 1fr; gap: 12px; align-items: center;
  padding: 5px 6px; border-radius: 8px; transition: background .15s;
}
.bar-row:hover, .bar-row:focus-visible { background: rgba(23, 20, 16, .05); }
.bar-row:focus { outline: none; }
.bar-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.data summary:focus-visible, .r-card:focus-visible, .article-back:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.bar-label { font-size: 13.5px; color: var(--ink-2); line-height: 1.3; }
.bar-label b { font-weight: 600; color: var(--ink); }
.bar-label small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.bar-track { display: flex; align-items: center; min-height: 22px; border-left: 1px solid rgba(23, 20, 16, .28); }
.bar-fill {
  height: 18px; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--mark-gray);
  width: calc((100% - 62px) * var(--v) / var(--max, 100));
}
.bar-fill.hi { background: var(--accent); }
.bar-val { font-size: 13.5px; font-weight: 600; color: var(--ink); margin-left: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* bars that go both ways from a zero line */
.dbar-track { position: relative; height: 22px; }
.dbar-zero { position: absolute; top: -3px; bottom: -3px; left: var(--zero); width: 1px; background: rgba(23, 20, 16, .28); }
.dbar-fill { position: absolute; top: 2px; height: 18px; background: var(--accent); min-width: 2px; }
.dbar-fill.pos { left: var(--zero); border-radius: 0 4px 4px 0; }
.dbar-fill.neg { border-radius: 4px 0 0 4px; }
.dbar-val { position: absolute; top: 0; line-height: 22px; font-size: 13.5px; font-weight: 600; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* tables: the plain-number twin of every chart, and small result tables */
.data { margin-top: 14px; }
.data summary { cursor: pointer; font-size: 13px; font-weight: 500; color: var(--ink-3); width: fit-content; }
.data summary:hover { color: var(--ink); }
.table-wrap { overflow-x: auto; margin-top: 10px; }
.rtable { border-collapse: collapse; width: 100%; font-size: 13.5px; color: var(--ink-2); }
.rtable th, .rtable td { text-align: left; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--hair); vertical-align: top; line-height: 1.4; }
.rtable th { font-weight: 600; color: var(--muted); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.rtable td.num, .rtable th.num { text-align: right; padding-right: 0; padding-left: 12px; font-variant-numeric: tabular-nums; }
.rtable td.num { white-space: nowrap; }
.rtable tr:last-child td, .rtable tr:last-child th { border-bottom: none; }
.rtable td b { color: var(--ink); font-weight: 600; }

/* diagram */
.diagram { display: block; width: 100%; max-width: 520px; height: auto; margin: 18px auto 0; }
.diagram text { font-family: 'Space Grotesk', sans-serif; }

/* ---------- technical report pieces ---------- */
.abstract { margin-top: 1.9em; background: var(--card); border: 1px solid var(--hair); border-left: 3px solid var(--accent); border-radius: 12px; padding: 20px 24px 22px; }
.abstract .label, .callout .label { font-family: 'Space Grotesk', sans-serif; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.prose .abstract p { margin-top: 8px; font-size: clamp(17px, 1.5vw, 18.5px); line-height: 1.6; color: var(--ink-2); }
.prose h3 { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: clamp(19px, 2vw, 21px); line-height: 1.3; letter-spacing: -.005em; color: var(--ink); margin-top: 1.9em; }
.prose h2 + h3 { margin-top: .9em; }
.callout { margin-top: 2.2em; background: var(--ink); border-radius: 16px; padding: 22px 26px 24px; }
.callout .label { color: #E9814F; }
.prose .callout p { color: #ece6db; margin-top: 8px; }
.fig-num { font-weight: 700; color: var(--ink-2); }
.fig figcaption b { font-weight: 700; font-size: 11.5px; letter-spacing: .08em; color: var(--ink-2); }
.fig figcaption a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.fig.wide { width: min(1080px, calc(100vw - 40px)); position: relative; left: 50%; transform: translateX(-50%); }
.diagram.arch { max-width: none; width: 100%; margin-top: 4px; }
.only-narrow { display: none; }
@media (max-width: 760px) { .only-wide { display: none; } .only-narrow { display: block; } }
.rtable.spec th { text-transform: none; letter-spacing: 0; font-size: 13.5px; color: var(--ink); width: 112px; white-space: nowrap; }
.rtable.spec td { color: var(--ink-2); }
.fig > .table-wrap:first-child { margin-top: 0; }

/* ---------- more report visuals ---------- */
:root { --blue: #1C75A8; }
.stats.six { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) { .stats.six { grid-template-columns: repeat(3, 1fr); } }
.stats.six .stat-value { font-size: clamp(24px, 3vw, 30px); }
.callout.light { background: var(--card); border: 1px solid var(--hair); border-left: 3px solid var(--accent); }
.callout.light .label { color: var(--accent); }
.prose .callout.light p { color: var(--ink-2); }
.callout.result { background: var(--card); border: 1.5px solid rgba(198, 63, 22, .45); }
.callout.result .label { color: var(--accent); }
.prose .callout.result p { color: var(--ink-2); }
.prose .fig + .callout { margin-top: 1.4em; }

/* small multiples: one panel per question type */
.sm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 34px; margin-top: 16px; }
@media (max-width: 640px) { .sm-grid { grid-template-columns: 1fr; gap: 14px; } }
.sm-title { font-size: 14px; font-weight: 600; color: var(--ink); padding: 0 6px; }
.sm-title span { font-weight: 400; color: var(--muted); margin-left: 6px; }
.bars.sm { margin-top: 6px; gap: 2px; }
.bars.sm .bar-row { grid-template-columns: 172px 1fr; gap: 10px; padding: 3px 6px; }
.bars.sm .bar-label { font-size: 13px; }
.bars.sm .bar-fill { height: 15px; width: calc((100% - 54px) * var(--v) / var(--max, 100)); }
.bars.sm .bar-val { font-size: 13px; margin-left: 6px; }
@media (max-width: 560px) { .bars.sm .bar-row { grid-template-columns: 128px 1fr; gap: 8px; padding: 3px 4px; } }
.bar-label small.inline { display: inline; margin-left: 4px; }

/* line chart and diagrams drawn in SVG */
.lchart, .ediag { display: block; width: 100%; height: auto; margin-top: 10px; }
.lchart text, .ediag text { font-family: 'Space Grotesk', sans-serif; }
.lchart [data-tip] { cursor: default; outline: none; }
.lchart [data-tip]:focus-visible circle, .lchart [data-tip]:focus-visible rect { stroke: var(--ink); stroke-width: 2.5; }
.legend .sw { display: inline-block; width: 30px; height: 14px; vertical-align: middle; }

/* hover / focus readout for chart rows */
.tip {
  position: fixed; z-index: 80; pointer-events: none; max-width: 260px;
  background: var(--ink); color: var(--paper); border-radius: 10px;
  padding: 9px 12px; font-family: 'Space Grotesk', sans-serif; font-size: 12.5px; line-height: 1.45;
  box-shadow: 0 10px 30px rgba(23, 20, 16, .25); opacity: 0; transition: opacity .12s;
}
.tip.on { opacity: 1; }
.tip b { display: block; font-size: 15px; font-weight: 600; }
.tip span { color: #cfc8ba; }

/* closing box and footer */
.next { margin-top: 2.4em; border: 1px solid rgba(198, 63, 22, .28); background: linear-gradient(180deg, #FBF8F2, #F4F0E8); border-radius: 16px; padding: clamp(22px, 3.4vw, 32px); }
.next h2 { margin-top: 0; }
.next .btn-dark { display: inline-block; margin-top: 20px; font-family: 'Space Grotesk', sans-serif; font-size: 15px; font-weight: 600; padding: 13px 24px; background: var(--ink); color: var(--paper); border-radius: 100px; transition: .2s; text-decoration: none; }

.r-footer { background: var(--band); border-top: 1px solid rgba(23, 20, 16, .12); }
.r-footer div {
  max-width: 1160px; margin: 0 auto; padding: 26px clamp(20px, 5vw, 44px);
  display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--muted);
}
.r-footer a:hover { color: var(--ink); }

@media (max-width: 560px) {
  .bar-row { grid-template-columns: 1fr; gap: 4px; padding: 7px 6px; }
  .rtable { font-size: 12.5px; }
  .rtable th { font-size: 10.5px; letter-spacing: 0; }
  .rtable th, .rtable td { padding: 7px 8px 7px 0; }
  .rtable td.num, .rtable th.num { padding-left: 8px; }
}

/* nav on small phones: keep the five links on one row */
@media (max-width: 380px) {
  .r-links { gap: 10px; }
  .r-links a { font-size: 13px; }
  .r-links a.r-cta { padding: 8px 12px; }
}
@media (max-width: 340px) {
  .r-links { gap: 8px; }
  .r-links a { font-size: 12.5px; }
  .r-links a.r-cta { padding: 7px 10px; }
}
