/* Charts for the Inkling loop-routing post. Colours live in charts.js (one set per theme). */

/* Body links use the site-wide style in assets/css/custom.css. Figure references carry a class, so they
   don't match that rule; give them the same look, and keep "Figure 3" on one line. */
.prose a.figref { color: rgb(var(--color-neutral-500)); font-weight: inherit; text-decoration: underline; text-decoration-thickness: 1px;
  text-underline-offset: .18em; text-decoration-color: rgba(var(--color-neutral-500), .35); white-space: nowrap }
.dark .prose a.figref { color: rgb(var(--color-neutral-400)); text-decoration-color: rgba(var(--color-neutral-400), .35) }
.prose a.figref:hover { color: rgb(var(--color-neutral-900)); text-decoration-color: currentColor }
.dark .prose a.figref:hover { color: rgb(var(--color-neutral)) }

/* ---- Collapsible source table in the appendix ---- */
.prose details.lr-sources { margin: 1.25rem 0 1.75rem }
.prose details.lr-sources > summary { cursor: pointer; font-size: .9rem; color: rgb(var(--color-neutral-500)); list-style-position: outside }
.dark .prose details.lr-sources > summary { color: rgb(var(--color-neutral-400)) }
.prose details.lr-sources > summary:hover { color: rgb(var(--color-neutral-900)) }
.dark .prose details.lr-sources > summary:hover { color: rgb(var(--color-neutral)) }

/* ---- Source table: long dataset ids may break anywhere so the table never overflows a phone ---- */
.prose table td { overflow-wrap: anywhere }
.prose table th:not(:first-child), .prose table td:not(:first-child) { text-align: left }
@media (max-width: 560px) { .prose table { font-size: .7rem } .prose table td, .prose table th { padding: .35rem .4rem } }

/* ---- Figure captions: left-aligned, small, numbered by charts.js ("Figure 3.") ---- */
.prose figure.lr-fig figcaption, .prose figure.lr-tml figcaption {
  text-align: left; font-size: .8rem; line-height: 1.5; margin-top: .6rem; color: rgb(var(--color-neutral-500)) }
.dark .prose figure.lr-fig figcaption, .dark .prose figure.lr-tml figcaption { color: rgb(var(--color-neutral-400)) }
.prose figcaption .fig-num { font-weight: 600; color: rgb(var(--color-neutral-900)) }
.dark .prose figcaption .fig-num { color: rgb(var(--color-neutral)) }
.prose figure.lr-fig, .prose figure.lr-tml { scroll-margin-top: 5rem }

/* ---- Sidenotes (shortcode: layouts/shortcodes/sidenote.html) ----
   Wide screens: floated into the right margin. Narrow: tap the number to open the note under the line. */
.prose { counter-reset: lr-sn }
.prose .sidenote-number { counter-increment: lr-sn; cursor: pointer; display: inline }
.prose .sidenote-number::after { content: counter(lr-sn); font-size: .7em; line-height: 0; vertical-align: .55em; margin-left: 1px;
  font-weight: 600; color: rgb(var(--color-neutral-500)); padding: 0 1px }
.prose .sidenote-number:hover::after { color: rgb(var(--color-neutral-900)) }
.dark .prose .sidenote-number:hover::after { color: rgb(var(--color-neutral)) }
.prose input.margin-toggle { display: none }
.prose .sidenote { display: none; font-size: .8rem; line-height: 1.5; color: rgb(var(--color-neutral-500)); margin: .5rem 0 .9rem 1rem;
  font-weight: 400; text-align: left }
.dark .prose .sidenote { color: rgb(var(--color-neutral-400)) }
.prose .sidenote::before { content: counter(lr-sn) "  "; white-space: pre; font-weight: 600; color: rgb(var(--color-neutral-900)) }
.dark .prose .sidenote::before { color: rgb(var(--color-neutral)) }
.prose .margin-toggle:checked + .sidenote { display: block }
.prose .sidenote .katex { font-size: 1em }
@media (min-width: 1240px) {
  .prose .sidenote { display: block; float: right; clear: right; width: 210px; margin: .3rem -242px .9rem 0; position: relative }
  .prose .sidenote-number { cursor: default; pointer-events: none }
}
/* labels like L18 and e63 are set like LaTeX's \texttt, in the typewriter face that ships with KaTeX, so they sit with the math */
.tt { font-family: KaTeX_Typewriter, ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace; font-size: 1.06em; font-weight: 400;
  line-height: 1; white-space: nowrap; }
.prose figure.lr-fig { margin: 1.75rem 0 2rem; min-width: 0 }
.lr-chart { min-width: 0; width: 100% }
.lr-chart svg { display: block; max-width: 100%; height: auto; overflow: visible }
.lr-legend { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 12px; line-height: 1.5; color: rgb(var(--color-neutral-500)); margin-bottom: 4px }
.dark .lr-legend { color: rgb(var(--color-neutral-400)) }
.lr-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: 5px }
.lr-legend i.dash { height: 0; width: 14px; border-top: 2px dashed currentColor; border-radius: 0; vertical-align: 3px; opacity: .8 }
.lr-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 24px }
.lr-two figure.lr-fig { margin: 1rem 0 1.25rem }
/* the TML diagram is tall: keep it to a readable width */
.prose figure.lr-tml { margin: 1.75rem auto 2rem; text-align: center }
.prose figure.lr-tml img { max-width: min(100%, 360px); height: auto; margin: 0 auto }
/* L18 grid: the cell colour is the data (share of output on d2027) */
.lr-grid { display: grid; grid-template-columns: 74px repeat(4, minmax(0, 1fr)); gap: 5px; font-size: 12px; line-height: 1.3 }
.lr-grid-key { margin-bottom: 8px; gap: 2px 18px }
.lr-grid-key b { font-weight: 600; margin-right: 4px; color: rgb(var(--color-neutral-900)) }
.dark .lr-grid-key b { color: rgb(var(--color-neutral)) }
.lr-grid .h { font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-align: center; padding-bottom: 3px }
.lr-grid .rl { align-self: center; font-weight: 600 }
.lr-grid .rl small { display: block; font-weight: 400; opacity: .7; font-size: 11px }
.lr-grid .cell { border-radius: 4px; padding: 8px 4px; min-height: 74px; display: grid; align-content: center; justify-items: center; gap: 1px; text-align: center }
.lr-grid .cell.empty { background: none }
.lr-grid .big { font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums }
.lr-grid .sub { font-size: 11px }
.lr-grid .ex { font: 10.5px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; opacity: .85 }
@media (max-width: 480px) {
  .lr-grid { grid-template-columns: 52px repeat(4, minmax(0, 1fr)); gap: 3px }
  .lr-grid .big { font-size: 13px } .lr-grid .sub { font-size: 10px } .lr-grid .ex { font-size: 9px } .lr-grid .cell { min-height: 64px; padding: 6px 2px }
}
