/* Layout: workbench — kinetic name and a live terminal up top, then ruled spec-sheet sections */
:root {
  --paper: #edf0f7;
  --surface: #ffffff;
  --surface-2: #f5f7fc;
  --ink: #0d1330;
  --ink-soft: #4b5375;
  --ink-faint: #7f87a6;
  --line: #d5dbe8;
  --cobalt: #2e44f5;
  --cobalt-ink: #ffffff;
  --cobalt-soft: rgba(46, 68, 245, 0.1);
  --marker: rgba(255, 207, 51, 0.85);
  --good: #12805c;
  --bad: #d0342c;
  --warn: #9a6512;
  --term-bg: #0d1330;
  --term-line: #1f2752;
  --term-fg: #d8deff;
  --term-dim: #8a93c4;
  --term-accent: #ffcf33;
  --term-ok: #6ee7b7;
  --shadow: 0 1px 2px rgba(13, 19, 48, 0.06), 0 10px 30px -14px rgba(13, 19, 48, 0.22);
  --overlay: rgba(13, 19, 48, 0.55);

  --font-display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --font-body: "Onest", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  --radius: 14px;
  --radius-sm: 8px;
  --max: 1200px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #090d1e;
    --surface: #10163a;
    --surface-2: #0c1230;
    --ink: #e7ebfb;
    --ink-soft: #a5adce;
    --ink-faint: #6f78a0;
    --line: #232b55;
    --cobalt: #7c8cff;
    --cobalt-ink: #090d1e;
    --cobalt-soft: rgba(124, 140, 255, 0.15);
    --marker: rgba(255, 207, 51, 0.3);
    --good: #4ade9f;
    --bad: #ff7a70;
    --warn: #f5b94a;
    --term-bg: #050816;
    --term-line: #1a2148;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 14px 34px -16px rgba(0, 0, 0, 0.75);
    --overlay: rgba(3, 5, 14, 0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #090d1e;
  --surface: #10163a;
  --surface-2: #0c1230;
  --ink: #e7ebfb;
  --ink-soft: #a5adce;
  --ink-faint: #6f78a0;
  --line: #232b55;
  --cobalt: #7c8cff;
  --cobalt-ink: #090d1e;
  --cobalt-soft: rgba(124, 140, 255, 0.15);
  --marker: rgba(255, 207, 51, 0.3);
  --good: #4ade9f;
  --bad: #ff7a70;
  --warn: #f5b94a;
  --term-bg: #050816;
  --term-line: #1a2148;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 14px 34px -16px rgba(0, 0, 0, 0.75);
  --overlay: rgba(3, 5, 14, 0.7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { text-wrap: balance; margin: 0; line-height: 1.15; }
p { margin: 0; }
::selection { background: var(--marker); color: var(--ink); }
:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; border-radius: 4px; }

.wrap {
  width: 100%;
  max-width: calc(var(--max) + 64px);
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
@media (min-width: 720px) {
  .wrap {
    padding-left: max(32px, env(safe-area-inset-left, 0px));
    padding-right: max(32px, env(safe-area-inset-right, 0px));
  }
}

.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;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cobalt);
}
.mark {
  background: linear-gradient(transparent 58%, var(--marker) 58%, var(--marker) 92%, transparent 92%);
  padding-inline: 2px;
}

/* Buttons */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-bd: var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: var(--ink-soft); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn--primary { --btn-bg: var(--cobalt); --btn-fg: var(--cobalt-ink); --btn-bd: var(--cobalt); }
.btn--primary:hover { --btn-bd: var(--cobalt); box-shadow: 0 8px 24px -10px var(--cobalt); }
.btn--ghost { --btn-bg: transparent; }
.btn--ink { --btn-bg: var(--ink); --btn-fg: var(--paper); --btn-bd: var(--ink); }
.btn--sm { min-height: 38px; padding: 8px 14px; font-size: 14px; }
.btn--icon { width: 44px; padding: 0; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.chip:hover { color: var(--ink); border-color: var(--ink-soft); }
.chip[aria-pressed="true"], .chip[aria-selected="true"], .chip.is-active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.chip small { font-family: var(--font-mono); font-size: 11px; opacity: 0.7; }

.field { display: grid; gap: 6px; min-width: 0; }
.field > span, .label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input::placeholder { color: var(--ink-faint); }
.input:focus { outline: none; border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--cobalt-soft); }
textarea.input { min-height: 110px; resize: vertical; }

/* Theme toggle icon */
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}

/* Language switch: RU | EN, the active one is filled */
.lang-toggle { gap: 2px; padding: 4px; font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.lang-toggle span { padding: 6px 8px; border-radius: 999px; color: var(--ink-faint); transition: background-color 0.2s ease, color 0.2s ease; }
:root[lang="ru"] .lang-toggle [data-l="ru"],
:root[lang="en"] .lang-toggle [data-l="en"] { background: var(--ink); color: var(--paper); }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  transform: translate(-50%, 0);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}
.toast.is-hidden { opacity: 0; transform: translate(-50%, 12px); }

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

/* Project pages: shared chrome */
.pbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.pbar__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding-block: 10px;
}
.pbar__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  color: var(--ink-soft);
  min-height: 40px;
}
.pbar__back:hover { color: var(--cobalt); }
.pbar__title {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  overflow: hidden;
}
.pbar__title h1 {
  font-family: var(--font-display);
  font-size: clamp(16px, 2.4vw, 20px);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pbar__title .eyebrow { white-space: nowrap; }
.pbar__actions { display: flex; align-items: center; gap: 8px; }
@media (max-width: 640px) {
  .pbar__title .eyebrow, .pbar__src-label { display: none; }
  .pbar__back span { display: none; }
}
.pmain { padding-block: 32px 64px; }
.pfoot { border-top: 1px solid var(--line); padding-block: 28px 40px; }
.pfoot__inner { display: grid; gap: 14px; }
.pfoot__list { display: flex; flex-wrap: wrap; gap: 8px; }
.pfoot__list a { text-decoration: none; }
.pfoot__note { font-size: 13px; color: var(--ink-faint); }
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 30;
  background: var(--paper);
}
