/* theme.css: the shared look of the komira open-source sites (mopm.dev, kbf.dev, ucdk.dev).
   THIS FILE IS CANONICAL AND COPIED BYTE FOR BYTE: a site never edits its copy, it adds its own rules in its own
   stylesheet loaded after this one. Changing it changes THEME.md's recorded sha256 in the same commit (kbf's
   `cargo xtask site check` refuses a mismatch), and the other sites then take the new file.
   Tokens and type follow mopm.dev's site.css: warm neutrals, an orange accent, system fonts, light and dark by
   prefers-color-scheme. The mark is the prompt: `> name` (a `.brand` holding a `.gt`).
   No external resources, no inline style is needed: the policy is style-src 'self'; script-src 'self'. */

:root {
  color-scheme: light dark;
  --bg: #fbfaf7;
  /* The header, footer and package head: a tint of the page. */
  --bg-soft: #f4f1ea;
  --surface: #ffffff;
  --surface-2: #f6f4ef;
  --bg-code: #f5f2ec;
  --fg: #16141a;
  --fg-2: #3a3641;
  --fg-muted: #5d5867;
  --border: #e7e2d9;
  --border-strong: #d3ccc0;
  /* Form control borders: at least 3:1 against --bg and --bg-soft (WCAG 1.4.11). */
  --control-border: #8a8378;
  --accent: #c2410c;
  --accent-strong: #9a3412;
  --accent-soft: #fff1e6;
  --accent-fg: #ffffff;
  --btn-top: #c2410c;
  --btn-bottom: #a3360a;
  --magenta: #be185d;
  --link: #1d4ed8;
  --focus: #2563eb;
  --ok: #15803d;
  --ok-soft: #e9f7ee;
  --warn-bg: #fff6e0;
  --warn-border: #e8b64c;
  --error-bg: #fdeeee;
  --error-border: #e5534b;
  --glow-a: rgb(234 88 12 / 16%);
  --glow-b: rgb(190 24 93 / 10%);
  --grid-line: rgb(22 20 26 / 5%);
  --shadow: 0 1px 2px rgb(40 30 20 / 5%), 0 8px 24px -12px rgb(40 30 20 / 18%);
  --shadow-lg: 0 2px 4px rgb(40 30 20 / 4%), 0 24px 48px -20px rgb(120 50 10 / 28%);
  --radius: 12px;
  --radius-sm: 8px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace;
  --wrap: 76rem;
  /* The sticky header's height: two rows (brand and nav, then the search) below 48rem, one row from 48rem. The two-row
     value holds from a 320px viewport up (the max-width: 25rem rule below keeps brand and nav on one row there); under
     320px the nav wraps to a third row. Anchor targets and sticky columns offset by it, so a heading reached by a #link
     is not hidden under the header. */
  --header-h: 106px;
}
@media (min-width: 48rem) { :root { --header-h: 65px; } }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0b0f;
    --bg-soft: #121017;
    --surface: #15131a;
    --surface-2: #1b1921;
    --bg-code: #111015;
    --fg: #eeecf2;
    --fg-2: #d3d0da;
    --fg-muted: #a49fb0;
    --border: #2a2731;
    --border-strong: #3a3643;
    --control-border: #6f697b;
    --accent: #fb923c;
    --accent-strong: #fdba74;
    --accent-soft: #2a1a10;
    --accent-fg: #1a0f08;
    --btn-top: #fdba74;
    --btn-bottom: #fb923c;
    --magenta: #f472b6;
    --link: #8ab4ff;
    --focus: #8ab4ff;
    --ok: #4ade80;
    --ok-soft: #10251a;
    --warn-bg: #2a2010;
    --warn-border: #8a6a1c;
    --error-bg: #2c1214;
    --error-border: #c4453f;
    --glow-a: rgb(251 146 60 / 14%);
    --glow-b: rgb(244 114 182 / 9%);
    --grid-line: rgb(255 255 255 / 4%);
    --shadow: 0 0 0 1px rgb(255 255 255 / 2%), 0 12px 28px -14px rgb(0 0 0 / 70%);
    --shadow-lg: 0 0 0 1px rgb(255 255 255 / 3%), 0 30px 60px -24px rgb(0 0 0 / 80%);
  }
}

/* ---- base ---- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column; overflow-x: clip;
  background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 1rem; line-height: 1.6;
  overflow-wrap: break-word; -webkit-font-smoothing: antialiased;
}
main { flex: 1 0 auto; width: 100%; }
main.wrap { padding-top: 2rem; padding-bottom: 4rem; }
main:focus { outline: none; }
[id] { scroll-margin-top: calc(var(--header-h) + 16px); }
.wrap { max-width: var(--wrap); margin: 0 auto; padding-left: 16px; padding-right: 16px; }
@media (min-width: 48rem) { .wrap { padding-left: 32px; padding-right: 32px; } }

h1, h2, h3, h4, h5, h6 { line-height: 1.2; letter-spacing: -0.02em; margin: 1.75em 0 0.6em; font-weight: 700; }
h1 { font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.4rem); font-weight: 750; margin-top: 0; overflow-wrap: anywhere; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; font-weight: 650; }
h4, h5, h6 { font-size: 1rem; }
p, ul, ol, dl, pre, blockquote, table { margin: 0 0 1rem; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

code, kbd, pre { font-family: var(--mono); font-size: 0.9em; }
code { background: var(--bg-code); border: 1px solid var(--border); border-radius: 6px; padding: 0.08em 0.36em; font-size: 0.86em; }
pre {
  background: var(--bg-code); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px; overflow-x: auto; line-height: 1.65; max-width: 100%;
}
pre code { background: none; border: 0; padding: 0; font-size: 0.875rem; white-space: pre; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 0.05em 0.42em; border: 1px solid var(--border-strong);
  border-bottom-width: 2px; border-radius: 6px; background: var(--surface); color: var(--fg-2);
  font-size: 0.78em; line-height: 1.5; text-align: center;
}
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }
blockquote { margin-left: 0; padding: 0.1rem 1rem; border-left: 4px solid var(--border-strong); color: var(--fg-muted); }

.muted { color: var(--fg-muted); }
.small { font-size: 0.875rem; }
.lede { font-size: 1.1875rem; color: var(--fg-2); max-width: 40rem; line-height: 1.55; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* Focus: always visible for keyboard users. */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip {
  position: absolute; left: 16px; top: -100px; z-index: 10; padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--fg); color: var(--bg); font-weight: 600; text-decoration: none;
}
.skip:focus { top: 8px; }


/* ---- header and the mark ---- */

.site-header {
  position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-soft) 85%, transparent); backdrop-filter: saturate(160%) blur(12px);
}
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; min-height: 64px; padding-top: 10px; padding-bottom: 10px; }
/* The mark: a prompt then the name, in the mono face; the `>` is the accent. */
.brand { display: inline-flex; align-items: baseline; gap: 0.3em; color: var(--fg); text-decoration: none; font-family: var(--mono); font-size: 1.4rem; font-weight: 800; letter-spacing: -0.05em; line-height: 1; }
.brand .gt { color: var(--accent); font-weight: 800; }
.brand:hover .gt { color: var(--accent-strong); }
.site-nav { margin-left: auto; }
.site-nav ul { display: flex; flex-wrap: wrap; gap: 2px 4px; list-style: none; margin: 0; padding: 0; }
.site-nav a { display: block; color: var(--fg-2); text-decoration: none; font-weight: 550; font-size: 0.9375rem; padding: 6px 10px; border-radius: 8px; }
.site-nav a:hover { background: var(--surface-2); color: var(--fg); }
.site-nav a[aria-current] { color: var(--fg); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--accent); }
@media (max-width: 25rem) {
  .bar { column-gap: 8px; }
  .brand { font-size: 1.25rem; }
  .site-nav a { padding: 6px 7px; font-size: 0.875rem; }
}

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

.button {
  flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px; border: 1px solid var(--control-border); border-radius: 10px; background: var(--surface);
  font: inherit; font-weight: 650; line-height: 1.4; cursor: pointer; white-space: nowrap; color: var(--fg); text-decoration: none;
}
.button:hover { border-color: var(--fg-muted); }
.button-primary {
  border-color: transparent; color: var(--accent-fg); background: linear-gradient(180deg, var(--btn-top), var(--btn-bottom));
  box-shadow: 0 1px 0 rgb(255 255 255 / 25%) inset;
}
.button-primary:hover { filter: brightness(1.08); border-color: transparent; }
a.button-primary { color: var(--accent-fg); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; }

/* ---- command blocks and copy buttons ---- */

.cmd {
  display: flex; align-items: center; gap: 10px; background: var(--bg-code); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 8px 6px 14px; min-width: 0;
}
.cmd pre { flex: 1; min-width: 0; margin: 0; padding: 6px 0; border: 0; background: none; border-radius: 0; scrollbar-width: thin; }
.cmd-lg { padding: 8px 8px 8px 16px; }
.cmd-lg code { font-size: 1rem; }
.prompt { color: var(--accent); font-family: var(--mono); user-select: none; }
.copy {
  flex: none; align-self: flex-start; font-size: 0.8125rem; font-weight: 600; padding: 6px 12px; border-radius: 7px; cursor: pointer;
  min-width: 5rem; text-align: center; /* wide enough for "Copied", so the label change never reflows the command */
  background: var(--surface); color: var(--fg-2); border: 1px solid var(--control-border);
}
.copy:hover { border-color: var(--fg-muted); color: var(--fg); }
.copy.done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, var(--border)); }
.cmd-lg .copy, .cmd .copy:only-of-type { align-self: center; }


/* ---- tags: works today, specified ---- */

.tag {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  padding: 4px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--fg-2);
  font-size: 0.75rem; font-weight: 650; line-height: 1; white-space: nowrap; vertical-align: middle;
}
.tag-muted { color: var(--fg-muted); }
.tag-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.tag-ok::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag-planned { background: transparent; color: var(--fg-muted); border-style: dashed; border-color: var(--border-strong); }


/* ---- notices ---- */

.notice { padding: 1rem 1.25rem; border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--radius); background: var(--surface); margin-bottom: 1.5rem; }
.notice > :last-child { margin-bottom: 0; }
.notice-warn { background: var(--warn-bg); border-color: var(--warn-border); }

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

.scroll { overflow-x: auto; max-width: 100%; margin-bottom: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.scroll table { margin: 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.925rem; }
caption { text-align: left; padding: 0.6rem 0.75rem; font-weight: 600; color: var(--fg-muted); font-size: 0.85rem; }
th, td { text-align: left; vertical-align: top; padding: 0.5rem 0.75rem; border-top: 1px solid var(--border); }
thead th { background: var(--surface-2); font-weight: 600; white-space: nowrap; }
tbody th { font-weight: 500; }
td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.align-center { text-align: center; }
.align-right { text-align: right; }
tr.state-yanked th, tr.state-yanked td, tr.state-tombstoned th, tr.state-tombstoned td { color: var(--fg-muted); }

/* ---- prose: readmes and docs ---- */

.prose { max-width: 48rem; }
.prose h1:first-child, .prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.5rem; }
.prose li + li { margin-top: 0.25rem; }

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

.site-footer { border-top: 1px solid var(--border); background: var(--bg-soft); color: var(--fg-muted); font-size: 0.875rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-top: 24px; padding-bottom: 24px; }
.site-footer p { margin: 0; }
.site-footer ul { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; margin: 0; padding: 0; }
.site-footer a { color: var(--fg-2); }


/* ---- home and section components (from mopm.dev's home.css) ---- */

.cmd-xl { background: var(--surface); border-color: var(--border-strong); box-shadow: var(--shadow-lg); border-radius: 12px; padding: 8px 8px 8px 16px; }
.cmd-xl code { font-weight: 600; }

.hero {
  position: relative; overflow: hidden; border-bottom: 1px solid var(--border);
  background: radial-gradient(60rem 26rem at 78% -10%, var(--glow-a), transparent 70%), radial-gradient(40rem 24rem at 8% 10%, var(--glow-b), transparent 70%), var(--bg);
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; background-size: 44px 44px;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  mask-image: radial-gradient(ellipse 70% 80% at 50% 0%, #000 30%, transparent 75%);
}
.hero-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 48px; align-items: center; padding-top: 64px; padding-bottom: 72px; }
@media (min-width: 64rem) { .hero-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); } }
.eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 22px; font-size: 0.875rem; font-weight: 600; }
.eyebrow a { text-decoration: none; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700;
  color: var(--accent-strong); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.display { font-size: clamp(2.6rem, 7vw, 4.6rem); font-weight: 820; letter-spacing: -0.05em; line-height: 1; margin: 0 0 22px; }
.display em { font-style: normal; background: linear-gradient(95deg, var(--accent) 10%, var(--magenta) 90%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lede { margin-bottom: 28px; }
.hero-search { max-width: 38rem; }
.hero-search > p { margin: 12px 0 0; }
.install-hero { margin-top: 36px; max-width: 40rem; }
.install-label { margin: 0 0 10px; font-size: 0.9375rem; }
.note { margin: 10px 0 0; font-size: 0.8125rem; color: var(--fg-muted); }

.term {
  border-radius: 16px; overflow: hidden; background: #0f0e13; color: #e9e7ee; border: 1px solid rgb(255 255 255 / 8%);
  box-shadow: var(--shadow-lg); transform: rotate(-1deg);
}
.term-bar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #17151d; border-bottom: 1px solid rgb(255 255 255 / 7%); font-family: var(--mono); font-size: 0.75rem; color: #b3aec0; }
.dots { width: 11px; height: 11px; border-radius: 50%; background: #f87171; box-shadow: 18px 0 #fbbf24, 36px 0 #4ade80; margin-right: 40px; }
.term pre { margin: 0; padding: 20px 22px 26px; background: none; border: 0; border-radius: 0; line-height: 1.9; color: inherit; }
.term .p { color: #fb923c; }

.band { padding: 64px 0; }
.band + .band { border-top: 1px solid var(--border); }
.band h2 { font-size: 1.75rem; letter-spacing: -0.03em; margin: 0 0 28px; }
.kicker { margin: 0 0 8px; font-size: 0.75rem; font-weight: 750; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent-strong); }

.stepper { list-style: none; margin: 0; padding: 0; display: grid; gap: 28px; position: relative; }
.stepper li { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.stepper .num {
  position: relative; z-index: 1; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  font-weight: 800; color: #ffffff; background: linear-gradient(140deg, #f97316, #db2777); box-shadow: 0 0 0 6px var(--bg);
}
.stepper h3 { margin: 0; }
.stepper p { margin: 0; color: var(--fg-2); font-size: 0.9375rem; }
.stepper .cmd { margin-top: auto; }
@media (min-width: 56rem) {
  .stepper { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
  .stepper::before { content: ""; position: absolute; top: 17px; left: 18px; right: 18px; height: 2px; background: linear-gradient(90deg, #f97316, #db2777 60%, var(--border)); }
}

.strip {
  color: #f6f3fb; border-top: 0 !important;
  background: radial-gradient(50rem 20rem at 85% 0%, rgb(219 39 119 / 35%), transparent 70%), radial-gradient(40rem 22rem at 5% 100%, rgb(249 115 22 / 30%), transparent 70%), #17131f;
}
.strip .kicker { color: #fdba74; }
.strip h2 { color: #ffffff; }
.strip a { color: #c7d7ff; }
.strip p { color: #ddd7e8; }
.strip code { background: rgb(255 255 255 / 8%); border-color: rgb(255 255 255 / 14%); color: #ffffff; }
.strip-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 48px; }
@media (min-width: 64rem) { .strip-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } }
.recent li {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 14px; align-items: center; padding: 14px 16px;
  border-radius: 14px; background: rgb(255 255 255 / 6%); border: 1px solid rgb(255 255 255 / 12%);
}

.status { padding: 14px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.band-planned { background: var(--bg-soft); }
.goals { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.goals li { padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px dashed var(--border-strong); }
.goals h3 { margin: 0 0 8px; }
.goals p { margin: 0; color: var(--fg-2); }

@media (max-width: 40rem) {
  .cmd-xl code { font-size: 0.8125rem; white-space: pre-wrap; overflow-wrap: anywhere; }
  .hero-grid { padding-top: 40px; padding-bottom: 48px; gap: 32px; }
  .term { transform: none; }
  .band { padding: 48px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .term { transform: none; }
}

@media (forced-colors: active) {
  .stepper .num { forced-color-adjust: none; }
  .display em { color: CanvasText; background: none; }
}

/* ---- motion and forced colours ---- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

@media (forced-colors: active) {
  .button-primary, .stepper .num { forced-color-adjust: none; }
  :focus-visible { outline-color: Highlight; }
}

/* ---- scripts off ---- */

.no-js { display: none; }
@media (scripting: none) {
  .no-js { display: block; }
  .js-only { display: none; }
}
