:root {
  --paper: #f7f5f0;
  --card: #ffffff;
  --ink: #1c2126;
  --muted: #5f6870;
  --line: #e3dfd6;
  --accent: #c8541a;
  --stage-a: #262d34;
  --stage-b: #12161a;
  --bone: #e4dcc6;
  --a: #6fb1dc; --b: #8fcf82; --c: #e3b85c; --d: #e58fbd; --focus: #ff8a3d;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-size: 16px; line-height: 1.6; }
a { color: var(--accent); text-underline-offset: 2px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ---------- header ----------
   Row 1: brand, search, the body regions (into the menu when there is no room), the menu.
   Row 2 (on region pages): the region's name and its systems. Where you are is one underline in
   the accent colour, in both rows. */
.site-head { position: relative; z-index: 20; border-bottom: 1px solid var(--line); background: var(--card); }
.site-head > .wrap { position: relative; display: flex; align-items: center; gap: 14px; height: 58px; }
.site-head .brand { flex: none; display: flex; align-items: center; gap: 9px; font-weight: 500; font-size: 18px; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; white-space: nowrap; }
.site-head .brand img { width: 36px; height: 36px; object-fit: contain; }
.site-head .brand b { font-weight: 800; }
.site-foot { border-top: 1px solid var(--line); text-align: center; padding: 22px 16px; font-size: 14px; color: var(--muted); }
.site-foot p { margin: 0; }
.site-head .regions, .site-head .subnav nav { display: flex; align-self: stretch; overflow-x: auto; scrollbar-width: none; }
.site-head .regions::-webkit-scrollbar, .site-head .subnav nav::-webkit-scrollbar { display: none; }
.site-head .regions a, .site-head .subnav a { flex: none; display: flex; align-items: center; color: var(--muted); text-decoration: none; white-space: nowrap; }
.site-head .regions a:hover, .site-head .subnav a:hover { color: var(--ink); }
.site-head .regions a[aria-current], .site-head .subnav a[aria-current] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
/* level 1: body regions, head to toe */
.site-head .regions { flex: none; margin-left: auto; gap: 2px; font-size: 15px; }
.site-head .regions a { padding: 0 7px; font-weight: 500; color: #3d454c; }
/* level 2: the current region's name, then its systems */
/* the language menu: this page in the other languages it has (a <details>, like the main menu) */
.site-head .lang-menu { position: relative; flex: none; }
.site-head .lang-menu summary { display: flex; align-items: center; gap: 5px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; list-style: none; white-space: nowrap; }
.site-head .lang-menu summary::-webkit-details-marker { display: none; }
.site-head .lang-menu summary:hover, .site-head .lang-menu[open] summary { color: var(--ink); border-color: currentColor; }
.site-head .lang-panel { position: absolute; z-index: 3; top: calc(100% + 6px); right: 0; min-width: 160px; margin: 0; padding: 6px; list-style: none; border: 1px solid var(--line); border-radius: 12px; background: var(--card); box-shadow: 0 16px 40px rgba(20, 24, 28, 0.14); }
.site-head .lang-panel a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--ink); font-size: 15px; text-decoration: none; }
.site-head .lang-panel a:hover { background: #f1eee7; }
.site-head .lang-panel a[aria-current] { color: var(--accent); font-weight: 600; }
/* after a link from a Portuguese page to a page that is only in English */
.lang-note { font-size: 0.85em; color: var(--muted); white-space: nowrap; }
.site-head .subnav { border-top: 1px solid var(--line); background: #fbfaf7; }
.site-head .subnav .wrap { height: 40px; gap: 22px; font-size: 14px; }
.site-head .subnav a[aria-current] { font-weight: 600; }
.site-head .subnav .here { flex: none; align-self: center; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
/* search (search.js): a field beside the brand; an icon on phones */
/* the search box gives up its width to the region links, which are longer in some languages; it can shrink to its icon */
.site-head .search-open { container-type: inline-size; flex: 0 1 300px; min-width: 40px; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 7px 0 12px; border: 1px solid var(--line); border-radius: 999px; background: #fbfaf7; color: #7a8288; font-size: 14.5px; text-decoration: none; cursor: text; }
.site-head .search-open:hover { border-color: #cfc9bc; color: var(--muted); }
.site-head .search-open svg { flex: none; color: var(--muted); }
.site-head .search-open .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-head .search-open kbd { flex: none; font: 600 11.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace; border: 1px solid var(--line); border-radius: 5px; padding: 3px 6px; background: var(--card); color: var(--muted); }
@container (max-width: 170px) { .site-head .search-open kbd { display: none; } }
@container (max-width: 80px) { .site-head .search-open .label { display: none; } }
/* the menu (menu.js): regions where the header has no room for them, the whole body, the index */
.site-head .menu { flex: none; }
.site-head .menu summary { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-right: -8px; border-radius: 10px; color: var(--ink); cursor: pointer; list-style: none; }
.site-head .menu summary::-webkit-details-marker { display: none; }
.site-head .menu summary:hover, .site-head .menu[open] summary { background: #f1eee7; }
.site-head .menu-panel { position: absolute; z-index: 2; top: calc(100% - 4px); right: 12px; width: 300px; max-height: calc(100vh - 80px); overflow-y: auto; padding: 8px 20px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); box-shadow: 0 16px 40px rgba(20, 24, 28, 0.14); }
.site-head .menu-panel h2 { margin: 12px 0 4px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.site-head .menu-panel ul { margin: 0; padding: 0; list-style: none; }
.site-head .menu-panel li a { display: flex; align-items: center; min-height: 36px; color: var(--ink); font-size: 15px; text-decoration: none; }
.site-head .menu-panel li a:hover { color: var(--accent); }
.site-head .menu-panel li a[aria-current] { color: var(--accent); font-weight: 600; }
.site-head .menu-index { display: block; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--accent); font-size: 15px; font-weight: 600; text-decoration: none; }
.site-head .menu-regions { display: none; }
/* no room for the regions: they move into the menu, and the search field takes the space */
@media (max-width: 1100px) {
  .site-head .regions { display: none; }
  .site-head .search-open { flex: 1 1 auto; max-width: 440px; margin-left: auto; }
  .site-head .menu-regions { display: block; }
  .site-head .menu-panel { width: 420px; display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
  .site-head .menu-index { grid-column: 1 / -1; }
}

.crumbs { font-size: 13px; color: var(--muted); padding: 18px 0 0; }
.crumbs a { color: var(--muted); }
.crumbs span[aria-hidden] { margin: 0 6px; }

/* ---------- article ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; padding: 10px 0 14px; }
.page-head h1 { margin: 0; font-size: clamp(28px, 4.2vw, 40px); line-height: 1.12; letter-spacing: -0.02em; }
.page-head .latin { margin: 0; font-style: italic; color: var(--accent); font-size: 17px; }

.layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 28px; align-items: start; }
/* The model spans the full content width; its heading and intro text sit above it. */
.stage { margin-bottom: 30px; }
.stage-intro { max-width: 82ch; margin-bottom: 14px; }
.stage-intro h2 { margin-bottom: 4px; }
.stage-intro .lead { margin: 10px 0 0; font-size: 18px; line-height: 1.55; }
.stage .viewer { aspect-ratio: auto; height: min(68vh, 720px); }
.stage .legend { margin-top: 12px; }
/* "Full page": the model covers the whole window. */
/* the second selector outranks the height the v2 page layout gives the viewer further down */
.stage .viewer.fullpage, .v2 .stage .viewer.fullpage { position: fixed; inset: 0; z-index: 1000; width: 100%; height: 100%; border-radius: 0; }
body.viewer-open { overflow: hidden; }
.col-main > section, .col-side > section { margin-bottom: 28px; }
h2 { font-size: 20px; margin: 0 0 10px; letter-spacing: -0.01em; }
.prose p { margin: 0 0 14px; max-width: 68ch; }
.prose { scroll-margin-top: 16px; }
.toc { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 28px; }
.toc h2 { font-size: 15px; margin: 0 0 6px; }
.toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 28px; font-size: 15px; }
.toc li { margin: 0 0 4px; break-inside: avoid; }
.toc a { color: var(--ink); }
@media (max-width: 860px) { .toc ol { columns: 1; } }

/* ---------- viewer ---------- */
.viewer {
  position: relative; aspect-ratio: 16 / 11; border-radius: 14px; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 35%, var(--stage-a), var(--stage-b)); color: #e9e6df;
}
.viewer-mark { position: absolute; right: 14px; bottom: 12px; font-size: 12px; line-height: 1; color: rgba(255, 255, 255, 0.5); pointer-events: none; user-select: none; }
/* The bottom-right corner belongs to the site name: the toolbars along the bottom keep clear of it.
   (Each viewer is a size container, so this follows the viewer's width, not the window's.) */
.viewer { container-type: inline-size; }
@container (min-width: 560px) { .viewer-tools:not(.cam) { left: 140px; right: 140px; } }
@container (max-width: 559px) { .viewer-mark { bottom: 58px; } }
@media (min-width: 621px) { @container (max-width: 860px) { .viewer-tools.cam { left: 12px; transform: none; max-width: calc(100% - 160px); } } }
.viewer canvas { display: block; width: 100%; height: 100%; cursor: grab; opacity: 0; }
.viewer.ready canvas { opacity: 1; }
.viewer canvas.over { cursor: pointer; }
.viewer-status { position: absolute; inset: 0; display: grid; place-items: center; color: #98a1aa; font-size: 14px; }
[hidden] { display: none !important; }
.viewer-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; opacity: 0; }
.viewer-labels[hidden] { display: none; }
.viewer-panel [data-labels] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 5h11l6 7-6 7H3z' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.viewer.ready .viewer-labels { opacity: 1; }
.bone-leaders { position: absolute; inset: 0; width: 100%; height: 100%; }
.bone-leaders line { stroke: rgba(255, 255, 255, 0.7); stroke-width: 1; }
.bone-leaders circle { fill: #fff; stroke: rgba(13, 16, 19, 0.8); stroke-width: 1; }
.bone-label {
  position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 12px; font-weight: 600;
  padding: 2px 7px; border-radius: 999px; background: rgba(13, 16, 19, 0.82); color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
}
.viewer-tools {
  position: absolute; left: 12px; right: 12px; bottom: 14px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
}
.viewer-tools button {
  appearance: none; border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(13, 16, 19, 0.7); color: #c9ced3;
  font: inherit; font-size: 14.5px; font-weight: 500; padding: 8px 16px; border-radius: 999px; cursor: pointer;
}
.viewer-tools button:hover { color: #fff; border-color: rgba(255, 255, 255, 0.4); }
.viewer-tools button[aria-pressed="true"] { background: var(--bone); color: #14181c; border-color: var(--bone); }
.viewer-tools .sep { width: 1px; margin: 5px 4px; background: rgba(255, 255, 255, 0.22); }
.sel-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #2fd3c2; margin-right: 8px; }
.viewer-tip {
  position: absolute; z-index: 5; pointer-events: none; transform: translate(14px, 14px);
  background: #0d1013; border: 1px solid #2c343c; border-radius: 6px; padding: 5px 9px; font-size: 13px; white-space: nowrap;
}
.viewer-tip i, .viewer-picked i { color: #98a1aa; }
.viewer-tip i { display: block; font-size: 12px; }
.viewer-picked {
  position: absolute; left: 10px; top: 10px; right: 10px; display: flex; gap: 12px; align-items: center; justify-content: space-between;
  background: rgba(13, 16, 19, 0.86); border: 1px solid #2c343c; border-radius: 10px; padding: 8px 12px; font-size: 14px;
}
.viewer-picked a { color: var(--focus); white-space: nowrap; }
.viewer-hint { margin: 0; font-size: 14px; color: var(--muted); }
.viewer-about { margin: 10px 0 0; font-size: 15.5px; }
.all-models ul { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 24px; }
.all-models li { margin: 0 0 6px; break-inside: avoid; }

.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 2px 0; padding: 0; font-size: 14px; }
.legend li { display: flex; align-items: center; gap: 7px; }
.swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.swatch.focus { background: var(--model-focus, #ff8a3d); } .swatch.a { background: var(--a); } .swatch.b { background: var(--b); } .swatch.c { background: var(--c); } .swatch.d { background: var(--d); }

/* ---------- side column ---------- */
.facts { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; font-size: 14.5px; }
.facts th, .facts td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.facts tr:last-child th, .facts tr:last-child td { border-bottom: 0; }
.facts th { width: 40%; font-weight: 600; color: var(--muted); }

.related { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.related a {
  display: block; padding: 9px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); text-decoration: none; font-size: 15px;
}
.related a:hover { border-color: var(--accent); }
.related a i { color: var(--muted); font-size: 13px; margin-left: 6px; }

.faq .qa { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 8px; }
.faq h3 { margin: 0; font-size: 16px; }
.faq p { margin: 6px 0 0; }
.hl { font-weight: 700; }
.fig { margin: 4px 0 18px; max-width: 68ch; }
.fig img { display: block; width: 100%; height: auto; border-radius: 10px; background: #12161a; }
.fig figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; line-height: 1.4; }


.sources { font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding: 16px 0 40px; margin-top: 12px; }
.sources p { margin: 0 0 6px; max-width: 80ch; }

/* ---------- overview ---------- */
.ov-head { padding: 28px 0 8px; }
.ov-head h1 { margin: 0 0 6px; font-size: 30px; letter-spacing: -0.02em; }
.ov-head p { margin: 0; color: var(--muted); max-width: 80ch; }
.ov-tier { margin: 30px 0 12px; display: flex; align-items: baseline; gap: 12px; }
.ov-tier h2 { margin: 0; font-size: 20px; }
.ov-tier span { color: var(--muted); font-size: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; color: var(--ink); text-decoration: none; display: flex; flex-direction: column; }
.card:hover { border-color: var(--accent); }
.card .thumb { aspect-ratio: 640 / 420; background: radial-gradient(120% 90% at 50% 35%, var(--stage-a), var(--stage-b)); }
.card .thumb img { display: block; width: 100%; height: 100%; opacity: 0; }
.card.ready .thumb img { opacity: 1; }
.card .meta { padding: 11px 13px 13px; display: grid; gap: 4px; }
.card .n { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card h3 { margin: 0; font-size: 16px; line-height: 1.3; }
.card .url { font-size: 12px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.card .kw { font-size: 13px; margin-top: 4px; }
.card .kw b { font-variant-numeric: tabular-nums; }
.kd { display: inline-block; min-width: 2.2em; text-align: center; border-radius: 999px; padding: 0 6px; font-size: 12px; font-weight: 600; }
.kd.easy { background: #dff3da; color: #24611a; } .kd.mid { background: #fdeccb; color: #7a5200; } .kd.hard { background: #fbdcd5; color: #8a2a17; }
.ov-foot { color: var(--muted); font-size: 13px; padding: 26px 0 50px; max-width: 80ch; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .stage .viewer { height: min(62vh, 520px); }
  .viewer { aspect-ratio: 4 / 3.4; }
}

/* ---------- page layout (v2) ---------- */
.v2-head { padding: 6px 0 14px; }
.v2-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 16px; }
.v2-title h1 { margin: 0; font-size: clamp(28px, 3.6vw, 38px); line-height: 1.12; letter-spacing: -0.02em; }
.v2-title .latin { margin: 0; font-style: italic; color: var(--accent); font-size: 17px; }
.v2-head .lead { margin: 10px 0 0; font-size: 19px; line-height: 1.5; max-width: 74ch; }
.v2-meta { display: flex; flex-wrap: wrap; gap: 4px 0; margin: 10px 0 0; font-size: 13.5px; color: var(--muted); }
.v2-meta > * + *::before { content: "·"; margin: 0 9px; color: var(--muted); }
.v2-meta a { color: var(--muted); }
/* The model ends at the bottom of the window on any screen, so it is fully visible on arrival. */
/* tall enough for the model and the panes beside it, even when that reaches below the fold of a short window */
.v2 .stage .viewer { height: clamp(580px, calc(100vh - 150px), 880px); }
.v2-caption { margin: 9px 2px 0; font-size: 14px; color: var(--muted); }
.v2-caption strong { color: var(--ink); font-weight: 600; }
.v2 .layout { grid-template-columns: minmax(0, 68ch) minmax(260px, 1fr); gap: 44px; align-items: stretch; }
.v2 .col-main > section { margin-bottom: 34px; }
.v2 .prose h2, .v2 .faq h2 { font-size: 24px; line-height: 1.25; margin-bottom: 12px; }
.v2 .prose p, .v2 .qa p, .v2 .takeaways li { font-size: 17.5px; line-height: 1.7; }
.v2 .prose p { margin-bottom: 16px; }
.v2 .prose { scroll-margin-top: 18px; }
.takeaways { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 16px 20px; }
.takeaways h2 { font-size: 17px; margin: 0 0 8px; }
.takeaways ul { margin: 0; padding-left: 20px; }
.takeaways li { margin-bottom: 4px; }
.v2 .col-side > section { margin-bottom: 26px; }
.v2-sticky { position: sticky; top: 16px; display: grid; gap: 26px; }
.v2-toc h2, .v2 .col-side h2 { font-size: 15px; letter-spacing: 0.02em; margin: 0 0 8px; }
.v2-toc ol { margin: 0; padding: 0; list-style: none; border-left: 2px solid var(--line); }
.v2-toc li a { display: block; padding: 5px 12px; margin-left: -2px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; font-size: 14.5px; line-height: 1.35; }
.v2-toc li a:hover { color: var(--ink); border-left-color: var(--accent); }
.v2-sources h2 { font-size: 17px; color: var(--ink); margin: 0 0 8px; }
.v2-sources ol { margin: 0 0 12px; padding-left: 20px; max-width: 80ch; }
.v2-sources li { margin-bottom: 4px; }
@media (max-width: 860px) {
  .v2 .layout { grid-template-columns: 1fr; gap: 26px; }
  .v2 .stage .viewer { height: min(60vh, 520px); }
  .v2-sticky { position: static; }
  .v2-toc { display: none; }
}

.viewer-tools [data-zoom] { min-width: 42px; padding-left: 0; padding-right: 0; font-size: 18px; line-height: 1; }

@media (max-width: 620px) { .viewer-tools { gap: 5px; bottom: 10px; } .viewer-tools button { font-size: 13px; padding: 6px 10px; } .viewer-tools [data-zoom] { min-width: 34px; padding-left: 0; padding-right: 0; } .viewer-tools .sep { display: none; } }

/* ---------- home: the whole body ---------- */
.home-hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 36px; align-items: start; padding: 26px 0 10px; }
.home-viewer { aspect-ratio: auto; height: clamp(440px, calc(100vh - 200px), 800px); }
.viewer-tip small { display: block; font-weight: 400; opacity: .75; }
.systems { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
.systems button { font: 600 14px/1.2 inherit; font-family: inherit; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.systems button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.systems button.option[aria-pressed="true"] { background: var(--a); border-color: var(--a); color: var(--ink); }
.systems button:disabled { opacity: .45; cursor: default; }
.systems button.busy::after { content: "…"; }
.home-intro h1 { margin: 6px 0 0; font-size: clamp(30px, 4vw, 42px); line-height: 1.1; letter-spacing: -0.02em; }
.home-intro .lead { margin: 12px 0 18px; font-size: 18.5px; line-height: 1.55; max-width: 52ch; }
.region-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.region-list li { display: grid; grid-template-columns: 96px 1fr; align-items: baseline; gap: 12px; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.region-list li:hover, .region-list li.on { border-color: var(--focus); box-shadow: inset 3px 0 0 var(--focus); }
.region-list strong { font-size: 17px; }
.region-list .sys { display: flex; gap: 4px 16px; flex-wrap: wrap; }
.region-list .sys a { font-weight: 600; font-size: 15px; text-decoration: none; }
.region-list .sys a:hover { text-decoration: underline; }
.region-list em { color: var(--muted); font-size: 13px; font-style: normal; font-weight: 400; margin-left: 2px; }
.systems-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-bottom: 12px; }
.systems-row a { display: grid; gap: 4px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; color: var(--ink); text-decoration: none; }
.systems-row a:hover { border-color: var(--focus); }
.systems-row span { color: var(--muted); font-size: 14.5px; }
.muscle-regions { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 8px 28px; font-size: 14.5px; line-height: 1.5; }
.muscle-regions li a { color: var(--muted); }
.muscle-regions li a:first-child { color: var(--ink); text-decoration: none; margin-right: 6px; }
.home-section { padding: 26px 0 6px; }
.home-section h2 { font-size: 22px; margin-bottom: 14px; }
.region-card .thumb { display: block; aspect-ratio: 1280 / 800; }
.region-card .thumb img { opacity: 1; }
.region-card h3 a { color: var(--ink); text-decoration: none; }
.region-card p { margin: 2px 0 0; font-size: 13.5px; line-height: 1.5; }
.region-card p a { color: var(--muted); }
.home .all-models ul { columns: 4; }
@media (max-width: 860px) {
  .home-hero { grid-template-columns: 1fr; gap: 20px; padding-top: 16px; }
  .home-viewer { height: min(64vh, 560px); }
  .home .all-models ul { columns: 2; }
  .region-list li { grid-template-columns: 76px 1fr; }
}

/* ---------- muscle tools in the viewer: depth layers and the muscle list ---------- */
.muscle-tools { display: contents; }
.viewer-tools .depth { display: inline-flex; align-items: center; border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(13, 16, 19, 0.7); border-radius: 999px; }
.viewer-tools .depth button { border: 0; background: none; padding: 8px 13px; font-size: 18px; line-height: 1; }
.viewer-tools .depth button:disabled { opacity: 0.3; cursor: default; }
.viewer-tools .depth-label { min-width: 104px; text-align: center; font-size: 14.5px; font-weight: 500; color: #c9ced3; }
.muscle-list {
  position: absolute; top: 12px; right: 12px; width: 232px; max-height: calc(100% - 92px); overflow-y: auto; overscroll-behavior: contain;
  background: rgba(13, 16, 19, 0.84); border: 1px solid #2c343c; border-radius: 10px; padding: 4px 6px 8px; font-size: 13.5px;
}
.muscle-list p { margin: 8px 6px 2px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #98a1aa; }
.muscle-list ul { list-style: none; margin: 0; padding: 0; }
.muscle-list li { display: flex; align-items: center; border-radius: 6px; }
.muscle-list li.hover, .muscle-list li:hover { background: rgba(255, 255, 255, 0.08); }
.muscle-list li.on { background: rgba(255, 255, 255, 0.16); }
.muscle-list button { appearance: none; border: 0; background: none; color: #e9e6df; font: inherit; cursor: pointer; }
.muscle-list .name { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 5px 6px; text-align: left; line-height: 1.25; }
.muscle-list .swatch { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.muscle-list .eye { flex: none; display: grid; place-items: center; width: 30px; height: 28px; color: #c9ced3; }
.muscle-list .eye[aria-pressed="false"] { color: #56606a; }
.muscle-list li.peeled .name, .muscle-list li.off .name { color: #76808a; }
.muscle-list li.peeled .swatch, .muscle-list li.off .swatch { opacity: 0.35; }
.muscle-list li.on .name { color: #fff; }
.muscle-list button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; border-radius: 6px; }
.viewer.has-list .viewer-picked { right: 256px; }
@media (max-width: 620px) {
  .viewer-tools .depth button { padding: 6px 9px; }
  .viewer-tools .depth-label { min-width: 88px; font-size: 13px; }
  .muscle-list { top: 10px; right: 10px; width: 190px; max-height: calc(100% - 150px); font-size: 13px; }
  .viewer.has-list .viewer-picked { right: 10px; top: auto; bottom: 104px; }
}

/* ---------- viewer controls in panes, most used first ----------
   Top left: what is shown (layer switches, with the muscle depth stepper under Muscles) and X-ray.
   Top right: the muscle list, folded by its header. Bottom: one quiet bar for the camera (reset,
   views, zoom, full page), with the bar naming the picked structure just above it. */
.viewer-panel { position: absolute; left: 12px; top: 12px; width: 172px; display: flex; flex-direction: column; gap: 8px; max-height: calc(100% - 24px); overflow-y: auto; scrollbar-width: none; }
.viewer-panel .pane { display: flex; flex-direction: column; gap: 2px; padding: 6px; background: rgba(13, 16, 19, 0.84); border: 1px solid #2c343c; border-radius: 12px; }
.viewer-panel .pane-cap { margin: 2px 8px 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #98a1aa; }
.viewer-panel button {
  appearance: none; display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: none; color: #c9ced3;
  font: inherit; font-size: 14px; font-weight: 500; padding: 6px 10px; border-radius: 8px; cursor: pointer; text-align: left;
}
.viewer-panel button:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.viewer-panel button[aria-pressed="true"] { background: var(--bone); color: #14181c; }
.viewer-panel button:focus-visible, .viewer-tools.cam button:focus-visible, .muscle-list .list-head:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.viewer-panel button::before, .viewer-tools.cam .icon::before {
  content: ''; flex: none; width: 17px; height: 17px; background: currentColor;
  -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat;
}
.viewer-panel [data-layer="muscles"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2v3M12 19v3M12 5c4 3 4 11 0 14c-4-3-4-11 0-14zM12 8v8'/%3E%3C/svg%3E"); }
.viewer-panel [data-layer="ligaments"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='6' cy='6' r='3'/%3E%3Ccircle cx='18' cy='18' r='3'/%3E%3Cpath d='M8.5 8.5l7 7M11 6.5l6.5 6.5M6.5 11l6.5 6.5'/%3E%3C/svg%3E"); }
.viewer-panel [data-natural] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3a9 9 0 1 0 0 18c1.4 0 2-1 2-2 0-1.6-1.6-1.8-1.6-3.2 0-1 .8-1.8 1.8-1.8H17a4 4 0 0 0 4-4c0-3.9-4-7-9-7z'/%3E%3Ccircle cx='7.5' cy='11' r='1.2' fill='black'/%3E%3Ccircle cx='10.5' cy='7' r='1.2' fill='black'/%3E%3Ccircle cx='15.5' cy='7.5' r='1.2' fill='black'/%3E%3C/svg%3E"); }
.legend { transition: opacity 0.2s; }
.legend.muted { opacity: 0.3; }
.viewer-panel [data-xray] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9' fill='none' stroke='black' stroke-width='2'/%3E%3Cpath d='M12 3a9 9 0 0 1 0 18z'/%3E%3C/svg%3E"); }
/* arteries and veins wear their colour in the model: a dot of it, not an icon */
.viewer-panel [data-layer="arteries"]::before, .viewer-panel [data-layer="veins"]::before, .viewer-panel [data-layer="nerves"]::before, .viewer-panel [data-layer="organs"]::before, .viewer-panel [data-layer="lymphatics"]::before, .viewer-panel [data-layer="skin"]::before { width: 10px; height: 10px; margin: 0 3.5px; border-radius: 50%; -webkit-mask: none; mask: none; background: #cf3a2e; }
.viewer-panel [data-layer="veins"]::before { background: #3d6db3; }
.viewer-panel [data-layer="bones"]::before { width: 10px; height: 10px; margin: 0 3.5px; border-radius: 50%; -webkit-mask: none; mask: none; background: #e4dcc6; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); }
/* the last layer showing cannot be switched off: a short shake says so */
.viewer-panel .last-layer { animation: last-layer 0.3s; }
@keyframes last-layer { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.viewer-panel [data-layer="nerves"]::before { background: #e8cf4f; }
.viewer-panel [data-layer="organs"]::before { background: #c98f86; }
.viewer-panel [data-layer="lymphatics"]::before { background: #7fb77a; }
.viewer-panel [data-layer="skin"]::before { background: #e7c3a8; }
/* the depth stepper belongs to Muscles and sits right under it */
.viewer-panel .depth { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 2px 26px; }
.viewer-panel .depth button { width: auto; padding: 4px 9px; font-size: 18px; line-height: 1; }
.viewer-panel .depth button::before { content: none; }
.viewer-panel .depth button:disabled { opacity: 0.3; cursor: default; }
.viewer-panel .depth-label { font-size: 13px; font-weight: 500; color: #c9ced3; text-align: center; }

.viewer-tools.cam { left: 50%; right: auto; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); bottom: 12px; gap: 0; flex-wrap: nowrap; padding: 4px; background: rgba(13, 16, 19, 0.84); border: 1px solid #2c343c; border-radius: 12px; }
.viewer-tools.cam button { border: 0; background: none; color: #a9b0b7; font-size: 13.5px; padding: 7px 11px; border-radius: 8px; white-space: nowrap; }
.viewer-tools.cam button:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.viewer-tools.cam button[aria-pressed="true"] { background: var(--bone); color: #14181c; }
.viewer-tools.cam [data-zoom] { min-width: 34px; font-size: 18px; }
.viewer-tools.cam .icon { display: grid; place-items: center; padding: 7px 9px; }
.viewer-tools.cam .sep { display: block; align-self: stretch; margin: 5px 4px; }
.viewer-tools.cam [data-reset] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12a8 8 0 1 0 2.5-5.8M4 4v5h5'/%3E%3C/svg%3E"); }
.viewer-tools.cam [data-fullpage] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5'/%3E%3C/svg%3E"); }
.viewer-tools.cam [data-fullpage][aria-pressed="true"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5'/%3E%3C/svg%3E"); }

/* the bar naming the picked structure: above the camera bar, clear of the panes and the model's top */
/* (to the right of the panes: with every layer listed they reach down to it) */
.stage .viewer .viewer-picked, .stage .viewer.has-list .viewer-picked { top: auto; bottom: 62px; left: 196px; right: 12px; }

/* the muscle list folds to its header */
.muscle-list .list-head { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 7px 6px 5px; font-weight: 600; color: #e9e6df; }
.muscle-list .list-head::after { content: ''; width: 8px; height: 8px; margin-right: 8px; border-right: 2px solid #98a1aa; border-bottom: 2px solid #98a1aa; transform: translateY(2px) rotate(-135deg); }
.muscle-list.folded { padding-bottom: 4px; overflow: hidden; }
.muscle-list.folded .list-head::after { transform: translateY(-2px) rotate(45deg); }
.muscle-list.folded > :not(.list-head) { display: none; }

/* Phones: no room beside the model, so the switches become one row of icons above the camera bar. */
@media (max-width: 620px) {
  .viewer-panel { left: 10px; right: 10px; top: auto; bottom: 54px; width: auto; flex-direction: row; justify-content: safe center; gap: 6px; max-height: none; overflow-x: auto; overflow-y: visible; }
  .viewer-panel .pane { flex: none; }
  .viewer-panel .pane { flex-direction: row; align-items: center; padding: 4px; }
  .viewer-panel .pane-cap { display: none; }
  .viewer-panel button { width: auto; padding: 8px 10px; font-size: 0; gap: 0; }
  .viewer-panel .depth { padding: 0; }
  .viewer-panel .depth button { font-size: 18px; padding: 4px 7px; }
  .viewer-panel .depth-label { font-size: 12px; min-width: 64px; }
  .viewer-tools.cam { bottom: 8px; }
  .viewer-tools.cam { justify-content: flex-start; overflow-x: auto; }
  .viewer-tools.cam button { font-size: 12.5px; padding: 6px 5px; }
  .viewer-tools.cam .long { display: none; } /* "Inner side" becomes "Inner" */
  .viewer-tools.cam [data-zoom] { min-width: 28px; }
  .viewer-tools.cam .sep { margin: 5px 1px; }
  .viewer-tools.cam .icon { padding: 6px 7px; }
  .stage .viewer .viewer-picked, .stage .viewer.has-list .viewer-picked { bottom: 104px; left: 10px; right: 10px; }
}
