/* KyberOS site, redesign prototype (home page).
   Layout concept: a dark first screen with the claim on the left and a true figure on the
   right, then plain full-width sections ruled with hairlines. No cards, no effects.
   Fonts: IBM Plex Sans (variable, 400 to 600) and IBM Plex Mono (SIL OFL 1.1; license in /fonts), self-hosted, Latin subset. */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("fonts/IBMPlexSans.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/IBMPlexMono-Regular.woff2") format("woff2"); }

:root {
  --bg: #fafafb;
  --bg-term: #0a0820;
  --ink: #17181c;
  --muted: #565a66;
  --rule: #d9dbe1;
  --accent: #4b2fc0;
  --term-ink: #d9d7ea;
  --term-muted: #8f8cb0;
  --fig-line: #4b2fc0;
  --fig-node: #fafafb;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --maxw: 1040px;
  --col: 640px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0820; --bg-term: #07061a; --ink: #ecebf5; --muted: #a9a7c4; --rule: #26234a;
    --accent: #a58bff; --fig-line: #8d78e8; --fig-node: #0a0820; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0820; --bg-term: #07061a; --ink: #ecebf5; --muted: #a9a7c4; --rule: #26234a;
  --accent: #a58bff; --fig-line: #8d78e8; --fig-node: #0a0820; color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-padding-top: 24px; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 17px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: var(--maxw); margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
code, .mono { font-family: var(--mono); font-size: 0.88em; }
p { margin-bottom: 1em; }
.col { max-width: var(--col); }

/* ---- Header ---- */
.top { border-bottom: 1px solid var(--rule); }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; padding-top: 14px; padding-bottom: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; }
.brand img { width: 30px; height: 30px; display: block; }
.brand small { font-family: var(--mono); font-size: 0.72rem; font-weight: 400; color: var(--muted); }
.top nav { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-left: auto; font-size: 0.95rem; }
.top nav a { color: var(--ink); text-decoration: none; }
.top nav a:hover { color: var(--accent); text-decoration: underline; }

/* ---- First screen ---- */
.first { padding: 64px 0 56px; }
.first .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: center; }
.first h1 { font-size: clamp(2.1rem, 4.4vw, 3rem); line-height: 1.1; font-weight: 600; margin-bottom: 0.5em; }
.first .sub { color: var(--muted); max-width: 34em; }
.first .sub strong { color: var(--ink); font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 1.6em 0 1.2em; }
.btn { display: inline-block; padding: 9px 18px; border: 1px solid var(--accent); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.btn:hover { background: var(--accent); color: var(--bg); }
.btn.plain { border-color: var(--rule); font-weight: 400; }
.btn.plain:hover { border-color: var(--accent); background: transparent; color: var(--accent); }
.note { font-size: 0.9rem; color: var(--muted); max-width: 36em; }
figure.fig { margin: 0; }
figure.fig svg { display: block; width: 100%; height: auto; }
figure.fig figcaption { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); margin-top: 8px; line-height: 1.5; }
.fig .ln { stroke: var(--fig-line); stroke-width: 1.2; fill: none; }
.fig .dash { stroke-dasharray: 3 4; opacity: 0.85; }
.fig .nd { fill: var(--fig-node); stroke: var(--fig-line); stroke-width: 1.2; }
.fig .nd.hot { stroke-width: 2; }
.fig text { font-family: var(--mono); font-size: 12.5px; fill: var(--ink); text-anchor: middle; }
.fig text.dim { fill: var(--muted); font-size: 10.5px; }

/* ---- Terminal ---- */
.term { background: var(--bg-term); color: var(--term-ink); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 26px 0; }
.term .cap { font-family: var(--mono); font-size: 0.74rem; color: var(--term-muted); margin-bottom: 10px; }
.term pre { font-family: var(--mono); font-size: 0.86rem; line-height: 1.55; overflow-x: auto; }
.term .p { color: var(--term-muted); }

/* ---- Sections ---- */
section.s { padding: 52px 0; border-bottom: 1px solid var(--rule); }
section.s h2 { font-size: 1.5rem; line-height: 1.25; font-weight: 600; margin-bottom: 0.6em; }
.tw { overflow-x: auto; margin: 1em 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; line-height: 1.45; }
th, td { text-align: left; vertical-align: top; padding: 9px 18px 9px 0; border-bottom: 1px solid var(--rule); }
th { font-weight: 600; border-bottom: 1.5px solid var(--ink); }
td.n { font-family: var(--mono); font-size: 0.88em; white-space: nowrap; }
.state { white-space: nowrap; font-family: var(--mono); font-size: 0.82rem; }
.cap2 { font-size: 0.86rem; color: var(--muted); margin-top: 8px; }
ol.log { list-style: none; max-width: 760px; }
ol.log li { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 4px 18px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
ol.log time { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); padding-top: 3px; }
ol.log b { font-weight: 600; }
ul.plain { margin: 0 0 1em 1.2em; max-width: var(--col); }
ul.plain li { margin: 0.35em 0; }

/* ---- Inner pages ---- */
.ph { padding: 56px 0 40px; border-bottom: 1px solid var(--rule); }
.ph h1 { font-size: clamp(2rem, 4vw, 2.6rem); line-height: 1.12; font-weight: 600; margin-bottom: 0.5em; max-width: 22em; }
.ph .lede { color: var(--muted); max-width: 38em; font-size: 1.05rem; margin-bottom: 0; }
.ph .lede strong { color: var(--ink); font-weight: 600; }
section.s h3 { font-size: 1.05rem; line-height: 1.35; font-weight: 600; margin-bottom: 0.3em; }
.s .col + .col, .s .col + .items, .s .col + .tw, .s .col + .split { margin-top: 1.2em; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px); gap: 24px 56px; align-items: start; }
.aside { border-left: 2px solid var(--accent); padding: 2px 0 2px 18px; font-size: 0.95rem; color: var(--muted); }
.aside h3 { color: var(--ink); }
.aside p:last-child { margin-bottom: 0; }
.items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 56px; margin-top: 8px; }
.items > div { border-top: 1px solid var(--rule); padding: 16px 0 12px; }
.items p { color: var(--muted); font-size: 0.97rem; margin-bottom: 0.4em; }
.items.one { grid-template-columns: minmax(0, 760px); }
ol.eras { list-style: none; max-width: 820px; }
ol.eras li { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 4px 24px; padding: 14px 0; border-top: 1px solid var(--rule); }
ol.eras time { font-family: var(--mono); font-size: 0.82rem; color: var(--muted); padding-top: 3px; }
ol.eras p { margin-bottom: 0.4em; }
ul.people { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 56px; }
ul.people li { border-top: 1px solid var(--rule); padding: 14px 0 10px; }
ul.people .role { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); margin-bottom: 0.4em; }
ul.people p { font-size: 0.96rem; margin-bottom: 0.4em; }
.lineage { max-width: 820px; margin: 12px 0 28px; }
.lineage .lin { font-family: var(--mono); font-size: 0.84rem; padding: 9px 0; border-top: 1px solid var(--rule); margin: 0; line-height: 1.7; }
.lineage .lin i { font-style: normal; color: var(--muted); padding: 0 6px; }
.lineage .lin .hot { color: var(--accent); font-weight: 600; }
sup.cite { font-size: 0.68em; line-height: 0; }
sup.cite a { text-decoration: none; padding: 0 1px; }
.sources { margin-top: 36px; max-width: 820px; }
.sources-note { font-size: 0.9rem; color: var(--muted); }
ol.refs { margin-left: 1.6em; font-size: 0.88rem; color: var(--muted); }
ol.refs li { margin: 0.45em 0; padding-left: 4px; overflow-wrap: anywhere; }
ol.refs li:target { background: color-mix(in srgb, var(--accent) 12%, transparent); }
details { border-top: 1px solid var(--rule); max-width: 760px; }
details:last-of-type { border-bottom: 1px solid var(--rule); }
summary { cursor: pointer; padding: 14px 0; font-weight: 600; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::before { content: "+"; font-family: var(--mono); color: var(--muted); display: inline-block; width: 1.4em; }
details[open] summary::before { content: "\2212"; }
details p { padding: 0 0 14px 1.4em; color: var(--muted); margin: 0; }
ol.rules { list-style: none; max-width: 760px; counter-reset: r; }
ol.rules li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 4px 12px; padding: 14px 0; border-top: 1px solid var(--rule); counter-increment: r; }
ol.rules li::before { content: counter(r); font-family: var(--mono); color: var(--accent); font-weight: 600; padding-top: 1px; }
ol.rules p { color: var(--muted); font-size: 0.97rem; margin: 0; }
ul.status { list-style: none; max-width: 640px; margin-bottom: 1.4em; }
ul.status li { padding: 9px 0; border-top: 1px solid var(--rule); }
table.cmp td:first-child, table.cmp th:first-child { font-weight: 600; white-space: nowrap; }
table.cmp .us { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.center404 { padding: 72px 0 96px; }

.skip-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
figure.stack { margin: 20px 0 28px; max-width: 760px; display: grid; gap: 10px; font-family: var(--mono); }
figure.stack > div, figure.stack .row3 > div { border: 1px solid var(--fig-line); padding: 10px 14px; font-size: 0.86rem; line-height: 1.45; }
figure.stack b { display: block; font-weight: 600; font-size: 0.9rem; }
figure.stack span { color: var(--muted); font-size: 0.78rem; }
figure.stack .row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; border: 0; padding: 0; }
figure.stack .dashed { border-style: dashed; }
figure.stack .base { border-width: 2px; }
figure.stack figcaption { font-size: 0.74rem; color: var(--muted); }

/* ---- Footer ---- */
.foot { padding: 34px 0 60px; font-size: 0.9rem; color: var(--muted); }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 14px 40px; justify-content: space-between; }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.foot a { color: var(--muted); }

@media (max-width: 820px) {
  .first { padding-top: 40px; }
  .first .wrap { grid-template-columns: 1fr; }
  .top nav { margin-left: 0; }
  ol.log li, ol.eras li { grid-template-columns: 1fr; }
  .split, .items, ul.people, figure.stack .row3 { grid-template-columns: 1fr; }
  .ph { padding-top: 36px; }
}
