/* Media-first study pages: clips and stills from the studies' own replays, sections folded
   into <details> (readable without JavaScript), and the research index's card grid.
   Builds on ../style.css; used by every page under studies/. */

/* Clips and stills. A wide figure leaves the text column on a wide screen. */
.study figure.clip, .study figure.still { margin: 2rem 0; }
.study .clip video, .study .clip img, .study .still img { display: block; width: 100%; height: auto;
  border-radius: var(--media-radius); background: var(--surface); box-shadow: var(--media-shadow); }
.study .clip figcaption, .study .still figcaption { margin-top: .8rem; color: var(--muted); font-size: var(--t-small);
  line-height: 1.55; }
.study .clip figcaption b, .study .still figcaption b { color: var(--ink); font-weight: 600; }
@media (min-width: 1000px) {
  .study figure.wide { width: min(1160px, calc(100vw - 64px)); position: relative; left: 50%; transform: translateX(-50%); }
  .study figure.wide figcaption { max-width: 760px; margin-left: auto; margin-right: auto; }
}
.study .lede-short { font-size: var(--t-title); color: var(--muted); line-height: 1.5; max-width: 60ch; }

/* Folded sections: the heading and a one-line gist stay on the page; the body opens. */
.study details.fold { border-top: 1px solid var(--line); margin: 0; }
.study details.fold:last-of-type { border-bottom: 1px solid var(--line); }
.study details.fold > summary { list-style: none; cursor: pointer; padding: 1.1rem 2rem 1.1rem 0; position: relative; margin: 0; }
.study details.fold > summary::-webkit-details-marker { display: none; }
.study details.fold > summary::after { content: "+"; position: absolute; right: .25rem; top: 1rem; font-size: 1.4rem;
  line-height: 1; color: var(--muted); font-weight: 300; }
.study details.fold[open] > summary::after { content: "−"; }
.study details.fold > summary h2 { margin: 0; font-size: 1.05rem; display: block; color: var(--ink); }
.study details.fold .fold-gist { display: block; margin-top: .3rem; font-size: var(--t-small); color: var(--muted); line-height: 1.5; }
.study details.fold > .fold-body { padding: 0 0 1.5rem; }
.study details.fold + :not(details) { margin-top: 2.5rem; }
.study details.more { margin: .6rem 0 0; }
.study details.more > summary { cursor: pointer; font-size: var(--t-small); color: var(--muted); }
.study details.more > .fold-body { margin-top: .4rem; }

/* Key numbers in one row. */
.study .keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem 1.5rem; margin: 1.5rem 0 2rem; }
.study .keys b { display: block; font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2.1rem); font-weight: 550; letter-spacing: -.04em;
  line-height: 1.05; color: var(--ink); font-variant-numeric: tabular-nums; }
.study .keys span { display: block; font-size: var(--t-small); color: var(--muted); margin-top: .35rem; line-height: 1.4; }

/* The research index: a grid of studies, each led by a picture. */
main.study.research-index { max-width: 1120px; }
.research-index .study-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 1.25rem;
  margin: 1.25rem 0 3rem; }
.research-index .study-card { display: flex; flex-direction: column; text-decoration: none; color: inherit;
  border: 1px solid var(--line); border-radius: var(--media-radius); overflow: hidden; background: var(--bg);
  transition: border-color .15s ease, transform .15s var(--ease); }
.research-index .study-card:hover { border-color: var(--muted); transform: translateY(-2px); }
.research-index .study-grid.two { grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); }
.research-index .study-card .thumb { aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface); position: relative; }
.research-index .study-card .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: left top; display: block; }
.research-index .study-card .thumb video { width: 100%; height: 100%; object-fit: contain; display: block; }
.research-index .study-card .thumb svg { width: 100%; height: 100%; display: block; }
.research-index .study-card .thumb .kind { position: absolute; right: .6rem; top: .6rem; padding: .15rem .5rem; border-radius: 999px;
  background: var(--bar); color: var(--ink-2); font-size: .72rem; backdrop-filter: blur(6px); }
.research-index .study-card .text { padding: 1rem 1.1rem 1.15rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.research-index .study-card b { color: var(--ink); font-weight: 600; font-size: 1.05rem; letter-spacing: -.01em; line-height: 1.3; }
.research-index .study-card span { color: var(--muted); font-size: var(--t-small); line-height: 1.5; }
.research-index .study-card .num { margin-top: auto; padding-top: .5rem; display: flex; align-items: baseline; gap: .5rem; }
.research-index .study-card .num strong { white-space: nowrap; font-size: 1.5rem; font-weight: 550; letter-spacing: -.03em; color: var(--ink);
  font-variant-numeric: tabular-nums; }
.research-index .study-card .num em { font-style: normal; font-size: .78rem; color: var(--faint); line-height: 1.35; }
.research-index .lede { max-width: 62ch; }

/* The factor registry as a grid: one square per factor, by measurement kind. */
.factor-map { margin: 1rem 0 .5rem; display: grid; gap: .55rem; }
.factor-map .fm-row { display: grid; grid-template-columns: 8.5rem 1fr; gap: .75rem; align-items: center; font-size: var(--t-small); }
.factor-map .fm-row > span { color: var(--ink-2); }
.factor-map .fm-row > span small { color: var(--faint); margin-left: .3rem; }
.factor-map .fm-cells { display: flex; flex-wrap: wrap; gap: 4px; }
.factor-map i { width: 16px; height: 16px; border-radius: 3px; background: var(--surface-2); display: block; }
.factor-map i.benchmarked { background: var(--holds); }
.factor-map i.null { background: var(--faint); }
.factor-map i.hypothesis { background: transparent; box-shadow: inset 0 0 0 1.5px var(--faint); }
.factor-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; font-size: .8rem; color: var(--muted); margin: .5rem 0 0; }
.factor-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.factor-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; background: var(--surface-2); }
.factor-legend i.benchmarked { background: var(--holds); } .factor-legend i.null { background: var(--faint); }
.factor-legend i.hypothesis { background: transparent; box-shadow: inset 0 0 0 1.5px var(--faint); }
@media (max-width: 560px) { .factor-map .fm-row { grid-template-columns: 1fr; gap: .3rem; } }

/* A fork's branches as a grid of real frames (forking and policy-checks pages). */
.study .branch-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 2rem 0 .5rem; }
.study .branch-grid figure.still { margin: 0; }
.study .branch-grid figcaption { margin-top: .5rem; }
.study .branch-note { font-size: var(--t-small); }
@media (max-width: 560px) { .study .branch-grid { grid-template-columns: minmax(0, 1fr); } }
