/* krnali.io
 *
 * Engineering instrument, not SaaS marketing. Closer to a terminal than a landing
 * page. Near-black shell, one lighter surface, one border tone, two greys. ONE
 * accent, used sparingly. Semantic colour appears ONLY inside finding cards and is
 * never the sole carrier of meaning: every state carries a word as well.
 *
 * Nothing here shares a token, a scale or a component with the KeyFlux system.
 * That is the clean IP line, not a taste preference.
 */

:root {
  --shell:  #08090b;
  --surface:#0e1013;
  --raised: #14171c;
  --border: #21262e;

  --text:   #e6e9ee;
  --muted:  #8b94a3;

  /* Rivers from a mountain. Cold, precise, non-alarming: it suits a tool whose
     whole pitch is that it does not panic. */
  --accent: #6fb3d6;
  --accent-ink: #071016;

  /* Semantic, finding output only. */
  --warn:   #d9a441;
  --fail:   #e07b73;
  --unknown:#7b8494;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Inter, Helvetica, Arial, sans-serif;

  --wrap: 1080px;
  --r: 6px;
}

*, *::before, *::after { box-sizing: border-box; }

/* The nav is sticky, so an anchor jump would otherwise park the target heading
   underneath it. Every jump target clears the nav height plus a little air. */
:target, [id] { scroll-margin-top: 88px; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--shell);
  color: var(--text);
  font: 400 17px/1.6 var(--sans);
  letter-spacing: -0.005em;
}

.wrap { width: min(var(--wrap), calc(100% - 3rem)); margin-inline: auto; }
.mono { font-family: var(--mono); font-size: .82rem; letter-spacing: 0; }
.muted { color: var(--muted); }

h1, h2 { letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 .6em; font-weight: 600; }
h1 { font-size: clamp(1.9rem, 4.4vw, 3.1rem); }
h2 { font-size: clamp(1.4rem, 2.6vw, 2rem); }
h3 { font-size: 1.02rem; margin: 0 0 .5rem; }
p { margin: 0 0 1rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Focus is visible everywhere. Keyboard navigation is a requirement. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

.sr-only, .skip {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.skip:focus {
  position: fixed; top: .75rem; left: .75rem;
  width: auto; height: auto; clip-path: none;
  background: var(--accent); color: var(--accent-ink);
  padding: .6rem .9rem; border-radius: var(--r); z-index: 20;
}

/* ---------- nav ---------- */

.nav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--shell) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 1rem; }

.brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand__mark { display: block; height: 40px; width: auto; }
.brand__word { font-family: var(--mono); font-size: 1.05rem; letter-spacing: .01em; white-space: nowrap; }

.nav__links { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; justify-content: flex-end; }
/* :not(.btn) matters. `.nav__links a` is specificity (0,1,1) and `.btn` is (0,1,0),
   so without it the muted link colour wins over the button's ink and the nav CTA
   renders light-on-light. Measured 1.33:1 before this fix. With it the nav CTA is
   the same #071016 on #6fb3d6 as the hero button: 8.31:1, which clears WCAG AAA
   for normal text (7:1). */
.nav__links a:not(.btn) { color: var(--muted); font-size: .92rem; }
.nav__links a:not(.btn):hover { color: var(--text); text-decoration: none; }
@media (max-width: 620px) { .nav__links a:not(.btn) { display: none; } }

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  background: var(--accent); color: var(--accent-ink);
  padding: .72rem 1.15rem; border-radius: var(--r);
  font-weight: 600; font-size: .95rem; border: 1px solid var(--accent);
  cursor: pointer; font-family: inherit;
}
.btn:hover { text-decoration: none; filter: brightness(1.07); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--muted); filter: none; }
.btn--sm { padding: .45rem .8rem; font-size: .88rem; }

/* ---------- pills ---------- */

.pill {
  display: inline-block;
  font-family: var(--mono); font-size: .7rem; letter-spacing: .04em;
  padding: .18rem .5rem; border-radius: 999px; border: 1px solid;
  white-space: nowrap;
}
/* The word carries the meaning; colour only reinforces it. */
.pill--warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.pill--preview { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.pill--dev { color: var(--muted); border-color: var(--border); }

/* ---------- hero ---------- */

.hero { padding: clamp(3rem, 9vw, 6.5rem) 0 clamp(2.5rem, 6vw, 4rem); }
.hero__grid { display: grid; gap: 3rem; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 940px) { .hero__grid { grid-template-columns: 1.25fr .75fr; } }

.lede { font-size: 1.09rem; color: var(--muted); max-width: 60ch; }
.status { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; font-size: .95rem; color: var(--muted); margin-top: 1.3rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.4rem 0 1.1rem; }
.hint { margin: 0; line-height: 1.9; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 1.1rem 1.2rem;
}
.card__head { display: flex; justify-content: space-between; align-items: center; gap: .8rem; margin-bottom: .7rem; }
.card__title { font-size: .97rem; margin: 0 0 .9rem; }
.card__foot { margin: .9rem 0 0; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: .3rem .9rem; margin: 0; font-size: .78rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- section frame ---------- */

.proof, .cap, .examples, .how, .split, .fit, .cohort, .next, .faq {
  padding: clamp(2.5rem, 7vw, 5rem) 0;
  border-top: 1px solid var(--border);
}
.section-lede { color: var(--muted); max-width: 64ch; margin-bottom: 1.8rem; }

/* ---------- the finding output ---------- */

.terminal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden; margin: 0;
}
.terminal__bar {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .6rem .9rem; background: var(--raised);
  border-bottom: 1px solid var(--border);
}
/* Wide, real output. It scrolls inside its own box so the page body never does. */
.terminal__body {
  margin: 0; padding: 1.1rem .9rem;
  overflow-x: auto; line-height: 1.7;
  font-size: .78rem; white-space: pre;
  tab-size: 2;
}
.terminal__body .k { color: var(--muted); }
.terminal__body .v { color: var(--text); }
.terminal__body .w { color: var(--warn); }
.terminal__body .f { color: var(--fail); }
.terminal__body .a { color: var(--accent); }
.terminal__note {
  padding: .85rem .9rem; border-top: 1px solid var(--border);
  color: var(--muted); font-size: .88rem;
}

.proof__links { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1.4rem; font-size: .95rem; }

.calc { border: 1px solid var(--border); border-radius: var(--r); margin-top: 1.2rem; background: var(--surface); }
.calc summary { cursor: pointer; padding: .9rem 1.1rem; font-size: .97rem; list-style: none; }
.calc summary::-webkit-details-marker { display: none; }
.calc summary::before { content: "+"; color: var(--accent); font-family: var(--mono); margin-right: .7rem; }
.calc[open] summary::before { content: "\2212"; }
.calc__body { padding: 0 1.1rem 1.1rem; max-width: 72ch; }
.calc__body p { color: var(--muted); font-size: .95rem; }

/* ---------- capabilities ---------- */

.cap__grid { display: grid; gap: 1.8rem; }
@media (min-width: 860px) { .cap__grid { grid-template-columns: repeat(3, 1fr); } }
.cap__item p { color: var(--muted); font-size: .95rem; margin: 0; }

/* ---------- worked examples ---------- */

.ex { margin-top: 2.6rem; }
.ex:first-of-type { margin-top: 0; }
.ex__head { max-width: 70ch; margin-bottom: 1rem; }
.ex__head h3 { font-size: 1.1rem; margin-bottom: .3rem; }
.ex__meta { margin: 0 0 .7rem; }
.ex__note { color: var(--muted); font-size: .93rem; margin: 0; }

/* ---------- how ---------- */

.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; display: grid; gap: 1.4rem; }
@media (min-width: 860px) { .steps { grid-template-columns: repeat(4, 1fr); gap: 1.6rem; } }
.steps li { counter-increment: s; color: var(--muted); font-size: .95rem; }
.steps li::before { content: counter(s); display: block; font-family: var(--mono); color: var(--accent); font-size: .8rem; margin-bottom: .5rem; }
.steps b { color: var(--text); font-weight: 600; }

/* ---------- trust ---------- */

.bounds { padding: clamp(2.5rem, 7vw, 5rem) 0; background: var(--surface); border-block: 1px solid var(--border); }

.flow { display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; margin-bottom: 2.2rem; }
@media (min-width: 860px) { .flow { grid-template-columns: 1fr 1fr 1fr; } }
.flow__col { background: var(--shell); padding: 1.2rem 1.3rem; }
.flow__col--mid { background: var(--raised); }
.flow__col ul { margin: 0; padding-left: 1.1rem; color: var(--muted); font-size: .88rem; }
.flow__col li { margin-bottom: .45rem; }

.bounds__grid { display: grid; gap: 1.8rem; }
@media (min-width: 860px) { .bounds__grid { grid-template-columns: repeat(2, 1fr); } }
.bounds p { color: var(--muted); font-size: .95rem; margin: 0; }
.bounds__wide { grid-column: 1 / -1; border-top: 1px solid var(--border); padding-top: 1.6rem; }
.bounds__wide p { max-width: 82ch; }

/* ---------- split ---------- */

.split__grid { display: grid; gap: 2rem; }
@media (min-width: 760px) { .split__grid { grid-template-columns: 1fr 1fr; } }
.split ul, .fit ul { margin: 0; padding-left: 1.1rem; color: var(--muted); font-size: .95rem; }
.split li, .fit li { margin-bottom: .4rem; }

/* ---------- fit ---------- */

.fit__grid { display: grid; gap: 2rem; }
@media (min-width: 760px) { .fit__grid { grid-template-columns: 1fr 1fr; } }
.fit__note { margin-top: 2rem; font-size: .95rem; }

/* ---------- cohort ---------- */

.cohort {
  background:
    radial-gradient(120% 100% at 50% 0%,
      color-mix(in srgb, var(--accent) 9%, transparent), transparent 62%),
    var(--shell);
}
.cohort__inner { max-width: 62ch; }
.cohort > .wrap > p { color: var(--muted); }

/* The apply block replaced a form that posted to an endpoint which did not exist.
   No inputs, so no input styling: the only control is a link. */
.apply { margin-top: 1.8rem; display: grid; gap: 1.2rem; justify-items: start; }
.apply__btn { justify-self: start; }
.apply__lede { margin: 0; max-width: 62ch; }
.apply__ask {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 1.1rem 1.3rem; max-width: 62ch;
}
.apply__ask-head { margin: 0 0 .6rem; color: var(--text); font-size: .95rem; }
.apply__ask ul { margin: 0; padding-left: 1.1rem; display: grid; gap: .4rem; }
.apply__ask li { color: var(--muted); font-size: .95rem; }
.apply__note { margin: 0; font-size: .86rem; max-width: 62ch; }

/* ---------- next ---------- */

.next__inner { max-width: 68ch; }
.next__item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 1.5rem 1.6rem; }
.prod__head { display: flex; align-items: center; gap: .8rem; margin-bottom: .8rem; flex-wrap: wrap; }
.next__item h3 { margin: 0; font-size: 1.2rem; letter-spacing: -.01em; }
.next__item p { color: var(--muted); font-size: .95rem; }
.next__item p:last-child { margin-bottom: 0; }

/* ---------- faq ---------- */

.faq__inner { max-width: 70ch; }
.faq details { border-bottom: 1px solid var(--border); padding: .9rem 0; }
.faq summary { cursor: pointer; font-size: 1rem; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+"; color: var(--accent); font-family: var(--mono); margin-right: .7rem; }
.faq details[open] summary::before { content: "\2212"; }
.faq details p { color: var(--muted); margin: .7rem 0 0 1.55rem; font-size: .95rem; }

/* ---------- code + footer ---------- */

code { font-family: var(--mono); font-size: .86em; background: var(--raised); padding: .12em .38em; border-radius: 4px; color: var(--text); }

.foot { border-top: 1px solid var(--border); padding: 1.6rem 0; }
.foot__inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.foot__inner nav { display: flex; gap: 1.1rem; }
.foot__inner a { color: var(--muted); }

/* Almost no motion, by direction. Respect the setting anyway. */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
