/* WHY WE DO IT, the figure (js/why-fig.js): an iso-glow plate in the site's
   tokens. Hairlines on opaque faces; one accent, only on what is live — white
   in the dark theme, near-black in the light one, where nothing glows
   (iso-glow's rule for near-white accents). Everything scoped to .kw-fig. */
.kw-fig {
  --kw-face: var(--ti-bg-mid, #ebebe8);
  --kw-top: var(--ti-bg-top, #f4f4f2);
  --kw-line: color-mix(in srgb, var(--nix-text) 62%, transparent);
  --kw-detail: color-mix(in srgb, var(--nix-text) 24%, transparent);
  --kw-accent: #111111;
  --kw-accent-dim: color-mix(in srgb, #111111 30%, transparent);
  --kw-on-accent: var(--ti-bg-top, #f4f4f2);
  margin: clamp(40px, 6vw, 64px) auto 0;
  width: min(880px, 100%);
}
html[data-theme="dark"] .kw-fig {
  --kw-accent: #FFFFFF;
  --kw-accent-dim: rgba(255, 255, 255, .32);
  --kw-on-accent: #141516;
}
.koeia-doc > .kw-fig { width: min(880px, 100%); }
.kw-stage { display: block; width: 100%; height: auto; outline: 0; }
.kw-stage:focus-visible { outline: 1px solid var(--kw-line); outline-offset: 6px; border-radius: 12px; }
.kw-stage * { vector-effect: non-scaling-stroke; }

.kw-face { fill: var(--kw-face); stroke: var(--kw-line); stroke-width: 1; stroke-linejoin: round; }
.kw-face.kw-top { fill: var(--kw-top); }
.kw-plate.kw-top { fill: var(--kw-face); }
.kw-detail { fill: none; stroke: var(--kw-detail); stroke-width: 1; stroke-linecap: round; }
.kw-hollow { fill: none; }

/* the tangle: dim, and gone once the tools are together */
.kw-tangle { fill: none; stroke: var(--kw-detail); stroke-width: 1; stroke-dasharray: 3 4; }
.kw-note { fill: var(--kw-top); stroke: var(--kw-detail); stroke-width: 1; }
.kw-loose { transition: opacity 500ms ease; }
.kw-fig.is-on .kw-loose { opacity: 0; }

/* the tools travel to the row */
.kw-tool { transition: transform 900ms cubic-bezier(.2, .7, .2, 1); }

/* the structure under the row */
.kw-base { opacity: 0; transition: opacity 600ms ease; }
.kw-fig.is-on .kw-base { opacity: 1; }
.kw-slab.kw-top { fill: var(--kw-top); }
.kw-rim { fill: none; stroke: var(--kw-accent); stroke-width: 1.4; opacity: 0; transition: opacity 500ms ease 700ms; }
.kw-fig.is-on .kw-rim { opacity: 1; }
.kw-halo { fill: var(--kw-accent); opacity: 0; transition: opacity 700ms ease 700ms; }
.kw-fig.is-on .kw-halo { opacity: .16; }

/* the displays light once connected */
.kw-glass { fill: var(--kw-face); stroke: var(--kw-line); stroke-width: 1; transition: fill 400ms ease, stroke 400ms ease; }
.kw-fig.is-on .kw-glass { fill: var(--kw-accent); stroke: var(--kw-accent); filter: url(#kw-glow); transition-delay: 900ms; }

/* the spine and its pulse */
.kw-wire { fill: none; stroke: var(--kw-accent); stroke-width: 1.6; stroke-linecap: round; }
.kw-spine { opacity: 0; transition: opacity 500ms ease; }
.kw-fig.is-on .kw-spine { opacity: 1; transition-delay: 800ms; }
.kw-pulse { fill: none; stroke: var(--kw-accent); stroke-width: 3.2; stroke-linecap: round; stroke-dasharray: 70 930; stroke-dashoffset: 1000; }
.kw-fig.is-on .kw-pulse { animation: kw-run 2.6s linear 1.2s infinite; }
@keyframes kw-run { from { stroke-dashoffset: 1000; } to { stroke-dashoffset: 0; } }

/* the light theme keeps the accent flat: nothing radiates */
html:not([data-theme="dark"]) .kw-fig .kw-spine,
html:not([data-theme="dark"]) .kw-fig .kw-rim,
html:not([data-theme="dark"]) .kw-fig.is-on .kw-glass { filter: none; }
html:not([data-theme="dark"]) .kw-fig .kw-halo-wrap { display: none; }

.kw-cap {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  font-size: var(--text-2xs, 11px);
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--nix-text-soft);
}
.kw-read { text-transform: none; letter-spacing: .02em; font-weight: 300; font-size: 13px; text-align: right; }
.kw-act { display: block; margin: 22px auto 0; }

@media (prefers-reduced-motion: reduce) {
  .kw-tool, .kw-loose, .kw-base, .kw-rim, .kw-halo, .kw-glass, .kw-spine { transition: none !important; }
  .kw-fig.is-on .kw-pulse { animation: none; stroke-dasharray: none; stroke-dashoffset: 0; }
}

/* Why we do it: what we believe, as the portal's rows with the settings hover
   (the row fills and its words step in). Not links: nothing to open. */
.koeia-why__rows { margin-top: 4px; }
.koeia-why__rows > li {
  padding: 14px 0;
  border-radius: 8px;
  transition: background 200ms ease, padding 220ms cubic-bezier(.2, .7, .2, 1);
}
.koeia-why__rows > li:hover { padding-inline: 12px; background: color-mix(in srgb, var(--nix-text) 7%, transparent); }
.koeia-why__rows .acct-row__main { gap: 6px; }
.koeia-why__rows .acct-row__main > span { font-size: 17px; font-weight: 400; }
.koeia-why__rows .acct-row__main small { font-size: 15px; font-weight: 300; line-height: 1.55; color: var(--nix-text-soft); }
.koeia-about .contact__head .contact__title { text-wrap: balance; }

/* the icon on each box: readable while the box lives alone, lit once it is in
   the row (no button, no back: the boxes line up once, by themselves) */
.kw-tool .kw-detail { stroke: var(--kw-line); stroke-width: 1.2; transition: stroke 500ms ease; }
.kw-tool .kw-dot { fill: var(--kw-line); stroke: none; transition: fill 500ms ease; }
.kw-fig.is-on .kw-tool .kw-detail { stroke: var(--kw-accent); }
.kw-fig.is-on .kw-tool .kw-dot { fill: var(--kw-accent); }
