/* Kruftle — kruftle.dizitart.com
   One stylesheet, no framework, no web fonts. The palette is the app's own:
   amber #E0A33C on near-black, the same seed colour KruftleTheme uses. */

:root {
  --bg: #0e1013;
  --bg-alt: #131519;
  --surface: #191c22;
  --surface-2: #20242c;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e9eaee;
  --muted: #9aa1ac;
  --faint: #6d747f;
  --accent: #e0a33c;
  --accent-hi: #ffd182;
  --accent-soft: rgba(224, 163, 60, 0.13);
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, 0.12);
  --danger: #f87171;
  --radius: 14px;
  --radius-sm: 8px;
  --maxw: 1120px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, "Cascadia Mono",
    Consolas, "DejaVu Sans Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --shadow: 0 24px 70px -20px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbfaf8;
    --bg-alt: #f2f0ec;
    --surface: #ffffff;
    --surface-2: #f7f5f1;
    --border: rgba(0, 0, 0, 0.1);
    --border-strong: rgba(0, 0, 0, 0.2);
    --text: #1a1d22;
    --muted: #5b616b;
    --faint: #838a94;
    --accent: #9a6100;
    --accent-hi: #7c4d00;
    --accent-soft: rgba(224, 163, 60, 0.16);
    --green: #15803d;
    --green-soft: rgba(21, 128, 61, 0.1);
    --danger: #c02626;
    --shadow: 0 24px 60px -24px rgba(30, 25, 15, 0.28);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3, h4 {
  margin: 0 0 0.5em;
  line-height: 1.15;
  letter-spacing: -0.022em;
  font-weight: 680;
}
h1 { font-size: clamp(2.4rem, 5.2vw, 3.9rem); }
h2 { font-size: clamp(1.75rem, 3.2vw, 2.35rem); }
h3 { font-size: 1.16rem; letter-spacing: -0.012em; }
p { margin: 0 0 1em; }
code, kbd, pre { font-family: var(--mono); }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 780px; }

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

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-in {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 62px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.06rem;
  color: var(--text);
}
.brand:hover { text-decoration: none; color: var(--text); }
.brand img { width: 26px; height: 26px; border-radius: 7px; display: block; }
.nav-links { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav-links a {
  color: var(--muted);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  font-weight: 500;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-links a.cta {
  color: #16181d;
  background: var(--accent);
  font-weight: 650;
}
@media (prefers-color-scheme: light) { .nav-links a.cta { color: #fff; background: #b06f0d; } }
.nav-links a.cta:hover { background: var(--accent-hi); color: #16181d; }
@media (max-width: 720px) { .nav-links a.hide-sm { display: none; } }

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

.hero {
  position: relative;
  overflow: hidden;
  padding: 84px 0 0;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(900px 420px at 50% -8%, var(--accent-soft), transparent 70%),
    linear-gradient(var(--bg), var(--bg-alt));
}
.hero h1 { max-width: 15ch; }
.hero .lede {
  font-size: clamp(1.06rem, 2vw, 1.28rem);
  color: var(--muted);
  max-width: 60ch;
  margin-bottom: 30px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  padding: 5px 11px;
  border-radius: 999px;
  margin-bottom: 22px;
}

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 22px;
  border-radius: 10px;
  font-weight: 640;
  font-size: 1rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #16181d; }
.btn-primary:hover { background: var(--accent-hi); color: #16181d; }
@media (prefers-color-scheme: light) {
  .btn-primary { background: #b06f0d; color: #fff; }
  .btn-primary:hover { background: #8f5906; color: #fff; }
}
.btn-ghost { border-color: var(--border-strong); color: var(--text); background: transparent; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn svg { width: 18px; height: 18px; flex: none; }

.hero-note { margin-top: 16px; font-size: 0.88rem; color: var(--faint); }
.hero-note strong { color: var(--muted); font-weight: 600; }

.shot {
  margin: 54px auto -1px;
  max-width: 1060px;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--surface);
}
.shot img { display: block; width: 100%; height: auto; }
.shot-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--border-strong); }
.shot-title {
  margin-left: 8px;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--faint);
}

/* ---------- generic sections ---------- */

section { padding: 84px 0; }
/* The nav is sticky, so an anchor landing must clear it. */
section[id], article[id], h2[id], h3[id] { scroll-margin-top: 78px; }
section.alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.sec-head { max-width: 700px; margin-bottom: 44px; }
.sec-head p { color: var(--muted); font-size: 1.06rem; margin: 0; }
.kicker {
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
  display: block;
}

.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.card h3 { margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 0.96rem; margin: 0; }
.card .ico {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 15px;
}
.card .ico svg { width: 19px; height: 19px; }

/* ---------- command strip ---------- */

.cmds {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  font-family: var(--mono);
  font-size: 0.855rem;
}
.cmds span {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  padding: 6px 11px;
  border-radius: 7px;
  white-space: nowrap;
}
.cmds span b { color: var(--accent); font-weight: 600; }

/* ---------- numbered steps ---------- */

.steps { counter-reset: step; display: grid; gap: 2px; }
.step {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 20px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.step:last-child { border-bottom: none; }
.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 0.92rem;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  background: var(--accent-soft);
  border-radius: 8px;
  width: 44px;
  text-align: center;
  padding: 6px 0;
}
.step h3 { margin-bottom: 5px; }
.step p { color: var(--muted); margin: 0; font-size: 0.98rem; }

/* ---------- rails / checklists ---------- */

.rails { display: grid; gap: 14px; }
.rail {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 14px;
  align-items: start;
}
.rail svg { width: 20px; height: 20px; color: var(--green); margin-top: 3px; flex: none; }
.rail b { font-weight: 640; }
.rail span { color: var(--muted); }

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

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 0.875rem;
  color: var(--muted);
}

/* ---------- stats ---------- */

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { border-left: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); padding-left: 16px; }
.stat b { display: block; font-size: 2rem; letter-spacing: -0.03em; font-weight: 700; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 0.9rem; }

/* ---------- tables ---------- */

.tablewrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 0.93rem; min-width: 560px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.76rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); font-weight: 600; background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
td code { font-size: 0.86em; color: var(--accent); }

/* ---------- code block ---------- */

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.6;
  margin: 0 0 1em;
}
pre code { color: var(--text); }
p code, li code, td code, dd code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 0.86em;
}

/* ---------- download cards ---------- */

.dl { display: grid; gap: 18px; grid-template-columns: repeat(3, 1fr); align-items: start; }
@media (max-width: 900px) { .dl { grid-template-columns: 1fr; } }
.dl .card { display: flex; flex-direction: column; }
.dl .plat { display: flex; align-items: center; gap: 11px; margin-bottom: 6px; }
.dl .plat svg { width: 22px; height: 22px; color: var(--text); }
.dl .plat h3 { margin: 0; }
.dl .req { color: var(--faint); font-size: 0.86rem; margin-bottom: 18px; }
.dl .files { display: grid; gap: 8px; }
.dl .files a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface-2);
}
.dl .files a:hover { border-color: var(--accent); text-decoration: none; }
.dl .files a em { font-style: normal; color: var(--faint); font-family: var(--mono); font-size: 0.78rem; }

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

details {
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
}
details summary {
  cursor: pointer;
  font-weight: 620;
  font-size: 1.02rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; color: var(--accent); font-family: var(--mono); font-size: 1.2rem; }
details[open] summary::after { content: "\2212"; }
details p:first-of-type { margin-top: 12px; }
details p { color: var(--muted); margin-bottom: 0; }
details p + p { margin-top: 0.8em; }

/* ---------- callout ---------- */

.note {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  font-size: 0.95rem;
  color: var(--muted);
}
.note strong { color: var(--text); }

/* ---------- prose (docs / legal) ---------- */

.prose h2 { margin-top: 2.2em; scroll-margin-top: 82px; }
.prose h3 { margin-top: 1.8em; scroll-margin-top: 82px; }
.prose ul, .prose ol { color: var(--muted); padding-left: 1.25em; }
.prose li { margin-bottom: 0.5em; }
.prose p { color: var(--muted); }
.prose strong { color: var(--text); }
.prose > p:first-child { font-size: 1.08rem; }

.toc {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 44px;
}
.toc h2 { margin: 0 0 12px; font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.toc ol { margin: 0; padding-left: 1.1em; columns: 2; column-gap: 32px; }
@media (max-width: 620px) { .toc ol { columns: 1; } }
.toc li { margin-bottom: 5px; color: var(--muted); }

/* ---------- release list ---------- */

.release { border-top: 1px solid var(--border); padding: 34px 0; }
.release:first-of-type { border-top: none; padding-top: 0; }
.release-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.release-head h2 { margin: 0; font-size: 1.5rem; }
.release-head time { font-family: var(--mono); font-size: 0.82rem; color: var(--faint); }
.tag {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.tag.added { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); background: var(--green-soft); }
.tag.changed { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); }
.tag.fixed { color: var(--muted); }
.release h3 { font-size: 0.8rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--faint); margin: 22px 0 10px; }
.release ul { color: var(--muted); padding-left: 1.2em; margin: 0; }
.release li { margin-bottom: 9px; }

/* ---------- footer ---------- */

footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 54px 0 40px;
  font-size: 0.92rem;
}
.foot-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
@media (max-width: 780px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
footer h2 { font-size: 0.76rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); margin-bottom: 12px; font-weight: 600; }
footer ul { list-style: none; margin: 0; padding: 0; }
footer li { margin-bottom: 8px; }
footer li a { color: var(--muted); }
footer li a:hover { color: var(--text); }
.foot-about p { color: var(--muted); max-width: 34ch; font-size: 0.9rem; }
.foot-bottom {
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  justify-content: space-between;
  color: var(--faint);
  font-size: 0.85rem;
}

/* ---------- page header (subpages) ---------- */

.page-head {
  padding: 62px 0 44px;
  border-bottom: 1px solid var(--border);
  background: radial-gradient(760px 300px at 20% -30%, var(--accent-soft), transparent 70%);
}
.page-head h1 { font-size: clamp(2rem, 4vw, 2.9rem); margin-bottom: 12px; }
.page-head p { color: var(--muted); font-size: 1.06rem; max-width: 64ch; margin: 0; }

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 12px; top: 12px;
  z-index: 60;
  background: var(--accent);
  color: #16181d;
  padding: 10px 16px;
  border-radius: 8px;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
