/* Тёплая палитра: тёмная по умолчанию, светлая — по системной настройке.
   --accent (#C8323C) — для крупного и нетекстового (3.4:1 на --bg);
   для ссылок и мелких цифр — --accent-text (AA 4.5:1+). */
:root {
  --bg: #1A1511;
  --bg-elevated: #241C16;
  --text: #F1E6D6;
  --text-muted: #BFAF9A;
  --accent: #C8323C;
  --accent-text: #E05A62;
  --accent-2: #C8642F;
  --accent-2-text: #D96A3A;
  --earth: #D9A441;
  --plant: #5C6436;
  --pred: #EA3F4A;
  --border: rgba(241, 230, 214, 0.12);
  --btn-bg: #A8262F;
  --btn-text: #F1E6D6;
  --btn-hover-bg: #C8642F;
  --btn-hover-text: #1A1511;
  --display: "Unbounded", system-ui, sans-serif;
  --body: "Onest", system-ui, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #F4EDE3; --bg-elevated: #FBF7F1; --text: #2A1E17; --text-muted: #6A5848;
    --accent: #B3262F; --accent-text: #B3262F; --accent-2: #A4501F; --accent-2-text: #A4501F;
    --earth: #9A6B12; --plant: #7C8550; --pred: #C21F2A; --border: rgba(42, 30, 23, 0.14);
    --btn-bg: #B3262F; --btn-text: #FFFFFF; --btn-hover-bg: #A4501F; --btn-hover-text: #FFFFFF;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #F4EDE3; --bg-elevated: #FBF7F1; --text: #2A1E17; --text-muted: #6A5848;
  --accent: #B3262F; --accent-text: #B3262F; --accent-2: #A4501F; --accent-2-text: #A4501F;
  --earth: #9A6B12; --plant: #7C8550; --pred: #C21F2A; --border: rgba(42, 30, 23, 0.14);
  --btn-bg: #B3262F; --btn-text: #FFFFFF; --btn-hover-bg: #A4501F; --btn-hover-text: #FFFFFF;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 18px/1.6 var(--body);
}
a { color: var(--accent-text); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-2-text); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--earth); outline-offset: 3px; border-radius: 2px; }
img, video { max-width: 100%; height: auto; display: block; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 40px; } }
.prose { max-width: 680px; }

/* top bar */
.bar { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 20px 0; flex-wrap: wrap; }
.bar .name { font: 600 15px/1 var(--display); color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.bar nav { display: flex; gap: 20px; flex-wrap: wrap; font-size: 15px; }
.bar nav a { color: var(--text-muted); text-decoration: none; }
.bar nav a:hover { color: var(--accent-2-text); }
.bar nav a[aria-current] { color: var(--text); }

/* hero: the live world */
.hero { position: relative; border-radius: 6px; overflow: hidden; background: var(--bg-elevated); min-height: 440px; display: grid; align-items: end; }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero .card {
  position: relative; margin: 16px; padding: 24px; max-width: 620px;
  background: color-mix(in srgb, var(--bg-elevated) 90%, transparent);
  backdrop-filter: blur(6px); border-radius: 4px;
}
@media (min-width: 720px) { .hero { min-height: 560px; } .hero .card { margin: 40px; padding: 32px 36px; } }
h1 { overflow-wrap: break-word; text-wrap: balance; font: 700 clamp(27px, 5.6vw, 64px)/1.06 var(--display); letter-spacing: -.035em; margin: 0 0 16px; }
.hero p { margin: 0; font-size: 19px; max-width: 34em; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 18px; font-size: 14px; color: var(--text-muted); }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 6px; background: currentColor; vertical-align: 1px; }
.legend .p::before { background: var(--plant); opacity: .8; }
.legend .h::before { background: var(--earth); }
.legend .r::before { background: var(--pred); }
@media (max-width: 480px) {
  /* три типа — в одну строку, ссылка уходит на свою */
  .legend { gap: 6px 12px; font-size: 13px; }
  .legend a { flex-basis: 100%; }
}

/* sections */
section { padding: 72px 0 8px; }
h2 { text-wrap: balance; font: 600 clamp(21px, 3.4vw, 34px)/1.18 var(--display); letter-spacing: -.025em; margin: 0 0 20px; }
h3 { font: 600 19px/1.3 var(--display); letter-spacing: -.015em; margin: 32px 0 8px; }
p { margin: 0 0 16px; }
.lead { font-size: 21px; line-height: 1.5; }
.muted { color: var(--text-muted); }

/* Side pipeline — a real sequence, so it is numbered */
.pipe { list-style: none; padding: 0; margin: 28px 0; display: grid; gap: 0; counter-reset: s; }
.pipe li { counter-increment: s; display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.pipe li::before { content: counter(s); font: 600 15px/1.6 var(--display); color: var(--accent-text); }
.pipe b { font-weight: 600; }

.facts { display: grid; gap: 24px; margin: 32px 0 0; }
@media (min-width: 720px) { .facts { grid-template-columns: repeat(3, 1fr); } }
.facts div { border-left: 3px solid var(--accent); padding-left: 14px; }
.facts strong { display: block; font: 600 22px/1.2 var(--display); letter-spacing: -.02em; margin-bottom: 4px; }
.facts span { font-size: 15px; color: var(--text-muted); }

/* products */
.products { display: grid; gap: 32px; margin-top: 8px; }
@media (min-width: 720px) { .products { grid-template-columns: 1fr 1fr; } }
.products article { padding-top: 16px; border-top: 2px solid var(--accent-2); }
.products h3 { margin-top: 0; }

/* timeline — chronological */
.path { list-style: none; padding: 0; margin: 0; }
.path li { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 16px 0; border-top: 1px solid var(--border); }
@media (min-width: 720px) { .path li { grid-template-columns: 170px 1fr; gap: 24px; } }
.path time { font-size: 15px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.path b { font-weight: 600; }
.path p { margin: 4px 0 0; font-size: 16px; color: var(--text-muted); }

/* lab teaser */
.lab { display: grid; gap: 28px; align-items: center; }
@media (min-width: 820px) { .lab { grid-template-columns: 1fr 360px; } }
.lab video { border-radius: 4px; width: 100%; image-rendering: pixelated; background: var(--bg-elevated); }

.btn {
  display: inline-block; padding: 13px 22px; border-radius: 999px;
  background: var(--btn-bg); color: var(--btn-text); text-decoration: none; font-weight: 500;
}
.btn:hover { background: var(--btn-hover-bg); color: var(--btn-hover-text); }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--text-muted); }
.btn.ghost:hover { background: var(--btn-hover-bg); color: var(--btn-hover-text); box-shadow: none; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

footer { margin-top: 96px; padding: 28px 0 40px; border-top: 1px solid var(--border); font-size: 14px; color: var(--text-muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* article page */
.article h1 { font-size: clamp(25px, 5vw, 52px); margin-top: 24px; }
.article figure { margin: 32px 0; }
.article figure img, .article figure video { border-radius: 4px; background: #fff; }
.article figcaption { font-size: 15px; color: var(--text-muted); margin-top: 8px; }
.article table { border-collapse: collapse; width: 100%; font-size: 15px; margin: 8px 0 24px; font-variant-numeric: tabular-nums; }
.article th, .article td { text-align: right; padding: 7px 8px; border-bottom: 1px solid var(--border); }
.article th:first-child, .article td:first-child { text-align: left; }
.article thead th { color: var(--text-muted); font-weight: 500; }
.tablewrap { overflow-x: auto; }
.article ul, .article ol { padding-left: 22px; margin: 0 0 16px; }
.article li { margin-bottom: 6px; }
.note { background: var(--bg-elevated); border-left: 3px solid var(--accent); padding: 14px 18px; border-radius: 0 4px 4px 0; margin: 24px 0; }
.wide { max-width: 960px; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
