/* Overthinking the Internet: one dark look, carbon ground, sage accent. */
@font-face { font-family: "Bricolage Grotesque"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/bricolage-grotesque-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/bricolage-grotesque-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  --bg: #131517;
  --bg-2: #16191B;
  --raise: #1B1E21;
  --line: #2A2E33;
  --line-2: #3A3F45;
  --fg: #ECEEEF;
  --fg-2: #C9CDD0;
  --muted: #8E9499;
  --sage: #A9C4A1;
  --sage-hi: #C7DCC0;
  --teal: #33A6B8;
  --neutral-mark: #6B7177;
  --display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; }
a { color: var(--sage); }
a:hover { color: var(--sage-hi); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--sage); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: 1200px; margin: 0 auto; padding-inline: 32px; }
@media (max-width: 600px) { .wrap { padding-inline: 18px; } }

.mono { font-family: var(--mono); }
.eyebrow { font-family: var(--mono); font-size: 13px; letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; }
.display { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; }

/* Ambient flares and dot grid */
.flares { position: relative; overflow: hidden; }
.flares::before, .flares::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.flares::before { width: 640px; height: 640px; right: -180px; top: -260px; background: radial-gradient(circle, rgba(169,196,161,0.40) 0%, rgba(169,196,161,0) 68%); }
.flares::after { width: 620px; height: 620px; left: -240px; bottom: -320px; background: radial-gradient(circle, rgba(51,166,184,0.34) 0%, rgba(51,166,184,0) 68%); }
.dots { position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(rgba(236,238,239,0.07) 1.5px, transparent 1.7px); background-size: 22px 22px; }
.flares > *:not(.dots) { position: relative; }

/* Navigation */
.nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-block: 26px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--fg); text-decoration: none; }
.brand img { width: 40px; height: 40px; }
.brand span { font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: -0.01em; }
.nav-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 26px; font-size: 15px; }
.nav-links a { color: var(--fg-2); text-decoration: none; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--sage); }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 24px; border-radius: 10px; font-weight: 500; text-decoration: none; }
.btn-primary { background: var(--sage); color: var(--bg); }
.btn-primary:hover { background: var(--sage-hi); color: var(--bg); }
.btn-ghost { border: 1px solid var(--line-2); color: var(--fg); }
.btn-ghost:hover { border-color: var(--sage); color: var(--fg); }
.nav-links .btn { min-height: 40px; padding: 0 18px; border-radius: 8px; color: var(--bg); }
.nav-links .btn:hover { color: var(--bg); }

/* Hero */
.hero { display: flex; flex-wrap: wrap; align-items: center; gap: 56px; padding-block: 64px 104px; }
.hero-copy { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.hero h1 { margin: 0; font-weight: 700; font-size: clamp(42px, 6vw, 80px); line-height: 1.02; letter-spacing: -0.025em; }
.hero h1 em { font-style: normal; color: var(--sage); }
.hero .lede { margin: 0; max-width: 58ch; font-size: 20px; line-height: 1.55; color: var(--fg-2); }
.hero .day-job { margin: 0; max-width: 58ch; font-size: 18px; color: var(--fg); }
.ctas { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; }
.hero-art { flex: 1 1 280px; display: flex; justify-content: center; }
.avatar-orbit { position: relative; width: 340px; max-width: 78vw; aspect-ratio: 1 / 1; }
.avatar-orbit::before, .avatar-orbit::after { content: ""; position: absolute; border-radius: 50%; border: 1px dashed; }
.avatar-orbit::before { inset: -6%; border-color: rgba(169,196,161,0.45); }
.avatar-orbit::after { inset: -16%; border-color: rgba(51,166,184,0.30); }
.avatar-orbit img { position: relative; width: 100%; height: 100%; }
.ping { position: absolute; right: -8px; bottom: 18px; font-family: var(--mono); font-size: 12px; color: var(--bg); background: var(--fg); padding: 6px 10px; border-radius: 6px; }

/* Recognition strip */
.strip { border-block: 1px solid #23272B; background: var(--bg-2); }
.strip .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 36px; padding-block: 22px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.strip .label { color: var(--sage); }

/* Sections */
section { scroll-margin-top: 24px; }
.section { padding-block: 84px 32px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px 24px; margin-bottom: 30px; }
.section-head h2 { margin: 0; font-weight: 700; font-size: clamp(34px, 4.4vw, 44px); letter-spacing: -0.02em; }
.section-head p { margin: 0; color: var(--muted); font-family: var(--mono); font-size: 13px; letter-spacing: 0.04em; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 40px 32px; padding-block: 84px 16px; }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat b { font-family: var(--display); font-weight: 700; font-size: 56px; line-height: 1; color: var(--sage); font-variant-numeric: tabular-nums; }
.stat span { color: var(--fg-2); font-size: 15px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.card { display: flex; flex-direction: column; gap: 16px; padding: 28px; border-radius: 16px; background: var(--raise); border: 1px solid var(--line); color: var(--fg); text-decoration: none; transition: border-color .2s; }
.card:hover { border-color: var(--sage); color: var(--fg); }
.card .tag { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; color: var(--teal); text-transform: uppercase; }
.card h3 { margin: 0; font-weight: 500; font-size: 26px; line-height: 1.15; }
.card p { margin: 0; color: var(--fg-2); font-size: 16px; }
.card .more { margin-top: auto; color: var(--sage); font-size: 15px; }
.card svg { width: 100%; height: auto; }

.notes { display: flex; flex-wrap: wrap; gap: 48px; }
.notes-intro { flex: 1 1 300px; display: flex; flex-direction: column; gap: 14px; }
.notes-intro h2 { margin: 0; font-weight: 700; font-size: clamp(34px, 4.4vw, 44px); letter-spacing: -0.02em; }
.notes-intro p { margin: 0; color: var(--fg-2); max-width: 40ch; }
.notes-list { flex: 999 1 560px; min-width: 0; margin: 0; padding: 0; list-style: none; }
.notes-list li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; padding: 22px 0; border-top: 1px solid var(--line); }
.notes-list li:last-child { border-bottom: 1px solid var(--line); }
.notes-list .title { font-family: var(--display); font-weight: 500; font-size: 24px; }
.notes-list .meta { font-family: var(--mono); font-size: 12px; color: var(--muted); text-transform: uppercase; }

.talks { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.talk { display: flex; flex-direction: column; gap: 8px; padding: 22px 24px; border-radius: 12px; border: 1px solid var(--line); color: var(--fg); text-decoration: none; }
a.talk:hover { border-color: var(--sage); color: var(--fg); }
.talk .meta { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.talk .title { font-family: var(--display); font-weight: 500; font-size: 21px; line-height: 1.25; }
.talk p { margin: 0; color: var(--fg-2); font-size: 15px; }

.about { display: flex; flex-wrap: wrap; align-items: center; gap: 48px; padding-block: 88px; }
.about-art { flex: 1 1 240px; display: flex; justify-content: center; }
.about-art img { width: 240px; }
.about-copy { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.about-copy h2 { margin: 0; font-weight: 700; font-size: clamp(34px, 4.4vw, 44px); letter-spacing: -0.02em; line-height: 1.05; }
.about-copy p { margin: 0; max-width: 62ch; color: var(--fg-2); }

/* Footer */
.footer { border-top: 1px solid #23272B; background: var(--bg-2); }
.footer-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 32px; padding-block: 56px 32px; }
.footer-cta { display: flex; flex-direction: column; gap: 10px; max-width: 460px; }
.footer-cta strong { font-family: var(--display); font-weight: 700; font-size: 28px; line-height: 1.2; }
.footer-cta .email { font-family: var(--mono); font-size: 15px; color: var(--sage); user-select: all; }
.footer-cta small { color: var(--muted); font-size: 15px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 24px; font-size: 15px; }
.footer-links a { color: var(--fg-2); }
.footer-fine { padding-block: 0 40px; font-size: 13px; color: var(--muted); }

/* Article pages */
.article-head { padding-block: 40px 56px; display: flex; flex-direction: column; gap: 18px; max-width: 860px; }
.article-head h1 { margin: 0; font-weight: 700; font-size: clamp(38px, 5.4vw, 64px); line-height: 1.04; letter-spacing: -0.025em; }
.article-head h1 em { font-style: normal; color: var(--sage); }
.article-head .dek { margin: 0; font-size: 21px; color: var(--fg-2); max-width: 60ch; }
.byline { display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.byline img { width: 36px; height: 36px; }
.prose { max-width: 700px; padding-bottom: 80px; }
.prose > * + * { margin-top: 1.1em; }
.prose p, .prose li { color: var(--fg-2); }
.prose h2 { margin-top: 2.2em; font-weight: 700; font-size: 30px; letter-spacing: -0.015em; color: var(--fg); }
.prose h3 { margin-top: 1.8em; font-weight: 500; font-size: 22px; color: var(--fg); }
.prose strong { color: var(--fg); font-weight: 500; }
.prose ul { padding-left: 1.2em; }
.prose blockquote { margin-left: 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--sage); color: var(--fg); font-family: var(--display); font-size: 24px; line-height: 1.3; }
.callout { padding: 20px 22px; border-radius: 12px; background: var(--raise); border: 1px solid var(--line); }
.callout .eyebrow { display: block; margin-bottom: 8px; color: var(--sage); }
.callout p { margin: 0; }
.status { display: inline-flex; align-items: center; gap: 8px; width: fit-content; font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--bg); background: var(--sage); padding: 5px 10px; border-radius: 6px; }

/* Figures and charts */
.figure { margin: 2em 0; padding: 24px; border-radius: 14px; background: var(--raise); border: 1px solid var(--line); }
.figure h3 { margin: 0 0 4px; font-size: 20px; font-weight: 500; color: var(--fg); }
.figure .sub { margin: 0 0 18px; font-size: 14px; color: var(--muted); }
.figure figcaption { margin-top: 14px; font-family: var(--mono); font-size: 12px; color: var(--muted); line-height: 1.5; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin: 0 0 14px; font-size: 13px; color: var(--fg-2); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart { width: 100%; overflow-x: auto; }
.chart svg { display: block; width: 100%; min-width: 520px; height: auto; }
.chart text { font-family: var(--mono); }
.chart .bar { transition: opacity .15s; }
.chart .bar:hover { opacity: .8; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.kpi { padding: 16px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.kpi .k { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.kpi .v { display: flex; align-items: baseline; gap: 10px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .a { font-family: var(--display); font-weight: 700; font-size: 26px; color: var(--sage); }
.kpi .b { font-family: var(--display); font-weight: 500; font-size: 20px; color: var(--neutral-mark); }
.kpi .b { color: #9AA0A6; }
.kpi .vs { font-size: 13px; color: var(--muted); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--line); }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th { color: var(--muted); font-family: var(--mono); font-weight: 400; font-size: 12px; }
table.data td { color: var(--fg-2); }
details.table-view { margin-top: 14px; }
details.table-view summary { cursor: pointer; font-family: var(--mono); font-size: 12px; color: var(--sage); }
details.table-view .scroll { overflow-x: auto; margin-top: 10px; }

.next { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; padding-bottom: 80px; }
.notes-list a.title { color: var(--fg); text-decoration: none; }
.notes-list a.title:hover { color: var(--sage); }

/* Code blocks in notes */
.prose pre { margin-top: 1.1em; padding: 16px 18px; border-radius: 10px; background: var(--raise); border: 1px solid var(--line); overflow-x: auto; }
.prose pre code { font-family: var(--mono); font-size: 13.5px; line-height: 1.6; color: var(--fg); white-space: pre; }
.prose table.data { margin-top: 1.4em; }

/* Percentiles chart animation (runs only when JS adds .pct-wait; reduced motion keeps it static) */
.pct-anim .pct-dot, .pct-anim .pct-ring { transform-box: fill-box; transform-origin: center; }
.pct-wait .pct-dot, .pct-wait .pct-band, .pct-wait .pct-ring, .pct-wait .pct-note, .pct-wait .pct-ends { opacity: 0; }
.pct-play .pct-ends { animation: pct-fade .5s ease-out forwards; }
.pct-play .pct-dot { animation: pct-pop .38s cubic-bezier(.3,1.5,.6,1) forwards; animation-delay: calc(var(--i) * 16ms); }
.pct-play .pct-band { animation: pct-fade .6s ease-out 1.9s forwards; }
.pct-play .pct-ring-p10 { animation: pct-fade .3s ease-out 2.2s forwards, pct-pulse 1.1s ease-in-out 2.5s 3; }
.pct-play .pct-note-p10 { animation: pct-slide .5s ease-out 2.3s forwards; }
.pct-play .pct-ring-med { animation: pct-fade .4s ease-out 3.0s forwards; }
.pct-play .pct-note-med { animation: pct-slide .5s ease-out 3.1s forwards; }
@keyframes pct-pop { from { opacity: 0; transform: scale(.2); } to { opacity: 1; transform: scale(1); } }
@keyframes pct-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pct-slide { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@keyframes pct-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.35); } }
.pct-replay { margin-top: 12px; font-family: var(--mono); font-size: 12px; color: var(--sage); background: none; border: 1px solid var(--line-2); border-radius: 6px; padding: 5px 12px; cursor: pointer; }
.pct-replay:hover { border-color: var(--sage); }

/* Code syntax colors (site palette) */
.prose pre.code { position: relative; padding-top: 30px; }
.prose pre.code::before { content: attr(data-lang); position: absolute; top: 9px; right: 14px; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tk-k { color: var(--teal); }
.tk-f { color: var(--sage); }
.tk-s { color: var(--sage-hi); }
.tk-n { color: #E6C07B; }
.tk-p { color: var(--muted); }

/* Histogram animation (SQL or Python post). Runs only when JS adds .hist-wait; reduced motion keeps it static */
.hist-anim .hist-bar rect:first-child { transform-box: fill-box; transform-origin: bottom; }
.hist-anim .hist-bar:hover rect:first-child { filter: brightness(1.25); }
.hist-wait .hist-bar rect:first-child { transform: scaleY(0); }
.hist-wait .hist-mark { opacity: 0; }
.hist-play .hist-bar rect:first-child { animation: hist-grow .55s cubic-bezier(.2,.9,.3,1) forwards; animation-delay: calc(var(--i) * 45ms); }
.hist-play .hist-p10 { animation: hist-drop .5s ease-out 1.25s forwards; }
.hist-play .hist-med { animation: hist-drop .5s ease-out 1.85s forwards; }
.hist-play .hist-test { animation: hist-drop .5s ease-out 2.45s forwards; }
@keyframes hist-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes hist-drop { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* Fort Bend vs Waller chart (Percentiles post). Medians land first, then the 10th percentiles slide out. */
.pair-anim circle { transform-box: fill-box; transform-origin: center; }
.pair-wait .pair-ax, .pair-wait .pair-bar, .pair-wait .pair-p90, .pair-wait .pair-med, .pair-wait .pair-medlab, .pair-wait .pair-p10, .pair-wait .pair-p10lab { opacity: 0; }
.pair-play .pair-ax { animation: pct-fade .5s ease-out forwards; }
.pair-play .pair-med { animation: pct-pop .4s cubic-bezier(.3,1.5,.6,1) .4s forwards; }
.pair-play .pair-medlab { animation: pct-fade .4s ease-out .7s forwards; }
.pair-play .pair-bar { animation: pct-fade .6s ease-out 1.5s forwards; }
.pair-play .pair-p90 { animation: pct-pop .4s cubic-bezier(.3,1.5,.6,1) 1.6s forwards; }
.pair-play .pair-p10 { animation: pair-slide 1.3s cubic-bezier(.2,.7,.2,1) 1.5s forwards; }
.pair-play .pair-p10lab { animation: pct-fade .4s ease-out 2.8s forwards; }
@keyframes pair-slide { 0% { opacity: 0; transform: translateX(var(--dx)); } 15% { opacity: 1; } 100% { opacity: 1; transform: none; } }
.prose .notes-list .pinned .meta, .notes-list .pinned .meta { color: var(--sage); }

/* ---------- Light theme ("Paper and Sage"). Dark stays the default; light is opt-in via the nav toggle. ----------
   Same hues as dark, in deeper shades so they read on paper. When adding a chart, use the palette hexes below
   (or tokens) so these mappings recolor it, and check the page in both themes before deploying. */
html[data-theme="light"] {
  --bg: #F5F4EF; --bg-2: #EEECE5; --raise: #FFFFFF; --line: #E2DFD6; --line-2: #CDC9BE;
  --fg: #16191B; --fg-2: #3C4146; --muted: #656B71;
  --sage: #4A7543; --sage-hi: #36592F; --sage-fill: #A9C4A1; --sage-tint: #E8EFE5;
  --teal: #1D7A89; --neutral-mark: #C9CDD0;
  color-scheme: light;
}
html[data-theme="light"] .btn-primary, html[data-theme="light"] .status { background: var(--sage-fill); color: var(--fg); }
html[data-theme="light"] .btn-primary:hover { background: #95B58C; color: var(--fg); }
html[data-theme="light"] .nav-links .btn, html[data-theme="light"] .nav-links .btn:hover { color: var(--fg); }
html[data-theme="light"] .strip, html[data-theme="light"] .footer { border-color: var(--line); }
html[data-theme="light"] .callout { background: var(--sage-tint); border-color: #D3E0CE; }
html[data-theme="light"] .flares::before { background: radial-gradient(circle, rgba(169,196,161,0.55) 0%, rgba(169,196,161,0) 68%); }
html[data-theme="light"] .flares::after { background: radial-gradient(circle, rgba(51,166,184,0.22) 0%, rgba(51,166,184,0) 68%); }
html[data-theme="light"] .dots { background-image: radial-gradient(rgba(22,25,27,0.08) 1.5px, transparent 1.7px); }
html[data-theme="light"] .avatar-orbit::before { border-color: rgba(74,117,67,0.35); }
html[data-theme="light"] .avatar-orbit::after { border-color: rgba(29,122,137,0.25); }
html[data-theme="light"] .tk-n { color: #8A5F0E; }
html[data-theme="light"] .kpi .b { color: var(--muted); }
html[data-theme="light"] .legend i[style*="#ECEEEF"] { background: var(--fg) !important; }
html[data-theme="light"] .legend i[style*="#4A5056"] { background: var(--neutral-mark) !important; }
html[data-theme="light"] .legend i[style*="#6B7177"] { background: #9AA0A6 !important; }
/* Inline SVG charts: map the dark palette to light tokens (CSS beats SVG presentation attributes). */
html[data-theme="light"] main svg [fill="#ECEEEF"] { fill: var(--fg); }
html[data-theme="light"] main svg [stroke="#ECEEEF"] { stroke: var(--fg); }
html[data-theme="light"] main svg [fill="#C9CDD0"] { fill: var(--fg-2); }
html[data-theme="light"] main svg [fill="#8E9499"] { fill: var(--muted); }
html[data-theme="light"] main svg [fill="#A9C4A1"] { fill: #7FA676; }
html[data-theme="light"] main svg [stroke="#A9C4A1"] { stroke: #7FA676; }
html[data-theme="light"] main svg text[fill="#A9C4A1"] { fill: var(--sage); }
html[data-theme="light"] main svg [fill="#33A6B8"] { fill: var(--teal); }
html[data-theme="light"] main svg [stroke="#33A6B8"] { stroke: var(--teal); }
html[data-theme="light"] main svg [fill="#D0912A"] { fill: #A86F14; }
html[data-theme="light"] main svg [stroke="#D0912A"] { stroke: #A86F14; }
html[data-theme="light"] main svg [fill="#4A5056"] { fill: var(--neutral-mark); }
html[data-theme="light"] main svg [fill="#6B7177"] { fill: #9AA0A6; }
html[data-theme="light"] main svg [stroke="#6B7177"] { stroke: var(--line-2); }
html[data-theme="light"] main svg [stroke="#2A2E33"], html[data-theme="light"] main svg [stroke="#3A3F45"] { stroke: var(--line); }
html[data-theme="light"] main svg [stroke="#1B1E21"] { stroke: var(--raise); }
/* Percentiles 100-dot grid: pale gray at the slow end to sage at the fast end */
html[data-theme="light"] .pct-dot { fill: color-mix(in srgb, #7FA676 calc(var(--i) * 1%), #D3D6D8); }

/* Theme toggle button */
.theme-toggle { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 8px; border: 1px solid var(--line-2); background: none; color: var(--fg-2); cursor: pointer; }
.theme-toggle:hover { border-color: var(--sage); color: var(--fg); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .moon { display: none; }
html[data-theme="light"] .theme-toggle .sun { display: none; }
html[data-theme="light"] .theme-toggle .moon { display: block; }

/* County picker (Percentiles post) */
.cc-pickers { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin: 2px 0 18px; }
.cc-pickers label { display: flex; flex-direction: column; gap: 6px; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.cc-pickers select { appearance: none; -webkit-appearance: none; min-width: 190px; padding: 9px 36px 9px 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg) 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.5l5 5 5-5' fill='none' stroke='%238E9499' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center; color: var(--fg); font: 15px/1.3 var(--body); letter-spacing: 0; text-transform: none; cursor: pointer; }
.cc-pickers select:hover { border-color: var(--sage); }
.cc-pickers select:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }
.cc-vs { padding-bottom: 10px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.cc-pickers + .legend { margin-top: 0; }
#pair-chart svg { min-width: 0; }
@media (max-width: 600px) {
  #pair-chart .cc-name { font-size: 24px; }
  #pair-chart .cc-lab { font-size: 21px; }
  #pair-chart .cc-tick { font-size: 19px; }
  .cc-pickers select { min-width: 0; width: 100%; }
  .cc-pickers label { flex: 1 1 140px; }
  .cc-vs { display: none; }
}
.cc-readout { margin: 12px 0 0; font-family: var(--mono); font-size: 13px; color: var(--fg-2); }

/* LinkedIn link in the nav (text + arrow, styled like the theme toggle) */
.nav-links .nav-social { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-2); color: var(--sage); font-size: 15px; }
.nav-links .nav-social svg { width: 12px; height: 12px; }
.nav-links .nav-social:hover { border-color: var(--sage); color: var(--sage-hi); }

/* Follow-along block at the end of every note and story */
.follow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px 28px; max-width: 700px; margin: 0 0 56px; padding: 24px 26px; border-radius: 14px; background: var(--raise); border: 1px solid var(--line); }
.follow-copy { flex: 1 1 320px; }
.follow .eyebrow { display: block; margin-bottom: 8px; color: var(--sage); }
.follow p { margin: 0; color: var(--fg-2); }
.follow-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 8px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.follow-btn svg { width: 12px; height: 12px; }
html[data-theme="light"] .follow { background: var(--sage-tint); border-color: #D3E0CE; }

/* Beryl reachability chart: 2023 baseline, then 2024 draws left to right like time passing */
.ber-wait .ber-line { stroke-dasharray: 1; stroke-dashoffset: 1; }
.ber-wait .ber-gap, .ber-wait .ber-land, .ber-wait .ber-note, .ber-wait .ber-ax { opacity: 0; }
.ber-play .ber-ax { animation: pct-fade .4s ease-out forwards; }
.ber-play .ber-2023 { animation: ber-draw 1.2s ease-out .1s forwards; }
.ber-play .ber-2024 { animation: ber-draw 3.2s linear .3s forwards; }
.ber-play .ber-land, .ber-play .ber-note { animation: pct-fade .5s ease-out var(--at) forwards; }
.ber-play .ber-gap { animation: pct-fade .8s ease-out 3.5s forwards; }
@keyframes ber-draw { to { stroke-dashoffset: 0; } }
@media (max-width: 600px) {
  #ber-chart .ber-t { font-size: 16px; }
  #ber-chart .ber-tick { font-size: 14px; }
}

/* Beryl speed-test bars: grow from the zero line, one after another */
.st-anim rect { transform-box: view-box; }
.st-wait .st-bar rect { transform: scaleY(0); }
.st-wait .st-val, .st-wait .st-ax { opacity: 0; }
.st-play .st-ax { animation: pct-fade .4s ease-out forwards; }
.st-play .st-bar rect { animation: st-grow .7s cubic-bezier(.2,.8,.2,1) calc(.3s + var(--i) * var(--step, .35s)) forwards; }
.st-play .st-val { animation: pct-fade .4s ease-out calc(.8s + var(--i) * var(--step, .35s)) forwards; }
@keyframes st-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* Notes and stories: one centered reading column, so the extra width splits evenly left and right */
.reading .article-head, .reading .prose, .reading .follow, .reading .next { max-width: 760px; margin-inline: auto; }
.reading .follow { margin-bottom: 56px; }

/* Phones: charts swap to a narrow layout drawn for small screens (.m-only); the wide one (.d-only) shows above 600px */
.chart .m-only { display: none; }
@media (max-width: 600px) {
  .chart .d-only { display: none; }
  .chart .m-only { display: block; min-width: 0; }
  .nav { gap: 10px; padding-block: 18px; }
  .nav-links { gap: 2px 18px; }
  .nav-links > a:not(.btn):not(.nav-social) { display: inline-flex; align-items: center; min-height: 44px; }
  .nav-links .nav-social, .nav-links .btn, .theme-toggle { min-height: 44px; }
  .theme-toggle { width: 44px; }
  .figure { padding: 16px 14px; }
  .ss-seg button, .ss-btn, .sv-seg button, .sv-btn { min-height: 44px; }
  .section-head p a { display: inline-flex; align-items: center; min-height: 44px; }
}
