/* Research articles and the research index (scripts/build-research.mjs).
   Two voices: Ryan's words in Newsreader, data (charts, notes, dates, links) in Inter.
   Navy marks what a chart is about; grey is what it is compared with. Each finding sits
   in its own soft panel; key figures under the headline give the eye a first stop.
   No eyebrows or labels that say what something is. */
:root {
  --navy: #050E3D;
  --ink: #050E3D;
  --muted: rgba(5, 14, 61, 0.62);
  --rule: rgba(5, 14, 61, 0.14);
  --grey: #CCCAC4;
  --bg: #F6F2EA;
  --panel: #FFFDF9;
  --soft: rgba(5, 14, 61, 0.06);
  --serif: Newsreader, Georgia, serif;
  --sans: Inter, system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 19px/1.6 var(--serif); }
a { color: inherit; }

.draft { padding: 6px 20px; background: #f3e3a8; font: 500 13px/1.4 var(--sans); text-align: center; }

header.site { background: var(--navy); }
header.site .bar { max-width: 1000px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; gap: 24px; }
.lockup { display: flex; align-items: center; gap: 14px; text-decoration: none; color: #fff; }
.lockup .mark { width: 22px; height: 22px; }
.lockup span { font: 500 17px/1 var(--serif); white-space: nowrap; }
.lockup .sep { width: 1px; height: 26px; background: rgba(255, 255, 255, 0.3); }
.lockup .real { height: 22px; width: auto; }
header.site nav { margin-left: auto; display: flex; gap: 22px; font: 500 14px/1 var(--sans); }
header.site nav a { color: rgba(255, 255, 255, 0.85); text-decoration: none; }
header.site nav a:hover { color: #fff; }
@media (max-width: 560px) { header.site nav .tel, header.site nav .about { display: none; } }

/* ---------- article ---------- */
main.article { max-width: 1000px; margin: 0 auto; padding: 48px 20px 40px; display: grid; grid-template-columns: minmax(0, 620px); gap: 0 60px; }
@media (min-width: 980px) { main.article { grid-template-columns: minmax(0, 620px) 280px; } }
main.article > * { grid-column: 1; }

.trail { margin: 0 0 12px; font: 500 14px/1.2 var(--sans); }
.trail a { color: var(--muted); text-decoration: none; }
.trail a:hover { color: var(--ink); text-decoration: underline; }
h1 { margin: 0 0 14px; font: 500 clamp(32px, 4.6vw, 46px)/1.12 var(--serif); letter-spacing: -0.01em; }
.byline { margin: 0 0 28px; font: 400 14px/1.4 var(--sans); color: var(--muted); }
.byline a { text-decoration: none; color: var(--ink); }
.lede { margin: 0 0 26px; font-size: 21px; line-height: 1.55; }

/* key figures: the first stop for the eye */
.figures { list-style: none; margin: 4px 0 30px; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 620px) { .figures { grid-auto-flow: column; grid-auto-columns: 1fr; grid-template-columns: none; gap: 12px; } }
.figures a { display: block; height: 100%; padding: 16px 18px 15px; border-radius: 14px; background: var(--panel); box-shadow: 0 1px 0 var(--soft), 0 8px 24px -18px rgba(5, 14, 61, 0.35); text-decoration: none; transition: transform 0.15s ease; }
.figures a:hover { transform: translateY(-2px); }
.figures strong { display: block; font: 500 clamp(26px, 3.4vw, 34px)/1.05 var(--serif); letter-spacing: -0.01em; white-space: nowrap; }
.figures span { display: block; margin-top: 6px; font: 400 13.5px/1.4 var(--sans); color: var(--muted); }

/* video: a card on narrow screens that opens a full-screen player; a panel in the
   right column on wide ones */
.video { margin: 0 0 30px; }
.video .frame, .video .meta { display: none; }
.video-card { display: flex; align-items: center; gap: 16px; padding: 12px 18px 12px 12px; border-radius: 16px; background: var(--navy); color: #fff; text-decoration: none; box-shadow: 0 14px 30px -22px rgba(5, 14, 61, 0.7); }
.video-card .thumb { flex: none; width: 54px; aspect-ratio: 9 / 16; border-radius: 9px; overflow: hidden; background: #000; }
.video-card .thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.video-card .what { flex: 1; min-width: 0; }
.video-card strong { display: block; font: 500 20px/1.2 var(--serif); }
.video-card .what span { display: block; margin-top: 4px; font: 400 13px/1.4 var(--sans); color: rgba(255, 255, 255, 0.7); }
.video-card .play { flex: none; width: 44px; height: 44px; border-radius: 50%; background: #C9A84C; position: relative; }
.video-card .play::after { content: ""; position: absolute; left: 17px; top: 13px; border-style: solid; border-width: 9px 0 9px 14px; border-color: transparent transparent transparent var(--navy); }
@media (min-width: 980px) {
  main.article > .video { grid-column: 2; grid-row: 1 / span 6; margin: 6px 0 0; align-self: start; position: sticky; top: 24px; padding: 14px; border-radius: 20px; background: var(--panel); box-shadow: 0 1px 0 var(--soft), 0 18px 40px -28px rgba(5, 14, 61, 0.45); }
  .video-card { display: none; }
  .video .frame { display: block; aspect-ratio: 9 / 16; width: 100%; border-radius: 12px; overflow: hidden; background: #000; }
  .video .frame.wide { aspect-ratio: 16 / 9; }
  .video .meta { display: block; margin: 12px 4px 2px; font: 400 13px/1.45 var(--sans); color: var(--muted); }
  .video .meta strong { display: block; margin-bottom: 2px; font: 500 16px/1.3 var(--serif); color: var(--ink); }
}
.video iframe { display: block; width: 100%; height: 100%; border: 0; }

/* full-screen player (scripts/research.js) */
dialog.player { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; }
dialog.player::backdrop { background: rgba(3, 8, 30, 0.88); }
dialog.player .frame { position: absolute; inset: 0; margin: auto; aspect-ratio: 9 / 16; height: min(86vh, calc(92vw * 16 / 9)); border-radius: 14px; overflow: hidden; background: #000; }
dialog.player .frame.wide { aspect-ratio: 16 / 9; height: auto; width: min(94vw, 960px); }
dialog.player iframe { display: block; width: 100%; height: 100%; border: 0; }
dialog.player .close { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 14px; z-index: 1; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.14); color: #fff; font: 400 28px/44px var(--sans); cursor: pointer; }

/* findings: one soft panel each, with air between them */
.text { display: grid; gap: 22px; margin-bottom: 30px; }
.finding { padding: clamp(22px, 4vw, 34px); border-radius: 18px; background: var(--panel); box-shadow: 0 1px 0 var(--soft), 0 14px 34px -26px rgba(5, 14, 61, 0.35); scroll-margin-top: 20px; }
.finding > :last-child { margin-bottom: 0; }
.text p, .text ul, .text ol { margin: 0 0 18px; }
.text h2 { margin: 0 0 12px; font: 500 clamp(24px, 3vw, 28px)/1.22 var(--serif); letter-spacing: -0.005em; }

/* the dense numbers fold away; they stay in the page for search engines */
details.numbers { margin: 4px 0 0; border-top: 1px solid var(--rule); }
details.numbers summary { padding: 14px 0 4px; cursor: pointer; font: 500 14px/1.4 var(--sans); color: var(--muted); list-style: none; }
details.numbers summary::-webkit-details-marker { display: none; }
details.numbers summary::after { content: " +"; }
details.numbers[open] summary::after { content: " –"; }
details.numbers summary:hover { color: var(--ink); }

figure { margin: 10px 0 22px; padding: 18px 0 0; }
figcaption { margin-top: 12px; font: 400 13px/1.5 var(--sans); color: var(--muted); }

/* bars */
.bars { display: grid; gap: 14px; font-family: var(--sans); }
.bars .row { display: grid; gap: 5px; }
.bars .label { font-size: 14px; }
.bars .track { display: block; padding-right: 76px; }
.bars .bar { position: relative; display: block; height: 30px; border-radius: 0 8px 8px 0; background: var(--grey); }
.bars .bar.key { background: var(--navy); }
.bars .value { position: absolute; left: calc(100% + 10px); top: 4px; font-size: 16px; font-weight: 600; white-space: nowrap; }

/* dots: a = open (comparison), b = filled (focus) */
.dots { display: grid; gap: 22px; font-family: var(--sans); }
.dots .row { display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 12px; }
.dots .label { font-size: 14px; }
.dots .lane { position: relative; height: 34px; }
.dots .line { position: absolute; top: 15px; height: 4px; border-radius: 2px; background: var(--navy); opacity: 0.18; }
.dots .ref { position: absolute; top: -6px; bottom: -6px; width: 1px; background: var(--rule); }
.dots .dot { position: absolute; top: 8px; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; }
.dots .dot.a { border: 2px solid #A9A69F; background: var(--panel); }
.dots .dot.b { background: var(--navy); }
.dots .n { position: absolute; top: -12px; transform: translateX(-50%); font-size: 12px; white-space: nowrap; color: var(--muted); }
.dots .n.key { color: var(--ink); font-weight: 600; }
.dots .n.below { top: 28px; }
.dots.dense .n.below { top: 22px; }
.dots .change { position: absolute; top: 8px; font-size: 15px; font-weight: 600; white-space: nowrap; }
.dots.dense { gap: 10px; }
.dots.dense .lane { height: 26px; }
.dots.dense .line { top: 12px; }
.dots.dense .dot { top: 5px; }

/* trend */
svg.trend { display: block; max-width: 440px; }
svg text { font-family: var(--sans); }

/* N of 100 */
.grid { display: flex; align-items: center; gap: 22px; font-family: var(--sans); }
.grid .cells { display: grid; grid-template-columns: repeat(10, 14px); gap: 4px; flex: none; }
.grid .cells i { width: 14px; height: 14px; border-radius: 3px; background: var(--rule); }
.grid .cells i.on { background: var(--navy); }
.grid-value { margin: 0; font-size: 15px; line-height: 1.4; }
.grid-value strong { display: block; font: 500 40px/1 var(--serif); }

/* tables: quiet, for values a chart can't carry */
.text table { width: 100%; margin: 4px 0 30px; border-collapse: collapse; font: 400 14px/1.4 var(--sans); }
.text caption { caption-side: bottom; padding-top: 10px; text-align: left; font-size: 13px; color: var(--muted); }
.text th, .text td { padding: 7px 8px 7px 0; border-bottom: 1px solid var(--rule); text-align: right; }
.text th:first-child, .text td:first-child { text-align: left; }
.text thead th { font-weight: 500; color: var(--muted); }

.more { margin-top: 18px; }
.more h2 { margin: 0 0 12px; font: 500 25px/1.25 var(--serif); }
.more ul { list-style: none; margin: 0; padding: 0; }
.more li { padding: 10px 0; border-top: 1px solid var(--rule); }
.more a { display: block; text-decoration: none; font: 400 19px/1.35 var(--serif); }
.more a:hover { text-decoration: underline; }
.more span { font: 400 13px/1.4 var(--sans); color: var(--muted); }

.notes { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--rule); font: 400 13px/1.55 var(--sans); color: var(--muted); }
.notes h2 { margin: 0 0 6px; font: 600 13px/1.4 var(--sans); color: var(--ink); }
.notes p { margin: 0 0 10px; }

/* ---------- research index ---------- */
main.hub { max-width: 1060px; margin: 0 auto; padding: 56px 20px 70px; }
.hub-head { display: grid; gap: 26px; margin-bottom: 40px; align-items: center; }
@media (min-width: 900px) { .hub-head { grid-template-columns: 1fr auto; gap: 48px; } .hub-head .author { justify-self: end; } }
.hub-head h1 { margin: 0 0 12px; font-size: clamp(40px, 6vw, 60px); }
.hub-head .lede { margin: 0; max-width: 34ch; font-size: clamp(20px, 2.2vw, 23px); color: var(--ink); }
.author { display: flex; gap: 18px; align-items: center; padding: 20px 26px 20px 20px; border-radius: 18px; background: var(--panel); box-shadow: 0 1px 0 var(--soft), 0 14px 34px -26px rgba(5, 14, 61, 0.35); }
.author > img { flex: none; width: 72px; height: 72px; border-radius: 50%; object-fit: cover; object-position: center 18%; }
.author p { margin: 0; font: 400 13.5px/1.55 var(--sans); color: var(--muted); white-space: nowrap; }
.author .tagline { margin: 0 0 6px; font: italic 400 16px/1.3 var(--serif); color: var(--ink); }
.author .name { margin-bottom: 1px; font: 500 20px/1.25 var(--serif); color: var(--ink); }
.author .links { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 4px 14px; white-space: normal; }
.author .links a { color: var(--ink); font-weight: 500; text-decoration: none; border-bottom: 1px solid rgba(5, 14, 61, 0.2); }
.author .links a:hover { border-bottom-color: var(--ink); }

/* newest note, large */
.featured { display: grid; grid-template-columns: 1fr; border-radius: 22px; overflow: hidden; background: var(--panel); box-shadow: 0 1px 0 var(--soft), 0 22px 50px -34px rgba(5, 14, 61, 0.5); }
@media (min-width: 760px) { .featured { grid-template-columns: 0.9fr 1.1fr; } }
.featured .cover img { display: block; width: 100%; height: 100%; aspect-ratio: 1 / 1; object-fit: cover; object-position: center 20%; }
.featured > div { display: flex; flex-direction: column; justify-content: center; padding: clamp(24px, 4vw, 48px); }
.featured .when { margin: 0 0 12px; font: 500 13px/1.4 var(--sans); color: var(--muted); }
.featured h2 { margin: 0 0 14px; font: 500 clamp(28px, 3.4vw, 38px)/1.15 var(--serif); letter-spacing: -0.01em; }
.featured h2 a { text-decoration: none; }
.featured p { margin: 0 0 22px; }
.featured .read { align-self: start; padding: 11px 18px; border-radius: 999px; background: var(--navy); color: #fff; font: 500 14px/1 var(--sans); text-decoration: none; }
.featured .read:hover { background: #142060; }

/* the rest: image bubbles, like the homepage carousel */
.cards { list-style: none; margin: 26px 0 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.cards li { position: relative; display: flex; flex-direction: column; border-radius: 18px; overflow: hidden; background: var(--panel); box-shadow: 0 1px 0 var(--soft), 0 14px 34px -26px rgba(5, 14, 61, 0.35); transition: transform 0.15s ease; }
.cards li:hover { transform: translateY(-3px); }
.cards img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; object-position: center 20%; background: var(--navy); }
.cards li > div { display: flex; flex-direction: column; flex: 1; padding: 18px 20px 20px; }
.cards h2 { margin: 0 0 8px; font: 500 21px/1.25 var(--serif); }
.cards h2 a { text-decoration: none; }
.cards h2 a::after { content: ""; position: absolute; inset: 0; }
.cards p { flex: 1; margin: 0 0 14px; font: 400 15px/1.55 var(--sans); color: var(--muted); }
.cards span { font: 400 13px/1.4 var(--sans); color: var(--muted); }
.featured a:hover h2, .featured h2 a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* closing band */
.hub-cta { margin-top: 48px; padding: clamp(26px, 4vw, 40px); border-radius: 22px; background: var(--navy); color: #fff; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; }
.hub-cta p { margin: 0; font: 400 clamp(21px, 2.4vw, 26px)/1.3 var(--serif); }
.hub-cta a { padding: 13px 20px; border: 1px solid #C9A84C; border-radius: 999px; color: #C9A84C; font: 500 14px/1 var(--sans); text-decoration: none; white-space: nowrap; }
.hub-cta a:hover { background: #C9A84C; color: var(--navy); }

footer.site { border-top: 1px solid var(--rule); }
footer.site div { max-width: 1000px; margin: 0 auto; padding: 22px 20px 40px; font: 400 12px/1.6 var(--sans); color: var(--muted); }
footer.site a { color: var(--muted); }
