/* Shared stylesheet for every page. Colour tokens drive both the page and the
   graph SVG classes, so light and dark mode come from one place. */
:root {
  --bg: #f4f6f9; --surface: #ffffff; --frame: #e9edf3; --fg: #132033; --muted: #5a6779;
  --line: #d2d9e3; --line-strong: #8a95a6; --zmuted: #c3cdda;
  --accent: #0d7a74; --accent-soft: #e1f1ef; --other: #a3adbb;
  --warn: #9c5c08; --crit: #b42318; --pill: #ffffff;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Linux Libertine", Georgia, "Times New Roman", serif;
  --wk-border: #a2a9b1; --wk-link: #3366cc; --wk-feat: #e3f3ea; --wk-dyk: #e3ecf8; --wk-about: #eef0f3;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d141d; --surface: #172231; --frame: #111b27; --fg: #e3eaf3; --muted: #98a6b7;
    --line: #2a3747; --line-strong: #66788f; --zmuted: #42505f;
    --accent: #47c2bb; --accent-soft: #123533; --other: #55657a;
    --warn: #e2a64c; --crit: #f2786c; --pill: #1d2a3b;
    --wk-border: #4a5868; --wk-link: #88a7e8; --wk-feat: #17312a; --wk-dyk: #1a2a42; --wk-about: #1d2633;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d141d; --surface: #172231; --frame: #111b27; --fg: #e3eaf3; --muted: #98a6b7;
  --line: #2a3747; --line-strong: #66788f; --zmuted: #42505f;
  --accent: #47c2bb; --accent-soft: #123533; --other: #55657a;
  --warn: #e2a64c; --crit: #f2786c; --pill: #1d2a3b;
  --wk-border: #4a5868; --wk-link: #88a7e8; --wk-feat: #17312a; --wk-dyk: #1a2a42; --wk-about: #1d2633;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 15px/1.55 var(--sans); -webkit-text-size-adjust: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1180px; margin: 0 auto; padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); }

.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top .wrap { display: flex; align-items: center; min-height: 52px; }
.brand { font-weight: 700; color: var(--fg); letter-spacing: -0.01em; }
.brand::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--accent); margin-right: 9px; vertical-align: 0; }

.intro { padding-top: 22px; }
.eyebrow { margin: 18px 0 2px; font-size: 12px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
h1 { font-size: clamp(26px, 4vw, 38px); line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 6px; text-wrap: balance; overflow-wrap: anywhere; }
.ident { margin: 0; color: var(--muted); }
.ident b { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.lede { margin: 14px 0 0; max-width: 72ch; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 20px 0 0; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.stats dt { font-size: 12.5px; color: var(--muted); }
.stats dd { margin: 2px 0 0; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

.legend { list-style: none; margin: 18px 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 13px; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.legend i { display: inline-block; width: 18px; height: 14px; border-radius: 4px; background: var(--surface); border: 1px solid var(--line); position: relative; }
.legend i::after { content: ""; position: absolute; left: 3px; top: 2px; bottom: 2px; width: 3px; border-radius: 2px; background: var(--other); }
.legend i.k-root { background: var(--fg); border-color: var(--fg); }
.legend i.k-root::after { display: none; }
.legend i.k-hc::after { background: var(--accent); }
.legend i.k-card { width: 22px; }
.legend i.k-card::after { left: 4px; right: 4px; top: 3px; bottom: auto; width: auto; height: 1px; background: var(--line-strong); box-shadow: 0 3px 0 var(--line-strong), 0 6px 0 var(--line-strong); }
.legend .k-pill { font-size: 10.5px; font-weight: 600; color: var(--fg); border: 1px solid var(--line); background: var(--pill); border-radius: 9px; padding: 0 7px; line-height: 16px; }
.legend .k-pill.sh { font-weight: 500; color: var(--muted); }
.legend .k-lk { display: inline-block; width: 6px; height: 6px; margin: 0 4px 0 1px; border-top: 1.6px solid var(--accent); border-right: 1.6px solid var(--accent); transform: rotate(45deg); }

.canvas { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0; padding: 4px 0 8px; }
.hint { display: none; margin: 0 auto; font-size: 12.5px; color: var(--muted); }
.hint.wide { display: block; }
@media (max-width: 760px) { .hint { display: block; } }
.src { margin: 8px 0 0; font-size: 13.5px; color: var(--muted); }
.src a { font-weight: 600; }
.brand:hover { text-decoration: none; }

/* Home page search */
.home { padding-bottom: 40px; }
.find { margin: 28px 0 0; max-width: 720px; }
.find label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.find input { width: 100%; font: inherit; font-size: 17px; color: var(--fg); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; padding: 12px 14px; }
.find input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
#hits { list-style: none; margin: 10px 0 0; padding: 0; }
#hits li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 14px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
#hits li a { font-weight: 600; }
#hits li span { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
#hits li.none { color: var(--muted); }

/* Ownership chart: rows, boxes and pills are positioned by the generator
   (inline left/top/height); only the connector lines are SVG. */
.chart { position: relative; margin: 0 auto; }
.chart .ln { position: absolute; left: 0; top: 0; overflow: visible; }
.chart .ln path { fill: none; stroke: var(--line-strong); stroke-width: 1.3; }
.band { position: absolute; left: 8px; right: 8px; background: var(--frame); border-radius: 14px; }
.bl { position: absolute; left: 14px; top: 0; bottom: 0; width: 82px; margin: 0; display: flex; flex-direction: column; justify-content: center; font-size: 11px; line-height: 1.4; color: var(--muted); }
.bl b { color: var(--fg); font-size: 11px; letter-spacing: 0.08em; }
.tree, .tree ul, .tree li { list-style: none; margin: 0; padding: 0; }
.nd { position: absolute; width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 0 12px 0 16px; display: flex; flex-direction: column; justify-content: center; }
.nd::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--other); }
.nd.hc::before { background: var(--accent); }
.nd.rt { background: var(--fg); border-color: var(--fg); }
.nd.rt::before { display: none; }
.nd.lk { padding-right: 26px; }
.nd.lk::after { content: ""; position: absolute; right: 12px; top: 13px; width: 6px; height: 6px; border-top: 1.6px solid var(--accent); border-right: 1.6px solid var(--accent); transform: rotate(45deg); }
.nd.lk:hover { border-color: var(--accent); }
.nd .nm { font-size: 12.5px; font-weight: 600; line-height: 15.5px; color: var(--fg); overflow-wrap: anywhere; }
.nd a.nm::before { content: ""; position: absolute; inset: 0; }
.nd .mt { font-size: 10.5px; line-height: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.nd .nm + .mt { margin-top: 3px; }
.nd .mt.gn { font-style: italic; }
.nd.rt .nm { font-size: 14px; font-weight: 700; line-height: 18px; color: var(--bg); }
.nd.rt .mt { font-size: 11px; line-height: 14px; color: var(--zmuted); }
.nd.rt .nm + .mt { margin-top: 4px; }
.nd .w, .ident .w { color: var(--warn); font-weight: 600; }
.nd .c, .ident .c { color: var(--crit); font-weight: 600; }
.nd.rt .w, .nd.rt .c { color: var(--bg); }
/* List card: companies at the end of a chain, listed in up to four columns. */
.lc { position: absolute; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.lh { margin: 0; height: 34px; padding: 11px 12px 0; font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid var(--line); }
.lcols { display: flex; }
.lcols ul { list-style: none; margin: 0; padding: 0 12px 8px; flex: 1 1 0; min-width: 0; }
.lcols ul + ul { border-left: 1px solid var(--line); }
.lcols li { padding: 5px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.lcols li:last-child { border-bottom: 0; }
.lcols .rn { font-size: 12px; font-weight: 600; line-height: 15px; color: var(--fg); overflow-wrap: anywhere; }
.lcols a.rn:hover { color: var(--accent); }
.lcols .rm { margin-top: 2px; font-size: 10.5px; line-height: 13px; color: var(--muted); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.lcols .rm b { color: var(--fg); font-weight: 600; }
.pc { position: absolute; transform: translate(-50%, -50%); font-size: 10px; font-weight: 600; line-height: 15px; padding: 0 6px; border: 1px solid var(--line); border-radius: 9px; background: var(--pill); color: var(--fg); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pc.sh { font-weight: 500; color: var(--muted); }



.foot { margin-top: 48px; border-top: 1px solid var(--line); padding: 18px 0 30px; font-size: 13px; color: var(--muted); }
@media print { .canvas { overflow: visible; } .top, .foot, .hint { display: none; } }

/* Home page: a simple wiki front page. */
.wiki { padding: 24px 0 8px; }
.wiki a { color: var(--wk-link); }
.wk-hero { text-align: center; padding: 14px 0 22px; border-bottom: 1px solid var(--wk-border); }
.wk-title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 5vw, 44px); letter-spacing: 0; }
.wk-title b { font-weight: 600; }
.wk-tag { margin: 2px 0 0; font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--muted); }
.wk-count { margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.wk-count b { color: var(--fg); }
.wk-hero .find { margin: 18px auto 0; text-align: left; }
.wk-hero .find label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wk-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; margin-top: 22px; }
.wk-box { border: 1px solid var(--wk-border); background: var(--surface); }
.wk-box h2 { margin: 0; padding: 5px 12px; font-family: var(--serif); font-size: 19px; font-weight: 400; border-bottom: 1px solid var(--wk-border); background: var(--wk-about); }
.wk-feat h2 { background: var(--wk-feat); }
.wk-dyk h2 { background: var(--wk-dyk); }
.wk-body { padding: 10px 14px 12px; font-size: 14.5px; line-height: 1.6; }
.wk-body p { margin: 0 0 8px; }
.wk-body ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.wk-body .src { margin: 0; font-size: 14.5px; }
.wk-more { text-align: right; font-weight: 600; }
.wk-about { margin-top: 16px; }
@media (max-width: 760px) { .wk-grid { grid-template-columns: 1fr; } }
