/* GRIMdata platform: system typography, restrained rainbow, clear choices. */
:root {
  --md-text-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --md-code-font: ui-monospace, SFMono-Regular, Consolas, monospace;
  --grim-ink: #24233d;
  --grim-muted: #58576c;
  --grim-border: #dcdce5;
  --grim-surface: #f5f5f9;
  --md-primary-fg-color: #34325f;
  --md-accent-fg-color: #5a3ba5;
}
[data-md-color-scheme="slate"] {
  --grim-ink: #f0eff8;
  --grim-muted: #bbbaca;
  --grim-border: #48475b;
  --grim-surface: #292837;
  --md-primary-fg-color: #34325f;
  --md-accent-fg-color: #c1a7ff;
}
.md-typeset { font-size: .84rem; line-height: 1.7; }
.md-typeset h1 { color: var(--grim-ink); font-weight: 750; letter-spacing: -.035em; }
.md-typeset h2, .md-typeset h3 { color: var(--grim-ink); font-weight: 700; letter-spacing: -.02em; }
.md-typeset a:not(.md-button):hover { text-decoration: underline; text-underline-offset: .18em; }
.md-typeset .md-button { border-radius: .25rem; font-size: .76rem; padding: .65em 1.05em; border-width: 1px; }
.md-typeset .md-button--primary { color: #fff; background: #403d7b; border-color: #403d7b; }
.md-typeset .md-button--primary:hover { color: #fff; background: #524899; border-color: #524899; }
.md-typeset .grid.cards > ul { grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)) !important; gap: 1rem !important; }
.md-typeset .grid.cards > ul > li {
  background: var(--md-default-bg-color) !important; border: 1px solid var(--grim-border) !important;
  border-radius: .35rem !important; padding: 1.2rem !important; box-shadow: none !important;
}
.md-typeset .grid.cards > ul > li:hover { transform: none !important; box-shadow: none !important; border-color: #877cab !important; }
.md-typeset .grid.cards > ul > li h3 { font-size: 1.15rem; line-height: 1.3; margin: .65rem 0; }
.md-typeset .grid.cards > ul > li p { margin: .6rem 0; }
.md-typeset .grid.cards.grim-tracks > ul { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.md-typeset .grid.cards.grim-tracks > ul > li { display: flex !important; flex-direction: column; }
.md-typeset .grid.cards.grim-tracks > ul > li p:last-child { margin-top: auto; padding-top: .4rem; }
.grim-track-index { color: var(--grim-muted); font-size: .66rem; font-weight: 700; letter-spacing: .025em; }
.grim-home { max-width: 58rem; margin: 0 auto; }
.grim-hero { display: grid; grid-template-columns: 1.65fr 1fr; background: #24233d; color: #f2f1fb; border-radius: .5rem; overflow: hidden; margin-top: .35rem; position: relative; }
.grim-hero::before { content: ""; position: absolute; top: 0; width: 100%; height: 5px; background: var(--rainbow-gradient); }
.grim-hero-copy { padding: 2.7rem 2.2rem 2rem; }
.grim-eyebrow { font-size: .62rem; font-weight: 750; text-transform: uppercase; letter-spacing: .12em; margin: 0 0 1.2rem !important; }
.md-typeset .grim-hero h1 { font-size: clamp(2.1rem, 4.5vw, 3.45rem); line-height: 1.07; color: #fff; margin: 0 0 1.15rem; font-weight: 780; letter-spacing: -.055em; }
.grim-lede { font-size: .94rem; line-height: 1.65; max-width: 32rem; color: #e1dfef; }
.grim-actions { display: flex; flex-wrap: wrap; gap: .65rem; margin: 1.35rem 0 1rem; }
.md-typeset .grim-hero .md-button { color: #fff; border-color: #9793b1; }
.md-typeset .grim-hero .md-button--primary { background: #f0edf8; color: #24233d; border-color: #f0edf8; }
.md-typeset .grim-hero .md-button:hover { background: #d3c5f4; color: #24233d; border-color: #d3c5f4; }
.grim-hero-note { font-size: .64rem; color: #c2bfd6; margin: 1.2rem 0 0; }
.grim-snapshot .grim-eyebrow { color: #f2f1fb; }
.grim-snapshot { color: #f2f1fb; background: #302e4c; padding: 2.7rem 1.65rem 2rem; border-left: 1px solid #5a5575; display: flex; flex-direction: column; }
.grim-snapshot-number { color: #f2f1fb; font-size: 4.8rem; line-height: 1; font-weight: 720; letter-spacing: -.065em; margin: 0 !important; }
.grim-snapshot-number span { display: block; font-size: .77rem; letter-spacing: 0; font-weight: 450; line-height: 1.5; margin-top: .65rem; }
.grim-snapshot-pair { display: grid; grid-template-columns: .8fr 1.2fr; gap: 1rem; border-top: 1px solid #69627e; margin-top: 1.3rem; }
.grim-snapshot-pair strong { color: #f2f1fb; display: block; font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
.grim-snapshot-pair span { display: block; font-size: .62rem; line-height: 1.5; color: #e1dfef; margin-top: .25rem; }
.grim-snapshot-note { font-size: .61rem; line-height: 1.6; color: #d4cfe6; margin-top: .6rem; }
.md-typeset .grim-snapshot a { color: #f0e6ff; font-size: .73rem; font-weight: 650; margin-top: auto; }
.grim-section-heading { max-width: 42rem; margin: 2.5rem 0 1.1rem; }
.md-typeset .grim-section-heading h2 { font-size: 1.85rem; line-height: 1.2; margin-bottom: .7rem; }
.grim-section-heading p { color: var(--grim-muted); }
.grim-platform { background: var(--grim-surface); padding: 1.65rem 1.8rem; border-left: 4px solid #6f5ca1; margin: 2.2rem 0; }
.md-typeset .grim-platform h2 { font-size: 1.4rem; margin: 0 0 .6rem; }
.grim-platform .md-button { margin: .3rem .3rem .2rem 0; }
.md-typeset .grid.cards.grim-doc-choices > ul { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: .65rem !important; }
.md-typeset .grid.cards.grim-doc-choices > ul > li { padding: 1rem !important; }
.md-typeset .grid.cards.grim-doc-choices > ul > li h3 { font-size: .93rem; margin-top: 0; }
.grim-doc-choices p { font-size: .73rem; }
.grim-principles { max-width: 46rem; padding: 1.2rem 0 1rem; }
.md-typeset .grim-principles h2 { font-size: 1.5rem; }
.grim-legacy { border-top: 1px solid var(--grim-border); padding-top: 1rem; color: var(--grim-muted); font-size: .68rem; }
.grim-legacy span[id] { scroll-margin-top: 7rem; }
.grim-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.md-typeset :is(a,button,input,select,summary,[tabindex]):focus-visible { outline: 3px solid #8866c0; outline-offset: 3px; }
.grim-hero :is(a,button):focus-visible { outline-color: #ffdf71; }
.sc-sort, .sc-country-button { font: inherit; color: var(--md-typeset-a-color); cursor: pointer; min-height: 2.2rem; padding: .2rem; }
.sc-sort { color: var(--grim-ink); font-weight: 700; }
.sc-country-button { text-decoration: underline; text-underline-offset: .16em; }
.sc-chart:empty { min-height: 0; margin: 0; }
.sc-chart-permission { border: 1px solid var(--grim-border); background: var(--grim-surface); border-radius: .35rem; padding: 1rem 1.2rem; margin: 1rem 0; }
.sc-chart-permission p { margin: .35rem 0 .85rem; }
.sc-chart-permission a { display: inline-block; margin: .45rem; }
#sc-chart-status, #sc-compare-status { font-size: .73rem; }
.sc-controls :is(select,input[type="search"]) { min-height: 2.2rem; max-width: 100%; }
.sc-controls label { color: var(--grim-ink); }
.sc-detail-close { width: 2.2rem; height: 2.2rem; }
.sc-doc-warn, table.sc-table td.sc-doc-warn { color: #805000; }
[data-md-color-scheme="slate"] .sc-doc-warn { color: #f0bd72; }
.sc-controls #sc-compare { width: min(100%, 18rem); }
.sc-controls { min-width: 0; }
.sc-controls > * { max-width: 100%; }
#sc-selected .md-button { margin: .2rem .3rem .2rem 0; }
#tw-sources { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.tw-badge-document, .badge-success { background: #17633d; color: #fff; }
.tw-badge-structure, .badge-warning { background: #805000; color: #fff; }
.tw-badge-dataset, .badge-info { background: #2457a0; color: #fff; }
.tw-date { color: var(--md-typeset-a-color); }
.external-new-tab { font-size: .75em; }
@media (max-width: 760px) {
  .grim-hero { grid-template-columns: minmax(0,1fr); }
  .grim-hero-copy { padding: 2rem 1.35rem 1.6rem; }
  .grim-snapshot { padding: 1.5rem 1.35rem; border-left: 0; border-top: 1px solid #5a5575; }
  .grim-snapshot-number { color: #f2f1fb; font-size: 3.3rem; }
  .grim-snapshot-pair { margin-top: 1rem; }
  .grim-snapshot-pair p { margin-bottom: .5rem; }
  .grim-section-heading { margin-top: 2rem; }
  .md-typeset .grim-section-heading h2 { font-size: 1.5rem; }
  .md-typeset .grid.cards.grim-tracks > ul, .md-typeset .grid.cards.grim-doc-choices > ul { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
  .grim-platform { padding: 1.3rem; }
}
@media (max-width: 500px) {
  .md-typeset .grid.cards.grim-tracks > ul, .md-typeset .grid.cards.grim-doc-choices > ul { grid-template-columns: minmax(0,1fr) !important; }
  .grim-actions { flex-direction: column; align-items: stretch; }
  .grim-actions .md-button { text-align: center; }
  .sc-detail-card { padding: 1rem; }
  .sc-controls--grid > label { flex: 1 1 10rem; }
  .sc-table-wrap { max-height: 26rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; animation-duration: 0s !important; }
}

[data-md-color-primary="indigo"] { --md-primary-fg-color: #34325f; }
/* Icon links already include their destination and new-tab notice in aria-label. */
.md-social__link .external-new-tab,
.md-social__link .external-icon {
  display: none;
}

/* Research record and programme history. */
.grim-record { border-block: 1px solid var(--grim-border); padding: .5rem 0; }
.md-typeset .grim-record ul { list-style: none; margin: 0; }
.md-typeset .grim-record li { margin: 0; padding: 1rem 0; }
.md-typeset .grim-record li + li { border-top: 1px solid var(--grim-border); }
.grim-timeline { border-left: 2px solid var(--grim-border); padding-left: 1.4rem; margin: 1.5rem 0; }
.md-typeset .grim-timeline h3 { position: relative; margin-top: 2rem; }
.grim-timeline h3::before { content: ""; position: absolute; left: -1.7rem; top: .4rem; width: .5rem; height: .5rem; background: var(--md-accent-fg-color); border-radius: 50%; }
.grim-snapshot-note, .grim-hero-note { font-size: .7rem; }
.grim-snapshot-pair span { font-size: .7rem; }
.md-typeset [id] { scroll-margin-top: 7rem; }
@media (max-width: 500px) {
  .grim-timeline { padding-left: 1rem; }
  .grim-timeline h3::before { left: -1.3rem; }
}

/* Distinguishable links and stable contrast in both appearance schemes. */
body[data-md-color-scheme="default"] {
  --md-typeset-a-color: #5a3ba5;
  --md-accent-fg-color: #5a3ba5;
  --md-default-fg-color--light: #58576c;
  --md-default-fg-color--lighter: #646477;
}
body[data-md-color-scheme="slate"] {
  --md-typeset-a-color: #c1a7ff;
  --md-accent-fg-color: #c1a7ff;
  --md-default-fg-color--light: #bbbaca;
  --md-default-fg-color--lighter: #aaa9bd;
}
.md-typeset :is(p,li,td) a:not(.md-button):not(.headerlink) {
  text-decoration: underline;
  text-underline-offset: .16em;
}
.md-copyright { color: #aaa; }
.md-typeset .md-typeset__scrollwrap:focus-visible { outline: 3px solid var(--md-accent-fg-color); outline-offset: 2px; }
body[data-md-color-scheme="slate"] .md-typeset a:not(.md-button) { color: #c1a7ff; }
body[data-md-color-scheme="slate"] .md-typeset .md-button:not(.md-button--primary) { color: #f0eff8; border-color: #bbbaca; }
body[data-md-color-scheme="slate"] .highlight .nb { color: #bbb0ff; }
