/* PyStatlas — Apple-style: white page, SF typography, quiet greys, blue accents */
:root {
  --bg: #ffffff;
  --bg-2: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --text-2: #424245;
  --text-3: #6e6e73;
  --text-4: #86868b;
  --line: #d2d2d7;
  --line-2: #e8e8ed;
  --link: #0066cc;
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --shadow: 0 2px 6px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --shadow-hover: 0 4px 10px rgba(0,0,0,.06), 0 18px 44px rgba(0,0,0,.12);
  --code-bg: #f5f5f7;
  --c-kw: #ad3da4; --c-str: #c41a16; --c-com: #8a8a8e; --c-num: #1c00cf;
  --c-fn: #326d74; --c-bi: #6c36a9; --c-ns: #3e8087; --c-op: #1d1d1f;
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Inter, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
:lang(ja) { --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "SF Pro Text", Inter, sans-serif; }
:lang(zh-Hans) { --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei", "SF Pro Text", Inter, sans-serif; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 17px; line-height: 1.47; letter-spacing: -.022em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body:lang(ja), body:lang(zh-Hans) { letter-spacing: 0; line-height: 1.7; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; height: auto; }
code { font-family: var(--mono); font-size: .85em; background: var(--bg-2); padding: .1em .4em; border-radius: 6px; letter-spacing: 0; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 22px; }
h1, h2, h3 { font-weight: 600; color: var(--text); }

/* ---------- global nav */
.nav { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.8);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0,0,0,.08); }
.nav-inner { max-width: 1180px; margin: 0 auto; padding: 0 22px; height: 48px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 600; font-size: 19px; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.logo { width: 24px; height: 24px; }
.nav-links { display: flex; align-items: center; gap: 24px; font-size: 13px; letter-spacing: -.01em; }
.nav-links > a { color: var(--text); opacity: .8; transition: opacity .2s; }
.nav-links > a:hover, .nav-links > a.on { opacity: 1; text-decoration: none; }
.nav-links .gh { display: flex; }

/* language menu */
.lang { position: relative; }
.lang summary { list-style: none; display: flex; align-items: center; gap: 5px; cursor: pointer; color: var(--text); opacity: .8; font-size: 13px; }
.lang summary::-webkit-details-marker { display: none; }
.lang summary:hover, .lang[open] summary { opacity: 1; }
.lang-menu { position: absolute; right: -10px; top: 30px; background: rgba(255,255,255,.97); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow-hover); padding: 6px; min-width: 160px; display: flex; flex-direction: column; }
.lang-menu a { color: var(--text); padding: 8px 12px; border-radius: 9px; font-size: 14px; }
.lang-menu a:hover { background: var(--bg-2); text-decoration: none; }
.lang-menu a.on { font-weight: 600; }
.lang-menu a.on::after { content: "✓"; float: right; color: var(--blue); margin-left: 12px; }

/* ---------- hero */
.hero { padding: 92px 0 46px; text-align: center; }
.hero h1 { font-size: clamp(44px, 7vw, 80px); line-height: 1.05; letter-spacing: -.035em; font-weight: 700; margin: 12px 0 20px; }
.hero h1:lang(ja), .hero h1:lang(zh-Hans) { letter-spacing: 0; line-height: 1.2; }
.h-accent { color: var(--text-4); }
.eyebrow { font-size: 17px; font-weight: 600; color: var(--text-3); margin: 0; letter-spacing: -.01em; }
.kicker { font-size: 12px; font-weight: 600; color: var(--text-4); letter-spacing: 0; }
.lede { font-size: clamp(19px, 2.2vw, 24px); color: var(--text-3); max-width: 760px; margin: 0 auto; line-height: 1.38; font-weight: 400; letter-spacing: .005em; }
.hero-sm { padding: 54px 0 28px; text-align: left; }
.hero-sm h1 { font-size: clamp(38px, 5.2vw, 56px); margin: 8px 0 12px; letter-spacing: -.03em; }
.hero-sm .lede { margin: 0; }

.search { position: relative; max-width: 620px; margin: 36px auto 0; }
.search svg { position: absolute; left: 18px; top: 50%; width: 19px; height: 19px; transform: translateY(-50%); fill: none; stroke: var(--text-4); stroke-width: 2; stroke-linecap: round; }
.search input { width: 100%; height: 54px; border-radius: 14px; border: 1px solid var(--line); background: #fff;
  color: var(--text); font: inherit; font-size: 17px; padding: 0 54px 0 48px; outline: none; transition: border-color .2s, box-shadow .2s; }
.search input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0,113,227,.18); }
.search input::placeholder { color: var(--text-4); }
.search kbd { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: 12px; color: var(--text-4);
  border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; background: var(--bg-2); }

/* search suggestions: matching charts, with where each one matched */
.suggest { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 8px); text-align: left; background: #fff;
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-hover); max-height: min(560px, 70vh); overflow-y: auto; padding: 6px; }
.sg-item { display: flex; gap: 12px; align-items: flex-start; padding: 9px 10px; border-radius: 10px; color: var(--text); }
.sg-item:hover, .sg-item.on { background: var(--bg-2); text-decoration: none; }
.sg-item img { width: 76px; aspect-ratio: 16/10; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #fff; flex: none; }
.sg-text { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.sg-fam { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-4); }
.sg-title { font-size: 15px; font-weight: 600; line-height: 1.3; }
.sg-why { font-size: 13px; line-height: 1.45; color: var(--text-3, #6e6e73); overflow-wrap: anywhere; }
.sg-why b { font-weight: 600; color: var(--text); margin-right: 4px; }
.sg-why mark { background: rgba(0,113,227,.14); color: inherit; border-radius: 3px; padding: 0 1px; }
.sg-all { display: block; width: 100%; margin-top: 4px; padding: 10px; border: 0; border-top: 1px solid var(--line); background: none;
  font: inherit; font-size: 14px; color: var(--link); cursor: pointer; border-radius: 0 0 10px 10px; }
.sg-all:hover { background: var(--bg-2); }
.sg-none { margin: 0; padding: 14px; font-size: 14px; color: var(--text-4); }
@media (max-width: 640px) { .sg-item img { width: 56px; } .sg-why { font-size: 12.5px; } }

/* ---------- family tiles */
.band { padding: 10px 0 30px; }
.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.tile { position: relative; background: var(--bg-2); border-radius: 18px; overflow: hidden; color: var(--text); display: flex; flex-direction: column;
  transition: transform .35s cubic-bezier(.25,.1,.25,1), box-shadow .35s; }
.tile:hover { transform: scale(1.02); box-shadow: var(--shadow); text-decoration: none; }
.tile img { aspect-ratio: 16/10; object-fit: cover; margin: 10px 10px 0; width: calc(100% - 20px); border-radius: 10px; background: #fff; }
.tile span { font-size: 15px; font-weight: 600; padding: 10px 14px 14px; line-height: 1.25; }
.tile em { position: absolute; top: 16px; right: 16px; font-style: normal; font-size: 11px; font-weight: 600; color: var(--text);
  background: rgba(255,255,255,.9); backdrop-filter: blur(6px); border-radius: 99px; padding: 2px 8px; box-shadow: 0 1px 3px rgba(0,0,0,.1); }

/* ---------- filter pills */
.chips { position: sticky; top: 48px; z-index: 20; display: flex; gap: 8px; overflow-x: auto; padding: 12px 0; margin: 0 0 6px;
  background: rgba(255,255,255,.92); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid transparent; background: var(--bg-2); color: var(--text); font: inherit; font-size: 14px; font-weight: 400;
  padding: 7px 16px; border-radius: 99px; cursor: pointer; transition: background .2s, color .2s; letter-spacing: -.01em; }
.chip:hover { background: var(--line-2); }
.chip.on { background: var(--text); color: #fff; }

/* ---------- sections + grid */
.cat { padding: 30px 0 34px; }
.cat-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 20px; }
.cat-head h2 { font-size: 32px; letter-spacing: -.028em; margin: 0 0 4px; font-weight: 700; }
.cat-head p { margin: 0; color: var(--text-3); font-size: 17px; }
.more { white-space: nowrap; font-size: 17px; }
.section { padding-bottom: 40px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.card { display: flex; flex-direction: column; background: var(--card); border-radius: var(--radius); overflow: hidden; color: var(--text);
  box-shadow: var(--shadow); transition: transform .35s cubic-bezier(.25,.1,.25,1), box-shadow .35s; }
.card:hover { transform: scale(1.015); box-shadow: var(--shadow-hover); text-decoration: none; }
.card-img { background: #fff; padding: 8px 8px 0; }
.card-img img { width: 100%; aspect-ratio: 16/10; object-fit: contain; }
.card-body { padding: 14px 20px 20px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.card h3 { margin: 0; font-size: 19px; letter-spacing: -.02em; line-height: 1.22; }
.card p { margin: 3px 0 0; color: var(--text-3); font-size: 14.5px; line-height: 1.42; flex: 1; letter-spacing: -.01em; }
.card-r { font-family: var(--mono); font-size: 12px; color: var(--text-4); margin-top: 8px; letter-spacing: 0; }
.empty { text-align: center; color: var(--text-3); padding: 60px 0; font-size: 19px; }
[hidden] { display: none !important; }

/* ---------- example page */
.crumbs { font-size: 13px; color: var(--text-4); display: flex; gap: 8px; padding-top: 26px; }
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--link); }
.ex-head h1 { font-size: clamp(38px, 5vw, 56px); letter-spacing: -.032em; line-height: 1.07; margin: 12px 0 10px; font-weight: 700; }
.ex-head h1:lang(ja), .ex-head h1:lang(zh-Hans), .hero-sm h1:lang(ja), .hero-sm h1:lang(zh-Hans) { letter-spacing: 0; line-height: 1.25; }
.ex-head .lede { margin: 0; }
.figure { margin: 34px 0 34px; background: #fff; border-radius: 24px; padding: clamp(12px, 2.4vw, 32px); box-shadow: var(--shadow); }
.figure img { margin: 0 auto; max-height: 720px; width: auto; cursor: zoom-in; }
.ex-cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 50px; margin-bottom: 36px; }
.prose p { margin: 0 0 14px; color: var(--text-2); font-size: 17px; }
.prose .note { color: var(--text-4); font-size: 14px; }
.prose.wide { max-width: 800px; padding-bottom: 40px; }
.prose h2 { font-size: 28px; letter-spacing: -.025em; margin: 40px 0 12px; }
.prose li { color: var(--text-2); margin-bottom: 8px; }
.meta { display: flex; flex-direction: column; gap: 18px; border-left: 1px solid var(--line-2); padding-left: 28px; }
.meta-row span { display: block; font-size: 12px; color: var(--text-4); font-weight: 600; margin-bottom: 6px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills i { font-style: normal; font-size: 13px; background: var(--bg-2); color: var(--text-2); border-radius: 99px; padding: 3px 11px; }

.code-card { background: var(--code-bg); border-radius: 18px; overflow: hidden; margin-bottom: 14px; }
.code-bar { display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 20px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.fname { font-family: var(--mono); font-size: 13px; color: var(--text-3); letter-spacing: 0; }
.code-actions { margin-left: auto; display: flex; gap: 8px; }
.btn { font: inherit; font-size: 14px; font-weight: 400; border-radius: 99px; padding: 7px 16px; cursor: pointer; border: 0; letter-spacing: -.01em; }
.btn.ghost { background: transparent; color: var(--link); border: 1px solid var(--link); }
.btn.ghost:hover { background: rgba(0,102,204,.06); text-decoration: none; }
.btn.copy { background: var(--blue); color: #fff; min-width: 100px; }
.btn.copy:hover { background: var(--blue-hover); }
.btn.done, .btn.copy.done { background: #1d1d1f; color: #fff; border-color: #1d1d1f; }
pre.code { margin: 0; padding: 22px 24px; overflow-x: auto; font-family: var(--mono); font-size: 13.5px; line-height: 1.62; color: var(--text); tab-size: 4; letter-spacing: 0;
  font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
pre.code code { background: none; padding: 0; font-size: inherit; }
.hint { font-size: 14px; color: var(--text-3); margin: 0 0 40px; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0 50px; }
.pager a { background: var(--bg-2); border-radius: 18px; padding: 16px 22px; color: var(--text); font-weight: 600; transition: background .2s; }
.pager a:hover { text-decoration: none; background: var(--line-2); }
.pager small { display: block; font-weight: 400; color: var(--text-4); font-size: 13px; }
.pager .next { text-align: right; }
.rel-h { font-size: 28px; letter-spacing: -.025em; margin: 10px 0 18px; }
.ex .grid { margin-bottom: 60px; }

/* ---------- style page */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 20px 0 40px; }
.steps > div { background: var(--bg-2); border-radius: 18px; padding: 24px; }
.steps b { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--text); color: #fff; font-size: 14px; }
.steps h3 { margin: 14px 0 4px; font-size: 21px; }
.steps p { margin: 0; color: var(--text-3); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 14px; margin-bottom: 40px; }
.sw i { display: block; height: 64px; border-radius: 14px; margin-bottom: 8px; }
.sw code { background: none; padding: 0; color: var(--text-3); }
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th, .tbl td { text-align: left; padding: 11px 12px 11px 0; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl th { color: var(--text-4); font-weight: 600; font-size: 12px; }

/* ---------- author & citation */
.byline { margin: 18px 0 0; font-size: 15px; color: var(--text-4); }
.byline a { font-weight: 500; }
.cite { margin: 34px 0 50px; padding: 30px; border-radius: 22px; background: var(--bg-2); }
.cite-head h2 { font-size: 24px; letter-spacing: -.02em; margin: 0 0 6px; }
.cite-head p { margin: 0 0 18px; color: var(--text-3); font-size: 15px; }
.cite-box { display: flex; gap: 14px; align-items: flex-start; background: #fff; border-radius: 14px; padding: 14px 16px; margin-top: 10px; }
.cite-box > :first-child { flex: 1; min-width: 0; }
.cite-ref { margin: 0 !important; font-size: 15px !important; color: var(--text-2); overflow-wrap: anywhere; }
.cite-bib { margin: 0; font-family: var(--mono); font-size: 12.5px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; letter-spacing: 0; }
.cite-box .btn { flex: none; }

/* ---------- footer */
.foot { background: var(--bg-2); padding: 22px 0 30px; font-size: 12px; color: var(--text-3); margin-top: 40px; letter-spacing: -.01em; }
.foot-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; line-height: 1.7; }
.foot strong { color: var(--text-2); }
.foot-links { display: flex; gap: 18px; flex-wrap: wrap; }
.foot-links a { color: var(--text-3); }
.foot-langs { display: flex; gap: 16px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.foot-langs a { color: var(--text-3); }
.foot-langs a.on { color: var(--text); font-weight: 600; }

/* ---------- lightbox */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(255,255,255,.94); backdrop-filter: blur(10px); display: grid; place-items: center; padding: 24px; cursor: zoom-out; animation: fade .25s ease; }
.lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 14px; background: #fff; box-shadow: var(--shadow-hover); }
@keyframes fade { from { opacity: 0 } }

/* ---------- responsive */
@media (max-width: 1000px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 820px) {
  .ex-cols { grid-template-columns: 1fr; gap: 20px; }
  .meta { border-left: 0; padding-left: 0; }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap, .nav-inner { padding: 0 16px; }
  .hero { padding: 56px 0 28px; }
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .nav-links { gap: 14px; }
  .hide-sm, .lang summary span { display: none; }
  .cat-head { flex-direction: column; align-items: start; gap: 6px; }
  .grid { grid-template-columns: 1fr; }
  .search kbd { display: none; }
  .search input { font-size: 16px; padding-right: 16px; }
  .code-actions { margin-left: 0; width: 100%; }
  .pager { grid-template-columns: 1fr; }
  pre.code { font-size: 12.5px; padding: 18px; }
  .cite { padding: 20px; }
  .cite-box { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } html { scroll-behavior: auto; } }

/* --- thank-you section (About / Cite page) --- */
.thanks { margin: 10px 0 40px; }
.thanks h3 { font-size: 17px; margin: 22px 0 6px; }
.thanks ul { margin: 0; padding-left: 20px; }
.thanks li { margin: 3px 0; font-size: 15px; }
.thanks .pkgs { margin: 0; font-size: 15px; line-height: 1.8; }

/* --- subcategories (e.g. Machine learning → Advanced) --- */
.sub-head { margin: 40px 0 18px; padding-top: 26px; border-top: 1px solid var(--line-2); }
.sub-head h3 { font-size: 22px; letter-spacing: -.02em; margin: 0 0 4px; font-weight: 700; }
.sub-head p { margin: 0; color: var(--text-3); font-size: 15px; }

/* --- home: how to use the gallery --- */
.approach { max-width: 680px; margin: 18px auto 0; color: var(--text-3); font-size: 16px; line-height: 1.55; }

/* --- data sources (chart pages and About) --- */
.data-src { margin: 30px 0; }
.data-src h2 { font-size: 22px; letter-spacing: -.02em; margin: 0 0 10px; }
.data-src ul { margin: 0; padding-left: 20px; }
.data-src li { margin: 8px 0; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.src-note, .src-used { color: var(--text-3); font-size: 14px; }
.src-disclaimer { margin-top: 12px; padding: 12px 16px; border-radius: 12px; background: var(--bg-2); color: var(--text-3); font-size: 14px; }

/* --- pygments (generated) --- */

.code .k,.code .kn,.code .kd,.code .kc,.code .ow{color:var(--c-kw);font-weight:500}
.code .s,.code .s1,.code .s2,.code .sa,.code .sd,.code .se,.code .si,.code .sb{color:var(--c-str)}
.code .c,.code .c1,.code .cm,.code .ch{color:var(--c-com);font-style:italic}
.code .mi,.code .mf,.code .mh,.code .mo{color:var(--c-num)}
.code .nf,.code .fm{color:var(--c-fn)}
.code .nb,.code .bp{color:var(--c-bi)}
.code .nn{color:var(--c-ns)}
.code .o{color:var(--c-op)}
.code .nd{color:var(--c-kw)}
