/*
 * The public survey library in Velocity's house identity, shared by the library, the provider pages and the discovery
 * directory. Tokens follow site/src/styles/global.css and src/index.css (design_01: a cool grey ground, white content,
 * ink, Velocity blue for the action, focus and the result that matters). Headlines are IBM Plex Serif, text Plus
 * Jakarta Sans, figures JetBrains Mono only where they are data. Chart colours are the app's viz tokens: slate for a
 * single series, the brick ↔ steel scale only where a question's favourable end is declared
 * (question-scales.json), a neutral ordered ramp for ordered answers of unknown polarity.
 */
@import url('/fonts/app/fonts.css');
@font-face {
  font-family: 'IBM Plex Serif';
  font-style: normal;
  font-weight: 500 600;
  font-display: swap;
  /* SIL Open Font License 1.1: public/fonts/report/OFL.txt */
  src: url('/fonts/report/IBMPlexSerif-SemiBold.ttf') format('truetype');
}

:root {
  --ground: #f6f8fa;
  --panel: #ffffff;
  --tint: #f1f4f7;
  --rail: #eef2f5;
  --ink: #17212b;
  --ink-2: #52606d;
  --ink-3: #66727f;
  --line: #d9e1e7;
  --line-soft: #e5ebef;
  --accent: #245fa7;
  --accent-ink: #1c4d89;
  --accent-wash: #eaf1fa;
  --navy: #0f1b2d;
  --on-navy: #b9c3d1;
  --on-navy-faint: #8693a7;
  --slate: #6c7680;
  --grid: rgba(23, 33, 43, 0.08);
  --axis: #abb8c2;
  --caution: #a15c07;

  --serif: 'IBM Plex Serif', Georgia, serif;
  --sans: 'Plus Jakarta Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;

  --t-small: 14px;
  --t-body: 17px;
  --t-lead: 20px;
  --t-h3: clamp(22px, 2.2vw, 26px);
  --t-h2: clamp(28px, 3.2vw, 38px);
  --t-h1: clamp(36px, 5vw, 60px);

  --shadow-sm: 0 1px 2px rgba(23, 33, 43, 0.06);
  --shadow-md: 0 1px 2px rgba(23, 33, 43, 0.05), 0 8px 22px -8px rgba(23, 33, 43, 0.16);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 12px;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 var(--t-body) / 1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
  /* The footer sits at the foot of a short page. */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body > main {
  flex: 1 0 auto;
}
::selection {
  background: #cfe0f5;
}
img,
svg,
canvas {
  display: block;
  max-width: 100%;
}
a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover {
  color: var(--accent-ink);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.015em;
  text-wrap: balance;
  color: var(--ink);
  line-height: 1.15;
}
p,
ul,
ol,
figure,
dl,
dd {
  margin: 0;
}
p {
  text-wrap: pretty;
}
[hidden] {
  display: none !important;
}
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ── Header: the site's, with the library's own places ── */
.lib-head {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(246, 248, 250, 0.86);
  backdrop-filter: saturate(1.5) blur(12px);
  -webkit-backdrop-filter: saturate(1.5) blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.lib-head .wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 60px;
}
.lib-brand-group {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-right: auto;
  white-space: nowrap;
}
.lib-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.lib-head .wrap > .lib-brand {
  margin-right: auto;
}
.lib-brand img {
  height: 19px;
  width: auto;
}
.lib-brand span,
.lib-brand-sub {
  padding-left: 12px;
  border-left: 1px solid var(--line);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: none;
}
.lib-brand-sub:hover {
  color: var(--ink);
}
.lib-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}
.lib-nav a {
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.lib-nav a:hover {
  color: var(--ink);
  background: var(--rail);
}
.lib-nav a[aria-current='page'] {
  color: var(--ink);
  font-weight: 600;
}
@media (max-width: 760px) {
  .lib-head .wrap {
    flex-wrap: wrap;
    gap: 0 12px;
    padding-block: 10px 6px;
  }
  .lib-nav {
    order: 3;
    width: 100%;
    margin: 4px 0 0 -10px;
  }
  .lib-nav a {
    font-size: 14px;
    padding: 6px 10px;
  }
  .lib-head .btn {
    min-height: 34px;
    padding: 6px 12px;
    font-size: 13px;
  }
}
@media (max-width: 380px) {
  .lib-brand span {
    display: none;
  }
}

/* ── Footer: a navy band, as the site's ── */
.lib-foot {
  margin-top: clamp(64px, 9vw, 112px);
  background: var(--navy);
  color: var(--on-navy);
  padding-block: clamp(40px, 6vw, 64px) 28px;
  font-size: 14.5px;
}
.lib-foot .grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr));
  gap: 32px;
}
.lib-foot img {
  height: 20px;
  width: auto;
  margin-bottom: 14px;
}
.lib-foot h2 {
  font: 600 13px/1.4 var(--sans);
  color: #fff;
  margin-bottom: 10px;
  letter-spacing: 0;
}
.lib-foot ul {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 7px;
}
.lib-foot a {
  color: var(--on-navy);
  text-decoration: none;
}
.lib-foot a:hover {
  color: #fff;
  text-decoration: underline;
}
.lib-foot .fine {
  margin-top: 40px;
  padding-top: 14px;
  border-top: 1px solid #2a3a52;
  font-size: 12.5px;
  color: var(--on-navy-faint);
}
@media (max-width: 760px) {
  .lib-foot .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .lib-foot .grid > :first-child {
    grid-column: 1 / -1;
  }
}

/* ── Buttons ── */
.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font: 600 14px/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.15s var(--ease);
}
.btn:hover {
  background: var(--rail);
  color: var(--ink);
}
.btn:active {
  transform: translateY(1px);
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 1px 2px rgba(23, 33, 43, 0.18);
}
.btn.primary:hover {
  background: var(--accent-ink);
  border-color: var(--accent-ink);
  color: #fff;
}
.btn.lg {
  min-height: 48px;
  padding: 12px 22px;
  font-size: 15px;
  border-radius: 11px;
}
.btn:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.5;
  cursor: default;
}

/* ── Shared type ── */
.eyebrow {
  display: block;
  font: 600 12px/1.4 var(--sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.kicker {
  font: 600 14px/1.4 var(--sans);
  color: var(--accent);
}
.lede {
  font-size: var(--t-lead);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 36em;
}
.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.muted {
  color: var(--ink-2);
}
/* The source line every Velocity slide carries. */
.source {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 12px;
  margin-top: 14px;
  padding-top: 9px;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-3);
}
.source b {
  font-weight: 600;
  color: var(--ink-2);
}

/* ── Panels and cards ── */
.panel {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow:
    0 0 0 1px rgba(23, 33, 43, 0.07),
    var(--shadow-sm);
}
a.card {
  display: block;
  color: inherit;
  text-decoration: none;
  transition:
    box-shadow 0.2s,
    transform 0.2s var(--ease);
}
a.card:hover {
  color: inherit;
  box-shadow:
    0 0 0 1px rgba(36, 95, 167, 0.35),
    var(--shadow-md);
  transform: translateY(-2px);
}

/* ── Facts: the row of what a study is ── */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0;
  border-block: 1px solid var(--line);
}
.facts div {
  padding: 14px 16px 14px 0;
  min-width: 0;
}
.facts dt {
  font-size: 12.5px;
  color: var(--ink-3);
}
.facts dd {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.facts dd.num {
  font-size: 17px;
}

/* ── Bars: answers as horizontal bars that stand on a drawn axis ── */
.bars {
  --label: minmax(0, 15em);
  display: grid;
  grid-template-columns: var(--label) minmax(0, 1fr);
  column-gap: 14px;
  row-gap: 6px;
  font-size: 14px;
}
.bars.bare {
  grid-template-columns: minmax(0, 1fr);
}
.bars.bare .name {
  display: none;
}
.bars.bare .axis {
  grid-column: 1;
}
.bars .name {
  align-self: center;
  color: var(--ink);
  line-height: 1.3;
}
/* The track is the plot; its right margin keeps room for the value at the longest bar's end. */
.bars .track {
  position: relative;
  min-height: 26px;
  margin-right: var(--value-room, 3.6em);
  border-left: 1px solid var(--ink-3);
}
.bars .track i {
  position: absolute;
  top: 50%;
  left: 0;
  height: 16px;
  min-width: 1px;
  transform: translateY(-50%);
  background: var(--bar, var(--slate));
  border-radius: 0 2px 2px 0;
}
.bars .value {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font: 400 13px/1 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}
.bars .axis {
  grid-column: 2;
  position: relative;
  height: 22px;
  margin-right: var(--value-room, 3.6em);
  border-top: 1px solid var(--ink-3);
  margin-top: 2px;
}
.bars .axis span {
  position: absolute;
  white-space: nowrap;
  top: 0;
  transform: translateX(-50%);
  padding-top: 5px;
  font: 400 11px/1 var(--mono);
  color: var(--ink-3);
}
.bars .axis span::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  height: 4px;
  border-left: 1px solid var(--ink-3);
}
.bars .axis span:first-child {
  transform: none;
}
.bars .axis span:first-child::before {
  left: 0;
}
.bars .gridline {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--grid);
  pointer-events: none;
}
@media (max-width: 560px) {
  .bars {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 2px;
  }
  .bars .name {
    margin-top: 6px;
    font-size: 13.5px;
  }
  .bars .axis {
    grid-column: 1;
  }
}

/* ── Notes: a chart's fine print sits behind one glyph in its footer ── */
.note-glyph {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--ink-2);
  font: 600 12px/1 var(--serif);
  font-style: italic;
  cursor: pointer;
}
.note-glyph:hover,
.note-glyph[aria-expanded='true'] {
  border-color: var(--accent);
  color: var(--accent);
}
.note-glyph.caution::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  margin: -16px -16px 0 0;
  border-radius: 50%;
  background: var(--caution);
}
.note {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 9px;
  background: var(--tint);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-2);
}
.note p + p {
  margin-top: 6px;
}

/* ── Tables behind figures ── */
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data th,
table.data td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
}
table.data th:not(:first-child),
table.data td {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
table.data thead th {
  font: 600 12.5px/1.3 var(--sans);
  color: var(--ink-3);
}
table.data tbody th {
  font-weight: 400;
}
details.fold > summary {
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  list-style: none;
}
details.fold > summary::-webkit-details-marker {
  display: none;
}
details.fold > summary::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 8px 2px 1px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s var(--ease);
}
details.fold[open] > summary::before {
  transform: rotate(45deg);
}

/* ── Forms ── */
input[type='search'],
input[type='text'],
select,
textarea {
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 12px;
  min-height: 42px;
  max-width: 100%;
}
select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%2352606d' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* ── Directory pages (survey-discovery, written by scripts/public-surveys/publish-discovery.mjs) ── */
.discovery-main {
  padding-block: clamp(28px, 5vw, 56px) 0;
}
.discovery-main h1 {
  font-size: clamp(32px, 4.6vw, 52px);
  max-width: 18em;
}
.discovery-main .crumb {
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
}
.discovery-main .crumb a {
  text-decoration: none;
}
.discovery-main .lede {
  margin-top: 14px;
}
.discovery-main .method {
  margin-top: 18px;
  max-width: 48em;
  font-size: 15px;
  color: var(--ink-2);
}
.discovery-main .links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  margin-top: 24px;
  font-weight: 600;
}
ul.directory {
  list-style: none;
  margin-top: 28px;
  padding: 0;
  border-top: 1px solid var(--line);
  columns: 2 420px;
  column-gap: 40px;
}
ul.directory li {
  break-inside: avoid;
  border-bottom: 1px solid var(--line-soft);
}
ul.directory a {
  display: block;
  padding: 11px 4px;
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}
ul.directory a:hover {
  background: var(--rail);
  color: var(--accent-ink);
}

/* ── Embed: one finding, bare, sized for a 600 × 300 frame ── */
body.embed {
  background: var(--panel);
}
.embed-main {
  padding: 18px 20px;
}
#finding {
  display: grid;
  gap: 4px;
  max-width: 560px;
  font-size: 13.5px;
  color: var(--ink-2);
}
#finding small {
  font: 600 11.5px/1.4 var(--sans);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
}
#finding h1 {
  font: 500 44px/1.05 var(--mono);
  letter-spacing: -0.03em;
}
#finding strong {
  font-size: 16px;
  color: var(--ink);
}
#finding p {
  line-height: 1.45;
}
#finding a {
  justify-self: start;
  font-weight: 600;
}
