/* ==========================================================================
   Krovi website: shared styles (tokens, base, nav, buttons, chips, footer, utilities)
   Direction: warm cream paper, an elegant high-contrast serif for headlines with a muted
   italic second line, a clean geometric sans for body text, generous whitespace, dark-bezel
   device frames, small pill chips with a green dot, keycaps. LIGHT is the default; dark is an
   opt-in toggle that is remembered (never chosen from the OS setting).
   No external requests: every font is self-hosted under /fonts (SIL OFL 1.1, licences beside them).
   Type: EB Garamond (headlines, variable wght, roman + italic) / Figtree (body, variable wght) /
   Geist Mono (labels, keycaps, code).
   ========================================================================== */

/* ---------- self-hosted fonts (latin subset, variable) ---------- */
@font-face {
  font-family: "EB Garamond";
  src: url("/fonts/eb-garamond-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 800; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "EB Garamond";
  src: url("/fonts/eb-garamond-latin-wght-italic.woff2") format("woff2");
  font-weight: 400 800; font-style: italic; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Figtree";
  src: url("/fonts/figtree-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/geist-mono-latin-wght.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* metric-adjusted system fallbacks so the swap does not move the layout */
@font-face { font-family: "Figtree Fallback"; src: local("Segoe UI"), local("Arial"); size-adjust: 102%; ascent-override: 93%; descent-override: 24%; line-gap-override: 0%; }
@font-face { font-family: "Garamond Fallback"; src: local("Georgia"), local("Times New Roman"); size-adjust: 92%; ascent-override: 96%; descent-override: 28%; line-gap-override: 0%; }

:root {
  /* LIGHT is the default. Dark only when the visitor chooses it (html[data-theme="dark"]). */
  color-scheme: light;

  /* --- palette: cream paper + warm ink, one calm green --- */
  --bg: light-dark(#ffffff, #14130e);                  /* bright white page in light */
  --bg-alt: light-dark(#f7f7f4, #1a1912);
  --surface: light-dark(#ffffff, #1f1e16);
  --surface-2: light-dark(#f6f6f2, #26251c);
  --surface-3: light-dark(#ecece6, #302f24);
  --ink: light-dark(#1a1a18, #f3f1e0);
  --on-ink: light-dark(#ffffff, #14130e);
  --text: light-dark(#1a1a18, #f3f1e0);
  --text-2: light-dark(#454540, #cfccb6);
  --text-3: light-dark(#64645d, #a3a18a);
  --serif-muted: light-dark(#6b6a55, #a9a68d);        /* the italic second line of a headline */
  --line: light-dark(rgba(30, 30, 24, 0.11), rgba(243, 241, 224, 0.12));
  --line-2: light-dark(rgba(30, 30, 24, 0.22), rgba(243, 241, 224, 0.24));
  --accent: light-dark(#3f9156, #7bc58b);             /* dots, rings */
  --accent-text: light-dark(#2b6a3d, #93d3a1);        /* AA text/link variant */
  --accent-soft: light-dark(rgba(63, 145, 86, 0.13), rgba(123, 197, 139, 0.16));
  --warm: light-dark(#8a5a1e, #e0b676);               /* "new in v0.3" accent (text) */
  --warm-soft: light-dark(rgba(176, 120, 40, 0.13), rgba(224, 182, 118, 0.16));
  --hi: light-dark(rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.06));
  --bezel: #0f0f0b;                                    /* device frames are dark in both themes */
  --bezel-edge: light-dark(rgba(0, 0, 0, 0), rgba(255, 255, 255, 0.14));

  --shadow-s: 0 1px 2px rgba(20, 20, 16, 0.06), 0 4px 14px -6px rgba(20, 20, 16, 0.1);
  --shadow-m: 0 1px 2px rgba(20, 20, 16, 0.05), 0 18px 40px -18px rgba(20, 20, 16, 0.2);
  --shadow-l: 0 2px 4px rgba(20, 20, 16, 0.05), 0 40px 80px -30px rgba(20, 20, 16, 0.38);

  /* --- type --- */
  --font: "Figtree", "Figtree Fallback", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "EB Garamond", "Garamond Fallback", Georgia, "Times New Roman", serif;
  --mono: "Geist Mono", ui-monospace, "Cascadia Code", "SF Mono", Consolas, Menlo, monospace;

  /* --- geometry & motion --- */
  --r-s: 10px;
  --r-m: 16px;
  --r-l: 24px;
  --r-xl: 32px;
  --r-pill: 999px;
  --wrap: 1120px;
  --nav-h: 64px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="dark"] {
  --shadow-s: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 14px -6px rgba(0, 0, 0, 0.4);
  --shadow-m: 0 1px 2px rgba(0, 0, 0, 0.3), 0 18px 40px -18px rgba(0, 0, 0, 0.6);
  --shadow-l: 0 2px 4px rgba(0, 0, 0, 0.3), 0 40px 80px -30px rgba(0, 0, 0, 0.7);
}

/* ---------- reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-h) + 24px);
  background: var(--bg);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, video { display: block; max-width: 100%; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
/* links inside running text are always underlined (they must not rely on colour alone) */
:where(p, td, dd, figcaption, .callout, .prose li, .points li, .steps li, .release-body li, .faq-a li) a:not(.btn):not(.link-arrow):not(.chip) {
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
}
:where(p, td, dd, figcaption, .callout, .prose li, .points li, .steps li, .release-body li, .faq-a li) a:not(.btn):not(.link-arrow):not(.chip):hover { text-decoration-color: currentColor; }
p { margin: 0 0 1rem; text-wrap: pretty; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 450; text-wrap: balance; }
ul, ol { margin: 0; padding: 0; }
code, kbd, samp, pre { font-family: var(--mono); }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
::selection { background: var(--accent-soft); }

:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; border-radius: 8px; }
.btn:focus-visible, .chip:focus-visible { border-radius: 999px; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed; left: 16px; top: -64px; z-index: 100;
  padding: 10px 18px; border-radius: 999px;
  background: var(--ink); color: var(--on-ink);
  font-weight: 600; text-decoration: none;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; text-decoration: none; }

.wrap { width: min(var(--wrap), calc(100% - 48px)); margin-inline: auto; }
.wrap-narrow { width: min(780px, calc(100% - 48px)); margin-inline: auto; }
@media (max-width: 600px) {
  .wrap, .wrap-narrow { width: calc(100% - 32px); }
}

/* ---------- typography ---------- */
h1, .h1 {
  font-size: clamp(2.7rem, 1.5rem + 5.4vw, 5.4rem);
  line-height: 1.02;
  letter-spacing: -0.022em;
}
h2, .h2 {
  font-size: clamp(2.1rem, 1.3rem + 3.2vw, 3.7rem);
  line-height: 1.05;
  letter-spacing: -0.018em;
}
h3 { font-size: 1.5rem; line-height: 1.2; letter-spacing: -0.01em; }
h4 { font-family: var(--font); font-size: 1rem; font-weight: 650; }
/* the italic second line: muted olive-grey */
h1 em, h2 em, h3 em, .h2 em { font-style: italic; color: var(--serif-muted); font-weight: 400; }
h1 em.block, h2 em.block { display: block; }
.lede {
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.32rem);
  line-height: 1.55;
  color: var(--text-2);
}
.muted { color: var(--text-3); }
.small { font-size: 0.9rem; }
.center { text-align: center; }
.eyebrow {
  display: inline-block;
  font-family: var(--mono); font-size: 0.78rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 16px;
}
/* an eyebrow plus a version badge on one line */
.kicker { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 18px; }
.kicker .eyebrow { margin: 0; }
.section-head .kicker { justify-content: center; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav-inner { height: 100%; display: flex; align-items: center; gap: 28px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 520; font-size: 1.55rem; letter-spacing: -0.01em; line-height: 1;
  color: var(--text); text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; flex: none; }
.bm-bg { fill: var(--ink); }
.bm-pill { fill: var(--on-ink); }
.bm-dot { fill: var(--ink); }
.nav-links { display: flex; align-items: center; gap: 2px; margin-left: 8px; flex: 1; }
.nav-links a {
  padding: 8px 12px; border-radius: 999px;
  color: var(--text-2); font-size: 0.95rem; font-weight: 500; text-decoration: none;
  transition: color 0.2s, background 0.2s;
}
.nav-links a:hover { color: var(--text); background: var(--surface-3); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--text); font-weight: 650; }
.nav-tools { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: 50%; border: 1px solid transparent; background: transparent; color: var(--text-2);
  transition: background 0.2s, color 0.2s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
.nav-toggle { display: none; }
.nav-cta { height: 38px; padding: 0 18px; font-size: 0.93rem; margin-right: 4px; }

@media (max-width: 900px) {
  .nav-toggle { display: inline-grid; }
  .nav-links {
    position: absolute; left: 0; right: 0; top: var(--nav-h);
    flex-direction: column; align-items: stretch; gap: 2px;
    margin: 0; padding: 10px 16px 18px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-m);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0s linear 0.25s;
  }
  .nav-links[data-open="true"] {
    opacity: 1; visibility: visible; transform: none;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0s;
  }
  .nav-links a { padding: 13px 14px; font-size: 1.05rem; border-radius: 12px; }
  .nav-tools { margin-left: auto; }
}
@media (max-width: 480px) { .nav-tools .nav-cta { display: none; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 48px; padding: 0 26px;
  border-radius: 999px; border: 1px solid transparent;
  font-size: 1rem; font-weight: 600; letter-spacing: -0.005em; line-height: 1;
  text-decoration: none; white-space: nowrap;
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s, box-shadow 0.25s var(--ease), color 0.2s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--ink); color: var(--on-ink); box-shadow: var(--shadow-s); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-m); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-lg { height: 56px; padding: 0 32px; font-size: 1.05rem; }
.btn-sm { height: 38px; padding: 0 18px; font-size: 0.93rem; }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.link-arrow svg { width: 16px; height: 16px; transition: transform 0.25s var(--ease); }
.link-arrow:hover svg { transform: translateX(3px); }
.link-arrow:hover { text-decoration: none; }

/* ---------- chips, badges, keycaps ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 8px 18px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid var(--line-2);
  font-size: 0.95rem; font-weight: 500; color: var(--text); text-decoration: none; line-height: 1.2;
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; }
.chip-row.center { justify-content: center; }
a.chip:hover { text-decoration: none; background: var(--surface-3); }

/* "New in v0.3" / "From v0.2" labels */
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 11px; border-radius: 999px;
  font-family: var(--mono); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.5;
  white-space: nowrap; vertical-align: middle;
}
.badge-soon { background: var(--warm-soft); color: var(--warm); border: 1px solid color-mix(in srgb, var(--warm) 35%, transparent); }
.badge-live { background: var(--accent-soft); color: var(--accent-text); border: 1px solid color-mix(in srgb, var(--accent-text) 30%, transparent); }
.badge-demo { background: var(--surface-3); color: var(--text-2); border: 1px solid var(--line-2); }

kbd {
  display: inline-block; min-width: 2em; padding: 0.2em 0.6em 0.28em;
  border-radius: 8px; border: 0; border-bottom: 3px solid color-mix(in srgb, var(--ink) 60%, #000);
  background: var(--ink); color: var(--on-ink);
  font-size: 0.8em; font-weight: 500; line-height: 1.15; text-align: center;
}
:root[data-theme="dark"] kbd { border-bottom-color: color-mix(in srgb, var(--ink) 55%, #000); }
.keys { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.keys .plus { color: var(--text-3); font-size: 0.9em; }

code {
  padding: 0.14em 0.42em; border-radius: 6px; background: var(--surface-3);
  font-size: 0.88em; color: var(--text);
}
pre code { padding: 0; background: none; font-size: inherit; }

.codeblock {
  position: relative; margin: 0 0 1.25rem;
  border-radius: var(--r-m); border: 1px solid var(--line);
  background: var(--surface-2);
  overflow: hidden;
}
.codeblock-head {
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem; color: var(--text-3); font-family: var(--mono);
}
.codeblock-head span { flex: 1; }
.codeblock pre {
  margin: 0; padding: 16px 18px; overflow-x: auto; font-size: 0.86rem; line-height: 1.65; color: var(--text);
  -webkit-overflow-scrolling: touch;
}
.codeblock pre .c { color: var(--text-3); }
.codeblock pre .k { color: var(--accent-text); }
.copy-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface);
  font-size: 0.76rem; font-weight: 560; color: var(--text-2);
  transition: background 0.2s, color 0.2s;
}
.copy-btn:hover { background: var(--surface-3); color: var(--text); }
.copy-btn svg { width: 13px; height: 13px; }
.copy-btn[data-copied="true"] { color: var(--accent-text); border-color: var(--accent); }

.callout {
  display: flex; gap: 14px; padding: 16px 18px; margin: 1.5rem 0;
  border-radius: var(--r-m); border: 1px solid var(--line); background: var(--surface-2);
  font-size: 0.97rem; color: var(--text-2);
}
.callout > svg { width: 20px; height: 20px; flex: none; margin-top: 2px; color: var(--text); }
.callout > div, .callout > p { min-width: 0; flex: 1; }
.callout code, .prose p code, .prose li code { overflow-wrap: anywhere; }
.callout p:last-child { margin-bottom: 0; }
.callout strong { color: var(--text); }
.callout.warn { background: var(--warm-soft); border-color: color-mix(in srgb, var(--warm) 30%, transparent); }

/* ---------- sections ---------- */
.section { padding-block: clamp(72px, 10vw, 140px); position: relative; }
.section-alt { background: var(--bg-alt); }
.section-head { max-width: 780px; margin: 0 auto clamp(40px, 5vw, 72px); text-align: center; }
.section-head .lede { margin: 22px auto 0; max-width: 40rem; }

/* ---------- scroll reveal (only when JS is on; reduced motion = instant) ---------- */
.js .reveal {
  opacity: 0; transform: translateY(14px);
  transition: opacity 0.7s var(--ease-out), transform 0.8s var(--ease-out);
  transition-delay: calc(var(--d, 0) * 80ms);
}
.js .reveal.in { opacity: 1; transform: none; }
.d1 { --d: 1; } .d2 { --d: 2; } .d3 { --d: 3; } .d4 { --d: 4; } .d5 { --d: 5; } .d6 { --d: 6; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); background: var(--bg-alt); padding: 72px 0 32px; }
.footer-top { display: grid; grid-template-columns: 1.5fr repeat(4, 1fr); gap: 32px; }
.footer-brand p { color: var(--text-3); font-size: 0.97rem; max-width: 28ch; margin: 14px 0 0; }
.footer-col h3 {
  margin: 0 0 14px; font-family: var(--mono); font-size: 0.74rem; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3);
}
.footer-col ul { list-style: none; display: grid; gap: 9px; }
.footer-col a { color: var(--text-2); font-size: 0.97rem; text-decoration: none; }
.footer-col a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.footer-bottom {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px 24px;
  margin-top: 48px; padding-top: 22px; border-top: 1px solid var(--line);
  font-size: 0.88rem; color: var(--text-3);
}
.footer-trust { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; }
.footer-trust span { display: inline-flex; align-items: center; gap: 6px; }
.footer-trust span::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--text-3); }
@media (max-width: 960px) { .footer-top { grid-template-columns: repeat(2, minmax(0, 1fr)); } .footer-brand { grid-column: 1 / -1; } }

/* ---------- icons + small utilities (CSP forbids inline style attributes) ---------- */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg.ic { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
svg.ic-fill { fill: currentColor; stroke: none; }
.btn-ic { display: inline; width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; }
.mt-18 { margin-top: 18px; }
.mt-22 { margin-top: 22px; }
.mt-32 { margin-top: 32px; }
.codeblock-flush { margin: 14px 0 0; }

/* ---------- static progress bars / width helpers (no inline styles) ---------- */
.bar { display: block; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--ink); }
.w5 { width: 5%; } .w10 { width: 10%; } .w15 { width: 15%; } .w20 { width: 20%; } .w25 { width: 25%; }
.w30 { width: 30%; } .w35 { width: 35%; } .w40 { width: 40%; } .w45 { width: 45%; } .w50 { width: 50%; }
.w55 { width: 55%; } .w60 { width: 60%; } .w65 { width: 65%; } .w70 { width: 70%; } .w75 { width: 75%; }
.w80 { width: 80%; } .w85 { width: 85%; } .w90 { width: 90%; } .w95 { width: 95%; } .w100 { width: 100%; }
