:root {
  --bg: #fafaf8;
  --surface: #fff;
  --surface-alt: #f2f2ee;
  --surface-hover: #efefea;
  --text: #14161b;
  --muted: #545a66;
  --border: #e4e4de;
  --border-strong: #cdcdc5;
  --link: #1f4fd1;
  --accent: #ffd43b;
  --ink-tile: #15171c;
  --focus: #1f4fd1;
  --grid-line: #14161b0f;
  --glow: #ffd43b47;
  --btn-bg: #14161b;
  --btn-text: #fff;
  --btn-hover: #2a2e37;
  --warn-bg: #fff4d6;
  --warn-fg: #6b4e00;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --gutter: 1.25rem;
  --radius: 16px;
  --radius-sm: 10px;
  --header-h: 4.25rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f13;
    --surface: #15181e;
    --surface-alt: #111419;
    --surface-hover: #1e222a;
    --text: #eceef2;
    --muted: #a2a8b4;
    --border: #232832;
    --border-strong: #363c48;
    --link: #93b4ff;
    --ink-tile: #1f232b;
    --focus: #93b4ff;
    --grid-line: #ffffff0d;
    --glow: #ffd43b1f;
    --btn-bg: #eceef2;
    --btn-text: #0d0f13;
    --btn-hover: #fff;
    --warn-bg: #3a2f10;
    --warn-fg: #f3d27a;
    color-scheme: dark;
  }
}

@media (min-width: 640px) {
  :root { --gutter: 2rem; }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    radial-gradient(closest-side, var(--glow), transparent),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-position: 50% -14rem, top, top;
  background-size: 44rem 28rem, 56px 56px, 56px 56px;
  background-repeat: no-repeat, repeat, repeat;
  mask-image: radial-gradient(70% 55% at 50% 18%, #000 30%, transparent 100%);
}

header.site {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
  min-height: var(--header-h);
  width: 100%;
  max-width: calc(72rem + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
}

header.site a.brand {
  justify-self: start;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.015em;
  text-decoration: none;
  white-space: nowrap;
}

header.site a.brand::before {
  content: "K";
  width: 2.25rem;
  height: 2.25rem;
  border-radius: .75rem;
  background: var(--ink-tile);
  color: var(--accent);
  display: grid;
  flex: none;
  place-items: center;
  font-size: .9rem;
  font-weight: 800;
  letter-spacing: -.04em;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}

nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  justify-self: center;
}

nav a {
  color: var(--muted);
  font-size: .9375rem;
  font-weight: 500;
  text-decoration: none;
}

nav a:hover {
  color: var(--text);
}

.lang-switch {
  justify-self: end;
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.lang-switch a,
.lang-switch span {
  min-width: 2.25rem;
  padding: .3rem .55rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1;
  text-align: center;
  text-decoration: none;
}

.lang-switch a:hover {
  color: var(--text);
}

.lang-switch [aria-current] {
  background: var(--ink-tile);
  color: var(--accent);
}

main {
  width: 100%;
  max-width: calc(44rem + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(3.5rem, 10vw, 7rem) var(--gutter) 5rem;
}

h1 {
  max-width: 20ch;
  margin: 0 0 1.25rem;
  font-size: clamp(2.25rem, 1.25rem + 4.4vw, 4rem);
  font-weight: 750;
  line-height: 1.04;
  letter-spacing: -.04em;
  text-wrap: balance;
}

h2 {
  margin: 2.5rem 0 .75rem;
  font-size: 1.1875rem;
  line-height: 1.25;
  letter-spacing: -.01em;
}

h3 {
  margin: 0;
  font-size: 1.125rem;
  letter-spacing: -.01em;
}

p { margin: 0 0 1rem; }

a {
  color: var(--link);
  text-underline-offset: .18em;
  text-decoration-thickness: 1px;
}

a:hover { text-decoration-thickness: 2px; }

.lead {
  max-width: 40rem;
  color: var(--muted);
  font-size: clamp(1.0625rem, 1rem + .4vw, 1.25rem);
  text-wrap: pretty;
}

.card {
  margin: 1.5rem 0;
  padding: 1.5rem 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.draft {
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--warn-bg);
  color: var(--warn-fg);
  border: 1px solid color-mix(in srgb, var(--warn-fg) 18%, transparent);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .08em;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: .75rem 1.4rem;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: background-color .15s, border-color .15s;
}

.button:hover {
  background: var(--btn-hover);
  text-decoration: none;
}

ol,
ul { padding-left: 1.25rem; }

ol li,
ul li { margin: .45rem 0; }

strong { color: var(--text); }

.site-footer {
  margin-top: 4rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .9375rem;
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2rem;
  padding: 3rem 0 2rem;
}

.footer-about {
  max-width: 19rem;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .75rem;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -.015em;
  text-decoration: none;
}

.footer-brand::before {
  content: "K";
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--ink-tile);
  color: var(--accent);
  border-radius: .75rem;
  font-size: .9rem;
  font-weight: 800;
  letter-spacing: -.04em;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}

.footer-about p {
  margin: .25rem 0 0;
}

.footer-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem 4rem;
}

.footer-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .5rem;
}

.footer-heading {
  margin: 0 0 .25rem;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text);
  text-decoration: underline;
}

.footer-copy {
  margin: 0;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: .875rem;
}

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

@media (max-width: 720px) {
  header.site {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: .7rem;
    padding-block: .85rem;
  }

  .lang-switch {
    position: absolute;
    top: .85rem;
    right: var(--gutter);
  }

  nav {
    flex-wrap: wrap;
    gap: .4rem 1rem;
  }

  h1 { max-width: 12ch; }
}

@media (max-width: 640px) {
  .footer-top {
    align-items: center;
    flex-direction: column;
    text-align: center;
  }

  .footer-columns {
    justify-content: center;
  }

  .footer-links {
    align-items: center;
  }
}
