/* Step Up AVL — "The Broadsheet", research layer.
 *
 * Companion to assets/broadsheet.css (which must load first: this file uses its
 * tokens, its shared shell, and .page-head / .kicker / .standfirst / .btn-outline).
 *
 * Spec: _docs/design/broadsheet-2026-07/DELTA-v14-research-pages.md.
 *
 * Two pages:
 *   /research         the explainer. A LANDING page, not an article: cream
 *                     background, no charcoal surround, no sheet, no drop cap.
 *   /research/library the source directory. Generated by
 *                     _docs/research/insecurity-resource-library/build_library.py,
 *                     which links this file. A reskin only: the search box, the
 *                     four selects, the live count, and the card data all behave
 *                     exactly as they did.
 */

/* =============================================================== explainer */

/* The delta puts the explainer's copy in a 760px column inside the site's
 * 1140px container, so the shell's rules still span the full width. */
.research-col { max-width: 760px; padding-bottom: 44px; }

.research-col .page-head { border-bottom: 0; padding-bottom: 0; }
.research-col .page-head h1 { line-height: 1.05; }
.research-col .page-head .standfirst {
  font-size: 17px;
  margin-bottom: 16px;
}
.research-rule { border-top: 1px solid var(--ink); margin-bottom: 24px; }

.research-body {
  font-size: 18px;
  line-height: 1.65;
  color: var(--body-text);
}
.research-body p { margin: 0 0 18px; }
.research-body p strong { font-weight: 600; color: var(--text-tertiary); }
.research-body a { font-weight: 600; }

/* ------------------------------------------------------------- stat strip */

.research-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 26px;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding: 20px 0;
  margin: 26px 0 30px;
}
.research-stats .n {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 38px;
  line-height: 1;
  color: var(--article-red);
}
.research-stats .c {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.1em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-top: 7px;
}

/* -------------------------------------------------------------------- CTA */

.research-cta { text-align: center; margin: 0 0 30px; }
.research-cta .cta {
  display: inline-block;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--article-red);
  padding: 15px 28px;
  border-radius: 2px;
  transition: background 0.15s ease;
}
.research-cta .cta:hover { background: #A83D28; color: var(--paper); }
.research-cta .cta-sub {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 10px;
}

/* ------------------------------------------------------------- crossheads */

.research-crosshead {
  display: flex;
  align-items: baseline;
  gap: 14px;
  border-top: 1px solid var(--ink);
  padding-top: 22px;
  margin-top: 8px;
}
.research-crosshead .rk {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--article-red);
  white-space: nowrap;
}
.research-crosshead h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
}
.research-body .research-crosshead + p { margin-top: 16px; }

.research-sources {
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin: -4px 0 18px;
}

/* --------------------------------------------------------- the source map */

.srcmap-lead {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0 0 10px;
}
.srcmap {
  border: 1px solid var(--panel-rule);
  background: var(--panel-bg-2);
  margin: 0 0 24px;
}
.srcgrp { border-bottom: 1px solid var(--panel-rule); }
.srcgrp:last-child { border-bottom: 0; }
.srcgrp > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  background: var(--card-bg);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
}
.srcgrp > summary::-webkit-details-marker { display: none; }
.srcgrp > summary:hover { background: var(--panel-bg); }
.srcgrp .gdot { width: 11px; height: 11px; flex: none; }
.srcgrp .gtot {
  margin-left: auto;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--text-secondary);
}
.srcgrp .gchev {
  flex: none;
  font-size: 16px;
  line-height: 1;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}
.srcgrp[open] .gchev { transform: rotate(90deg); }

.srcdoms { padding: 4px 0 8px; background: var(--panel-bg-2); }
.srcdom {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 18px 7px 41px;
  border-left: 2px solid transparent;
  color: var(--text-tertiary);
}
.srcdom:hover, .srcdom:focus-visible {
  background: var(--card-bg);
  border-left-color: var(--avl-green);
  color: var(--avl-green);
  outline: none;
}
.srcdom .dname { flex: 1; font-family: var(--serif); font-size: 15.5px; line-height: 1.3; }
.srcdom .dcount {
  font-family: var(--sans);
  font-size: 11px;
  min-width: 44px;
  text-align: center;
  padding: 1px 10px;
  background: var(--card-bg);
  border: 1px solid var(--panel-rule);
  color: var(--text-secondary);
}
.srcdom:hover .dcount, .srcdom:focus-visible .dcount {
  border-color: var(--avl-green);
  color: var(--avl-green);
}

/* --------------------------------------------- the point + about this page */

.research-point {
  background: var(--spruce);
  color: #F1EBDD;
  padding: 40px 44px 42px;
  margin: 34px 0 30px;
}
.research-point .eyebrow {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #DCE5DF;
  margin-bottom: 20px;
}
.research-point .eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #4A6156;
}
.research-point h2 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 38px;
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: #F1EBDD;
  margin: 0 0 22px;
}
.research-point h2 em { font-style: italic; font-weight: 600; color: var(--gold); }
.research-point p { font-size: 17.5px; line-height: 1.7; color: #EDE7D8; margin: 0 0 16px; }
.research-point p:last-child { margin: 0; }
.research-point strong { color: #F1EBDD; font-weight: 600; }

.research-about {
  background: var(--panel-bg);
  border-top: 3px solid var(--avl-green);
  padding: 16px 20px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--body-text);
}
.research-about h4 {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--avl-green);
  margin: 0 0 7px;
}
.research-about p { margin: 0 0 8px; }
.research-about a { font-weight: 600; }
.research-about .copyright {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 14px 0 0;
}

@media (max-width: 760px) {
  .research-col .page-head h1 { font-size: 33px; }
  .research-body { font-size: 17px; }
  .research-stats { grid-template-columns: 1fr; gap: 18px; }
  .research-crosshead { flex-direction: column; gap: 6px; }
  .research-crosshead h2 { font-size: 26px; }
  .research-point { padding: 28px 20px 30px; }
  .research-point h2 { font-size: 28px; }
}

/* ================================================================= library */

.lib-page { padding: 28px 0 44px; }

.lib-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  flex-wrap: wrap;
}
.lib-head h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 42px;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
}
.lib-head h1 em { font-style: italic; font-weight: 500; color: var(--article-red); }
.lib-head .btn-outline { white-space: nowrap; }

/* No measure cap on either intro block. The 66ch/74ch caps these carried
 * stopped them at 627px and 655px inside a 1092px column, so on desktop two
 * prose blocks ended at two different arbitrary points while the rule above,
 * the stat strip and the controls all ran full width. The column is already
 * capped at 1092px, so dropping the caps bounds the line without raggedness.
 * Mobile never saw it: at 375px the caps never bound. */
.lib-sub {
  font-size: 17px;
  font-style: italic;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 10px 0 16px;
}

/* The stat strip replaces the old colored pills. #count is bound by the page's
 * own script and still reads "N / N shown". */
.lib-stats {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  align-items: baseline;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--hairline);
  padding: 10px 0;
  margin-bottom: 16px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
}
.lib-stats strong {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--deep-green);
}
.lib-stats .spacer { flex: 1; }
.lib-stats #count { font-weight: 400; color: var(--body-text); }
.lib-stats #count .vis { font-weight: 700; }
.lib-stats #count .vis.filtered { color: #c0392b; }

.lib-note {
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--body-text);
  margin: 0 0 18px;
}
.lib-note strong { font-weight: 600; color: var(--text-tertiary); }
.lib-note a { font-weight: 600; }

.lib-controls {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 22px;
}
/* Without this the selects' longest <option> sets their min-content width and
 * steals the search box's 2fr. */
.lib-controls > * { min-width: 0; }
.lib-controls input[type="search"],
.lib-controls select {
  font-family: var(--sans);
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 2px;
  outline: none;
  color: var(--text-tertiary);
}
.lib-controls input[type="search"] {
  border: 1px solid var(--ink);
  background: var(--card-bg);
  color: var(--ink);
}
.lib-controls select {
  border: 1px solid var(--hairline);
  background: var(--paper);
}

/* ----------------------------------------------------------- source cards */

.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 18px;
}
/* A grid item's implicit min-width is its min-content, and some source titles and
 * datapoint strings are long unbreakable tokens. Without these two the widest card
 * in the library sets the track width and the whole page scrolls sideways. */
.lib-grid > * { min-width: 0; }
.card {
  background: var(--card-bg);
  border: 1px solid var(--hairline);
  border-top: 3px solid var(--deep-green);
  padding: 18px 20px;
  overflow-wrap: anywhere;
}
.card h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 19px;
  line-height: 1.25;
  margin: 0 0 10px;
}
.card h3 a { color: var(--ink); }
.card h3 a:hover { color: var(--avl-green); }
.card p {
  font-family: var(--serif);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--body-text);
  margin: 0 0 12px;
}

.meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
/* Outlined by default; the tier chip fills, and the topic chip takes the gold
 * callout treatment the articles use for their eyebrow chips. */
.badge {
  border: 1px solid var(--foot-body);
  color: var(--text-tertiary);
  padding: 2px 8px;
  white-space: nowrap;
}
.badge.tier { border: 0; padding: 3px 8px; font-weight: 600; color: var(--paper); background: var(--text-secondary); }
.tier.primary-gov,
.tier.primary-intl,
.tier.primary-academic { background: var(--deep-green); }
.tier.established-research-org,
.tier.local-authority { background: var(--avl-green); }
.badge.news { border: 0; background: var(--article-red); color: var(--paper); font-weight: 600; }
.badge.cat { border-color: #C9A94E; color: var(--gold-text); font-weight: 600; }

.card .publine {
  font-family: var(--sans);
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.dps {
  border-top: 1px dotted var(--hairline);
  padding-top: 9px;
  font-family: var(--sans);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.dps span { font-weight: 600; color: var(--text-tertiary); }

.lib-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-secondary);
  padding: 40px;
}

.lib-foot {
  border-top: 1px solid var(--hairline);
  margin-top: 34px;
  padding-top: 18px;
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-secondary);
}
.lib-foot strong { color: var(--text-tertiary); }

@media (max-width: 900px) {
  .lib-controls { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .lib-head h1 { font-size: 33px; }
  .lib-controls { grid-template-columns: 1fr; }
  .lib-grid { grid-template-columns: 1fr; }
}

/* ------------------------------------------------- mobile legibility floor */

@media (max-width: 760px) {
  .research-stats .c { font-size: 12px; letter-spacing: 0.06em; }
  .research-cta .cta-sub { font-size: 13px; }
  .research-sources { font-size: 13px; }
  .srcmap-lead { font-size: 12px; letter-spacing: 0.03em; }
  .srcdom .dcount { font-size: 12px; }
  .research-about .copyright { font-size: 12px; letter-spacing: 0.03em; }
  .lib-stats { font-size: 13px; }
  .meta { font-size: 11px; letter-spacing: 0.03em; }
  .card .publine { font-size: 12.5px; }
  .dps { font-size: 12.5px; }
  .lib-foot { font-size: 13px; }
}
