/* KILIDLAB landing. Plain CSS, no build step.
   Components use the tokens below only. Dark navy is the default; light mirrors it. */

:root {
  --bg: #0c1526;          /* navy page */
  --band: #0f1b31;        /* alternate section */
  --surface: #13213a;     /* cards, form */
  --line: #26354f;        /* borders, rules */
  --ink: #e8edf5;         /* body text */
  --ink-muted: #9eabc1;   /* secondary text, blue-biased */
  --accent: #f0b44c;      /* brass: the one accent */
  --accent-strong: #f7c977;
  --on-accent: #1b1304;
  --stop: #f08a7e;        /* block / errors */
  --ok: #8fd6b0;          /* success */
  --focus: #f7c977;
  color-scheme: dark;

  --font-display: "Bricolage Grotesque", "Segoe UI Variable Display", "Avenir Next", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --r: 4px;
  --maxw: 1140px;
  --gutter: clamp(16px, 4vw, 32px);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f5f9;
    --band: #e8ecf3;
    --surface: #ffffff;
    --line: #cfd7e4;
    --ink: #101c30;
    --ink-muted: #47566e;
    --accent: #8f5300;
    --accent-strong: #6f4000;
    --on-accent: #ffffff;
    --stop: #b23a2e;
    --ok: #1d7a4c;
    --focus: #8f5300;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f3f5f9;
  --band: #e8ecf3;
  --surface: #ffffff;
  --line: #cfd7e4;
  --ink: #101c30;
  --ink-muted: #47566e;
  --accent: #8f5300;
  --accent-strong: #6f4000;
  --on-accent: #ffffff;
  --stop: #b23a2e;
  --ok: #1d7a4c;
  --focus: #8f5300;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0c1526;
  --band: #0f1b31;
  --surface: #13213a;
  --line: #26354f;
  --ink: #e8edf5;
  --ink-muted: #9eabc1;
  --accent: #f0b44c;
  --accent-strong: #f7c977;
  --on-accent: #1b1304;
  --stop: #f08a7e;
  --ok: #8fd6b0;
  --focus: #f7c977;
  color-scheme: dark;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.12; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 5.4vw, 3.6rem); font-weight: 800; letter-spacing: -.02em; max-width: 20ch; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); font-weight: 800; letter-spacing: -.015em; }
h3 { font-size: 1.3rem; font-weight: 600; }
p { margin: 0 0 1em; max-width: 65ch; }
code, .mono { font-family: var(--font-mono); font-size: .88em; }
code { padding: .08em .3em; border: 1px solid var(--line); border-radius: var(--r); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-muted); }
.small { font-size: .875rem; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--gutter); top: -100px; z-index: 100;
  background: var(--accent); color: var(--on-accent); padding: .6rem 1rem; font-weight: 600;
}
.skip-link:focus { top: .75rem; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.eyebrow {
  font-family: var(--font-mono); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-muted); margin-bottom: .9rem;
}

/* Buttons and links */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: .65rem 1.25rem; border-radius: var(--r);
  font: 600 1rem/1.2 var(--font-body); text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: background-color .15s, border-color .15s, color .15s;
}
.btn-sm { min-height: 40px; padding: .5rem 1rem; font-size: .95rem; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-strong); color: var(--on-accent); }
.btn-ghost { border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); color: var(--ink); }
.btn[disabled] { opacity: .65; cursor: progress; }
.text-link { font-weight: 600; }

.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0;
  background: transparent; color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 68px; }
.header-tools { display: flex; align-items: center; gap: .75rem; }
.wordmark {
  font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; letter-spacing: .08em;
  color: var(--ink); text-decoration: none;
}
.wordmark span { color: var(--accent); }
.wordmark:hover { color: var(--ink); }
.site-nav ul { list-style: none; display: flex; align-items: center; gap: 1.75rem; margin: 0 .5rem 0 0; padding: 0; }
.site-nav a:not(.btn) { color: var(--ink-muted); text-decoration: none; font-weight: 500; }
.site-nav a:not(.btn):hover { color: var(--ink); }

.nav-toggle { display: none; position: relative; }
.nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after {
  display: block; width: 18px; height: 2px; background: var(--ink); content: ""; position: relative;
}
.nav-toggle-bar::before { position: absolute; top: -6px; }
.nav-toggle-bar::after { position: absolute; top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::after { top: 0; transform: rotate(-45deg); }

/* Hero: sized to content */
.hero { padding: clamp(3.5rem, 9vw, 6.5rem) 0 clamp(2.5rem, 6vw, 4rem); border-bottom: 1px solid var(--line); }
.lead { font-size: clamp(1.1rem, 2vw, 1.3rem); color: var(--ink-muted); }
.hero-cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }
.hero-index {
  list-style: none; margin: clamp(2.5rem, 6vw, 4rem) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line);
}
.hero-index li { min-width: 0; border-right: 1px solid var(--line); }
.hero-index li:last-child { border-right: 0; }
.hero-index a {
  display: block; padding: 1rem 1rem 0 0; margin-left: 1rem; color: var(--ink); text-decoration: none; font-weight: 600;
}
.hero-index li:first-child a { margin-left: 0; }
.hero-index a:hover { color: var(--accent); }
.hero-index .mono { display: block; color: var(--ink-muted); font-weight: 400; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; margin-bottom: .25rem; }

/* Sections */
.section { padding: clamp(3.5rem, 8vw, 6rem) 0; }
.section-band { background: var(--band); border-block: 1px solid var(--line); }
.section-head { margin-bottom: 2.25rem; }
.section-lead { color: var(--ink-muted); font-size: 1.1rem; }

/* Tool cards (the only card-styled group besides the form) */
.cards { display: grid; gap: 1.25rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
  min-width: 0; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1.6rem;
}
.card > * { min-width: 0; }
.card p { color: var(--ink-muted); }
.card-kind { color: var(--ink-muted); text-transform: uppercase; letter-spacing: .06em; font-size: .74rem; margin-bottom: 1rem; }
.card h3 { font-size: 1.75rem; font-weight: 800; margin-bottom: .2rem; }
.card .card-tag { color: var(--ink); font-weight: 600; }
.title-with-icon { display: flex; align-items: center; gap: .55rem; }
.title-with-icon img { width: 28px; height: 28px; }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1.1rem; margin-top: auto; padding-top: 1.25rem; }

.spec { list-style: none; margin: 0 0 .5rem; padding: 0; border-top: 1px solid var(--line); }
.spec li { padding: .6rem 0; border-bottom: 1px solid var(--line); font-size: .95rem; }

/* Insula diagram */
.diagram { margin: 0 0 2.5rem; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface); }
.diagram-svg { display: block; width: 100%; height: auto; }
.d-band-user { fill: var(--surface); }
.d-band-kernel { fill: var(--band); }
.d-boundary { stroke: var(--ink-muted); stroke-width: 1.5; stroke-dasharray: 6 5; }
.d-band-label { fill: var(--ink-muted); font: 500 12px var(--font-mono); letter-spacing: .14em; }
.d-box { fill: var(--bg); stroke: var(--line); stroke-width: 1.5; }
.d-box-accent { stroke: var(--accent); stroke-width: 2; }
.d-box-stop { stroke: var(--stop); stroke-width: 2; }
.d-text { fill: var(--ink); font: 600 16px var(--font-body); }
.d-mono { fill: var(--ink-muted); font: 400 12.5px var(--font-mono); }
.d-line { fill: none; stroke: var(--ink-muted); stroke-width: 1.6; }
.d-line-accent { stroke: var(--accent); stroke-width: 2; }
.d-line-faint { stroke-dasharray: 4 4; }
.d-arrowhead { fill: var(--ink-muted); }

.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; }
.steps li { counter-increment: step; min-width: 0; padding-top: 1rem; border-top: 2px solid var(--line); }
.steps li:nth-child(3) { border-top-color: var(--stop); }
.steps li:nth-child(4) { border-top-color: var(--accent); }
.steps li::before {
  content: counter(step, decimal-leading-zero); display: block;
  font-family: var(--font-mono); font-size: .85rem; color: var(--ink-muted); margin-bottom: .4rem;
  font-variant-numeric: tabular-nums;
}
.steps h3 { font-size: 1.1rem; }
.steps p { color: var(--ink-muted); font-size: .97rem; }

/* Service */
.service { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 2rem 4rem; align-items: start; }
.service-body > p:first-child { font-size: 1.15rem; }
.facts { margin: 1.5rem 0; padding: 0; border-top: 1px solid var(--line); }
.facts div { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.facts dt { font-family: var(--font-mono); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); padding-top: .15rem; }
.facts dd { margin: 0; min-width: 0; }

/* About */
.about { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 2rem 4rem; align-items: start; }
.about-text p { color: var(--ink-muted); }
.facts-legal { margin: 0; }

/* Contact */
.contact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 2rem 4rem; align-items: start; }
.contact-intro p { color: var(--ink-muted); }
.form { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: clamp(1.1rem, 3vw, 2rem); }
.field { margin: 0 0 1.25rem; border: 0; padding: 0; min-width: 0; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 1rem; }
.field > label, .field legend { display: block; font-weight: 600; margin-bottom: .4rem; font-size: .97rem; padding: 0; }
.req { font-weight: 400; color: var(--ink-muted); font-size: .88em; }
.field input[type="text"], .field input[type="email"], .field textarea {
  width: 100%; min-height: 44px; background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r); padding: .65rem .8rem; font: inherit;
}
.field textarea { resize: vertical; min-height: 130px; }
.field input:hover, .field textarea:hover { border-color: var(--ink-muted); }
.field input:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
.field [aria-invalid="true"] { border-color: var(--stop); }
.hint { color: var(--ink-muted); font-size: .88rem; margin: .4rem 0 0; }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.check {
  display: flex; align-items: center; gap: .6rem; min-height: 48px; padding: .6rem .8rem;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; font-weight: 500;
}
.check:hover { border-color: var(--ink-muted); }
.check:has(input:checked) { border-color: var(--accent); }
.check input, .consent input { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--accent); flex-shrink: 0; }
fieldset[aria-invalid="true"] .check { border-color: var(--stop); }
.consent { display: flex; align-items: flex-start; gap: .6rem; font-size: .95rem; color: var(--ink-muted); cursor: pointer; }
.consent input { margin-top: .25rem; }
.error { color: var(--stop); font-size: .9rem; margin: .4rem 0 0; }
.form-status { margin: 1rem 0 0; min-height: 1.5em; font-weight: 500; }
.form-status.is-success { color: var(--ok); }
.form-status.is-error { color: var(--stop); }
.form-status.is-info { color: var(--ink-muted); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 2.75rem 0 2rem; }
.footer-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem 3rem; align-items: start; }
.footer-inner p { margin: .75rem 0 0; }
.footer-links { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; margin: 0; padding: 0; }
.footer-links a { color: var(--ink-muted); text-decoration: none; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; }
.footer-note { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 1.25rem; }

/* Responsive */
@media (max-width: 980px) {
  .cards { grid-template-columns: minmax(0, 1fr); }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .service, .about, .contact { grid-template-columns: minmax(0, 1fr); }
  .hero-index { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-index li:nth-child(2) { border-right: 0; }
  .hero-index li:nth-child(n+3) a { padding-top: 1rem; }
  .hero-index li:nth-child(odd) a { margin-left: 0; }
}
@media (max-width: 760px) {
  .nav-toggle { display: inline-grid; }
  .site-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; align-items: stretch; gap: 0; margin: 0; padding: .25rem var(--gutter) 1.25rem; }
  .site-nav a:not(.btn) { display: block; padding: .85rem 0; border-bottom: 1px solid var(--line); }
  .site-nav .btn { margin-top: 1rem; width: 100%; }
  .diagram { overflow-x: auto; }
  .diagram-svg { min-width: 640px; }
}
@media (max-width: 560px) {
  .steps, .checks, .field-row { grid-template-columns: minmax(0, 1fr); }
  .facts div { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
  .footer-inner { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 400px) {
  .hero-index { grid-template-columns: minmax(0, 1fr); }
  .hero-index li { border-right: 0; border-bottom: 1px solid var(--line); }
  .hero-index li a { margin-left: 0 !important; padding: .75rem 0; }
  .hero-cta .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
