/* Davidson Lab. Tokens from the Davidson Visual Library:
   paper/ink in light, night/bone in dark, one crimson accent, Inter 400/500/600,
   1.5px boxes with an 8px radius. One reading column; tables stack on a phone. */
:root {
  --ground: #F5F3EF;   /* paper */
  --card: #FFFFFF;
  --text: #1A1A1A;     /* ink */
  --muted: #5F6666;    /* slate, darkened one step for small text */
  --line: #6C7373;     /* slate, box outlines */
  --rule: rgba(26, 26, 26, .14);
  --accent: #BA0C2F;   /* crimson */
  --accent-text: #BA0C2F;
  --accent-soft: rgba(186, 12, 47, .08);
  --font: Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0F0F10; /* night */
    --card: #17171A;
    --text: #F2F0EC;   /* bone */
    --muted: #8A8D8F;
    --line: #8A8D8F;
    --rule: rgba(242, 240, 236, .14);
    --accent: #BA0C2F;
    --accent-text: #E0475F;
    --accent-soft: rgba(186, 12, 47, .14);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--text);
  font: 400 1.0625rem/1.6 var(--font);
  font-feature-settings: "cv11", "ss03";
}
.wrap { max-width: 46rem; margin-inline: auto; padding-inline: max(1.25rem, env(safe-area-inset-left)) max(1.25rem, env(safe-area-inset-right)); }
a { color: inherit; text-decoration-color: var(--accent-text); text-decoration-thickness: 1.5px; text-underline-offset: .18em; }
a:hover { color: var(--accent-text); }
a:focus-visible, .card:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; border-radius: 4px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--card); padding: .5rem .75rem; z-index: 5; }

/* header */
.site-head { border-bottom: 1.5px solid var(--rule); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .25rem 1.5rem; padding-block: 1rem; }
.mark { font-weight: 600; font-size: 1.75rem; letter-spacing: -.04em; line-height: 1; text-decoration: none; display: inline-flex; align-items: baseline; }
.mark:hover { color: inherit; }
.mark i { width: .3em; height: .3em; border-radius: 50%; background: var(--accent); margin-left: .09em; }
nav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; font-size: .9375rem; font-weight: 500; }
nav a { text-decoration: none; color: var(--muted); padding-block: .35rem; }
nav a:hover, nav a[aria-current="page"] { color: var(--text); }
nav a[aria-current="page"] { box-shadow: 0 1.5px 0 var(--accent); }

/* type */
main { padding-block: 3rem 4rem; }
h1, h2, h3 { font-weight: 600; letter-spacing: -.02em; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.6vw, 2.5rem); line-height: 1.12; }
h2 { font-size: 1.25rem; line-height: 1.3; margin-top: 2.75rem; }
h3 { font-size: 1.25rem; line-height: 1.25; }
p, ul, ol { margin: 1rem 0 0; }
ul, ol { padding-left: 1.25rem; }
li + li { margin-top: .5rem; }
li::marker { color: var(--muted); }
strong { font-weight: 600; }
.eyebrow { margin: 0 0 .9rem; color: var(--muted); font-size: .8125rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; display: block; }
.eyebrow .sep { opacity: .5; margin-inline: .2em; }
.lead, .lead p { font-size: 1.1875rem; line-height: 1.5; }
.lead { margin-top: 1.25rem; }
.lead p:first-child { margin-top: 0; }
.fine { margin-top: 2.75rem; padding-top: 1.25rem; border-top: 1.5px solid var(--rule); color: var(--muted); font-size: .9375rem; }
.back { font-size: .9375rem; font-weight: 500; }

/* home */
.hero h1 { font-size: clamp(1.6rem, 1.1rem + 2.3vw, 2.25rem); line-height: 1.18; }
.hero .lead p { color: var(--muted); }
.list-head { font-size: .8125rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 3.25rem; }
.cards { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .875rem; }
.cards li { margin: 0; }
.card { display: block; text-decoration: none; background: var(--card); border: 1.5px solid var(--line); border-radius: 8px; padding: 1.25rem 1.375rem 1.125rem; }
.card:hover { color: inherit; border-color: var(--accent); }
.card .eyebrow { margin-bottom: .55rem; }
.card p { margin-top: .6rem; color: var(--muted); font-size: 1rem; line-height: 1.5; }
.card .more { display: inline-block; margin-top: .85rem; font-size: .9375rem; font-weight: 500; text-decoration: underline; text-decoration-color: var(--accent-text); text-decoration-thickness: 1.5px; text-underline-offset: .18em; }

/* the one accent box: what to do with it */
section.do { margin-top: 2.75rem; border: 2px solid var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 1.25rem 1.375rem 1.375rem; }
section.do h2 { margin-top: 0; font-size: .8125rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); }
section.do p { font-size: 1.125rem; font-weight: 500; line-height: 1.5; margin-top: .6rem; }

/* tables */
.table-wrap { margin-top: 1.25rem; overflow-x: auto; }
.tbl { border-collapse: collapse; width: 100%; font-size: .9375rem; line-height: 1.45; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { text-align: left; vertical-align: top; padding: .65rem .75rem .65rem 0; border-bottom: 1px solid var(--rule); }
.tbl thead th { font-size: .8125rem; font-weight: 500; color: var(--muted); border-bottom: 1.5px solid var(--line); vertical-align: bottom; }
.tbl tbody th { font-weight: 500; }
.tbl.nums td { font-weight: 600; white-space: nowrap; }
.tbl.nums tbody th { min-width: 11rem; }
.tbl.prose.stack td { min-width: 9rem; }
.tbl.prose.stack tbody th { white-space: nowrap; }

@media (max-width: 640px) {
  body { font-size: 1rem; }
  main { padding-block: 2rem 3rem; }
  nav { gap: .25rem 1rem; font-size: .875rem; }
  .site-head .wrap { padding-block: .8rem .6rem; }
  .tbl.nums:not(.stack) td { white-space: normal; }
  .tbl.nums:not(.stack) tbody th { min-width: 0; }
  /* three columns or more: each row becomes its own box, every value keeps its column name */
  .tbl.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .tbl.stack, .tbl.stack tbody, .tbl.stack tr, .tbl.stack th, .tbl.stack td { display: block; }
  .tbl.stack tr { background: var(--card); border: 1.5px solid var(--line); border-radius: 8px; padding: .85rem 1rem .5rem; margin-bottom: .75rem; }
  .tbl.stack tbody th { border: 0; padding: 0 0 .5rem; font-weight: 600; font-size: 1rem; white-space: normal; min-width: 0; }
  .tbl.stack td { padding: .45rem 0; border-bottom: 0; border-top: 1px solid var(--rule); white-space: normal; min-width: 0; }
  .tbl.stack td::before { content: attr(data-label); color: var(--muted); font-weight: 500; font-size: .8125rem; }
  .tbl.stack.nums td { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; text-align: right; }
  .tbl.stack.nums td::before { text-align: left; }
  .tbl.stack.prose td::before { display: block; margin-bottom: .15rem; }
  .tbl.stack.prose td { font-weight: 400; }
  .tbl.stack.nums td.empty, .tbl.stack.prose td.empty { display: none; }
}

/* pictures: Visual Library grammar. Slate boxes, slate arrows, one crimson box, bars that grow. */
.viz { margin: 2rem 0 0; padding: 1.25rem 1.25rem 1rem; background: var(--card); border: 1.5px solid var(--rule); border-radius: 8px; position: relative; }
.viz-group + .viz-group { margin-top: 1.25rem; }
.viz-label { margin: 0 0 .6rem; color: var(--muted); font-size: .75rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.viz figcaption { margin-top: 1rem; padding-right: 4.5rem; color: var(--muted); font-size: .9375rem; }
.flow { list-style: none; margin: 0; padding: 0; display: flex; align-items: stretch; gap: 2.25rem; }
.flow .box { margin: 0; flex: 1 1 0; min-width: 0; position: relative; display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 8px; padding: .7rem .8rem; font-size: .9375rem; font-weight: 500; line-height: 1.3; }
.flow .box.acc { border: 2px solid var(--accent); background: var(--accent-soft); }
.flow .box + .box::before { content: ""; position: absolute; right: calc(100% + .45rem); top: 50%; width: 1.35rem; height: 1.5px; background: var(--line); transform-origin: left center; }
.flow .box + .box::after { content: ""; position: absolute; right: calc(100% + .3rem); top: 50%; border-left: 7px solid var(--line); border-block: 4.5px solid transparent; transform: translateY(-50%); margin-top: .75px; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.bar { margin: 0; display: grid; grid-template-columns: minmax(6.5rem, 34%) minmax(0, 1fr) auto; align-items: center; gap: .75rem; font-size: .9375rem; }
.bar-name { font-weight: 500; line-height: 1.3; }
.bar-track { height: 1.375rem; border-radius: 4px; background: var(--rule); overflow: hidden; }
.bar-fill { display: block; height: 100%; width: var(--w); border-radius: 4px; background: var(--line); transform-origin: left center; }
.bar.acc .bar-fill { background: var(--accent); }
.bar-val { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 3.25rem; text-align: right; white-space: nowrap; }
.replay { position: absolute; right: 1rem; bottom: .85rem; font: 500 .8125rem var(--font); color: var(--muted); background: none; border: 1.5px solid var(--rule); border-radius: 6px; padding: .2rem .6rem; cursor: pointer; }
.replay:hover { color: var(--text); border-color: var(--line); }
.replay:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
[hidden] { display: none !important; }

/* motion: only once viz.js has armed a picture; at rest everything is visible */
.viz.armed:not(.play) .box, .viz.armed:not(.play) .bar-val, .viz.armed:not(.play) figcaption { opacity: 0; }
.viz.armed:not(.play) .bar-fill { transform: scaleX(0); }
.viz.play .box { animation: viz-in .45s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i) * .45s); }
.viz.play .box + .box::before { animation: viz-draw .3s ease-out both; animation-delay: calc(var(--i) * .45s - .2s); }
.viz.play .box + .box::after { animation: viz-fade .2s ease-out both; animation-delay: calc(var(--i) * .45s); }
.viz.play .viz-group:nth-child(2) .box, .viz.play .viz-group:nth-child(2) .bar-fill, .viz.play .viz-group:nth-child(2) .bar-val { --d: 1.6s; }
.viz.play .viz-group:nth-child(3) .bar-fill, .viz.play .viz-group:nth-child(3) .bar-val, .viz.play .viz-group:nth-child(3) .box { --d: 3s; }
.viz.play .viz-group .box { animation-delay: calc(var(--d, 0s) + var(--i) * .45s); }
.viz.play .viz-group .box + .box::before { animation-delay: calc(var(--d, 0s) + var(--i) * .45s - .2s); }
.viz.play .viz-group .box + .box::after { animation-delay: calc(var(--d, 0s) + var(--i) * .45s); }
.viz.play .bar-fill { animation: viz-grow .9s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--d, 0s) + var(--i) * .18s); }
.viz.play .bar-val { animation: viz-fade .4s ease-out both; animation-delay: calc(var(--d, 0s) + var(--i) * .18s + .6s); }
.viz.play figcaption { animation: viz-fade .5s ease-out both; animation-delay: .4s; }
@keyframes viz-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes viz-draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes viz-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes viz-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (max-width: 640px) {
  .viz { padding: 1rem 1rem .9rem; }
  .flow { flex-direction: column; gap: 1.6rem; }
  .flow .box + .box::before { right: auto; left: 1.5rem; top: -1.25rem; width: 1.5px; height: .8rem; transform-origin: center top; }
  .flow .box + .box::after { right: auto; left: 1.5rem; top: -.4rem; margin: 0 0 0 -3.75px; border: 0; border-top: 7px solid var(--line); border-inline: 4.5px solid transparent; transform: none; }
  .viz.play .box + .box::before { animation-name: viz-draw-down; }
  .bar { grid-template-columns: minmax(0, 1fr) auto; gap: .25rem .75rem; }
  .bar-name { grid-column: 1 / -1; }
  .viz figcaption { padding-right: 0; padding-bottom: 2rem; }
}
@keyframes viz-draw-down { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* footer */
.site-foot { border-top: 1.5px solid var(--rule); color: var(--muted); font-size: .875rem; }
.site-foot .wrap { padding-block: 1.75rem 2.5rem; }
.site-foot p { margin: .35rem 0 0; }

@media (prefers-reduced-motion: no-preference) { .card { transition: border-color .15s; } }
@media print { .site-head nav, .skip { display: none; } body { background: #fff; color: #000; } }
