/* Direction A «Нить Мойр»: warm graphite, bone text, one vermilion thread. */
:root {
  --vh1: 1svh;
  --bg: #16140f;
  --bg-raise: #1c1a14;
  --ink: #eee7da;
  --muted: #b5ab99;
  --faint: #a1978a;
  --line: rgb(238 231 218 / 13%);
  --line-strong: rgb(238 231 218 / 26%);
  --verm: #d8432b;
  --verm-text: #f0705a;
  --ochre: #e0a33a;
  --on-verm: #fff;
  --bg-code: #100e0a;
  --bg-tip: rgb(12 10 10 / 86%);
  --wall: #18140f;
  /* The thread's cross-section: lit edge, vermilion body, shadow (across a horizontal and a vertical bar). */
  --thread-grad: linear-gradient(180deg, #ff9a7a, #d8432b 55%, #7d2517);
  --thread-grad-x: linear-gradient(90deg, #7d2517, #e2583f 45%, #ff9a7a 55%, #b8341f);
  --serif: "Cormorant Garamond", "Literata", Georgia, serif;
  --sans: "Onest", system-ui, sans-serif;
  --mono: "Martian Mono", ui-monospace, monospace;
  --gutter: 56px;
  --pad: calc(var(--gutter) + 56px);
  --max: 1320px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  /* Radii: hairline marks (2 px), frames of cards and code (4 px), the thread-like bars (3 px), the switcher
     (12 px), a message bubble, and pills (buttons). */
  --r-mark: 2px;
  --r-line: 3px;
  --r-frame: 4px;
  --r-panel: 12px;
  --r-bubble: 18px 18px 18px 4px;
  --r-pill: 999px;
  color-scheme: dark;
}
@media (max-width: 720px) {
  :root { --gutter: 18px; --pad: calc(var(--gutter) + 22px); }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); color: var(--ink); -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
body { margin: 0; font: 400 17px/1.6 var(--sans); overflow-x: clip; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h2 { font: 600 clamp(2.3rem, 4.6vw, 4.3rem)/1 var(--serif); letter-spacing: -0.005em; text-wrap: balance; max-width: 18ch; }
h3 { font: 600 1.12rem/1.3 var(--sans); }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 0.8em; letter-spacing: 0.01em; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; z-index: 50; top: 12px; left: 12px; padding: 8px 12px; background: var(--ink); color: var(--bg); }
::selection { background: var(--verm); color: var(--on-verm); }

/* The thread is drawn above the page (it passes over frames), never over the fixed bar. */
#gl { position: absolute; top: 0; left: 0; width: 100%; height: 100vh; z-index: 3; pointer-events: none; overflow-anchor: none; }
main, .foot { position: relative; z-index: 2; }

/* Top bar */
.bar { position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; padding: 18px var(--gutter); pointer-events: none; }
.bar > * { pointer-events: auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 600 1.35rem/1 var(--serif); text-decoration: none; letter-spacing: 0.02em; }
.brand-mark { width: 22px; height: 2px; background: var(--verm); box-shadow: 0 0 0 1px rgb(216 67 43 / 30%); border-radius: var(--r-mark); }
.bar-nav { display: flex; gap: 26px; align-items: center; font: 500 0.8rem/1 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; }
.bar-nav a { text-decoration: none; color: var(--muted); }
.bar-nav a:hover { color: var(--ink); }
.bar-nav .bar-cta { color: var(--ink); border-bottom: 1px solid var(--verm); padding-bottom: 3px; }
.bar.scrolled { background: var(--bg); box-shadow: 0 1px 0 var(--line); }
@media (max-width: 720px) { .bar-nav a:not(.bar-cta):not(.bar-lang) { display: none; } }

/* Screen switcher at the right edge: one dot per screen, the section's name on hover. Only with paging. */
.rail { display: none; position: fixed; right: 6px; top: 50%; transform: translateY(-50%); z-index: 21; }
.tw-virt .rail { display: block; }
.rail ol { list-style: none; margin: 0; padding: 6px 0; display: grid; gap: 0; border-radius: var(--r-panel); background: color-mix(in srgb, var(--bg) 82%, transparent); box-shadow: 0 0 0 1px var(--line); backdrop-filter: blur(6px); }
.rail li { position: relative; }
.rail button { display: block; width: 22px; height: clamp(12px, calc(60vh / var(--screens, 20)), 22px); padding: 0; border: 0; background: none; cursor: pointer; position: relative; }
.rail button::before { content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; border: 1px solid var(--line-strong); transition: background 0.3s var(--tw-c-ui), border-color 0.3s var(--tw-c-ui), transform 0.3s var(--tw-c-ui); }
.rail li.on button::before { background: var(--verm); border-color: var(--verm); }
.rail li.now button::before { transform: scale(1.7); }
.rail button:focus-visible { outline: 1px solid var(--verm); outline-offset: 1px; border-radius: var(--r-frame); }
.rail button::after { content: attr(data-label); position: absolute; right: 28px; top: 50%; transform: translate(6px, -50%); white-space: nowrap; font: 500 0.72rem/1 var(--mono); color: var(--ink); background: var(--bg-tip); padding: 6px 8px; border-radius: var(--r-frame); opacity: 0; pointer-events: none; transition: opacity 0.2s var(--tw-c-ui), transform 0.2s var(--tw-c-ui); }
@media (hover: hover) { .rail button:hover::after { opacity: 1; transform: translate(0, -50%); } }
@media (max-width: 720px) {
  /* On a phone the swipe pages; the dots are too small to tap, so they only show where the reader is. */
  .rail { right: 1px; pointer-events: none; }
  .rail ol { padding: 0; background: none; box-shadow: none; backdrop-filter: none; }
  .rail button { width: 12px; height: clamp(8px, calc(45vh / var(--screens, 20)), 14px); }
  .rail button::before { width: 4px; height: 4px; margin: -2px 0 0 -2px; }
}

/* Shared section rhythm */
.sec { padding: clamp(96px, calc(14 * var(--vh1)), 160px) var(--gutter) clamp(96px, calc(14 * var(--vh1)), 160px) var(--pad); max-width: calc(var(--max) + var(--pad)); position: relative; }
.sec-head { display: grid; gap: 22px; margin-bottom: clamp(40px, calc(7 * var(--vh1)), 72px); }
.lede { color: var(--muted); font-size: 1.12rem; max-width: 58ch; }
.eyebrow { font: 500 0.72rem/1 var(--mono); letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin-bottom: 26px; }
.try { margin-top: 40px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; }
.try code, .say { color: var(--ink); }
.try code { font-size: 0.85rem; border-left: 2px solid var(--verm); padding: 2px 0 2px 12px; }
.source { margin-top: 18px; color: var(--faint); font-size: 0.68rem; }
.btn { display: inline-flex; align-items: center; gap: 12px; padding: 16px 30px; background: var(--ink); color: var(--bg); font: 600 1rem/1 var(--sans); text-decoration: none; border-radius: var(--r-pill); transition: background 0.3s, color 0.3s, transform 0.3s var(--ease-out); }
.btn:hover { background: var(--verm); color: var(--on-verm); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1px var(--verm); background: transparent; }
.link { color: var(--ink); text-decoration: none; font-weight: 500; border-bottom: 1px solid var(--line-strong); padding-bottom: 3px; transition: border-color 0.3s; }
.link:hover { border-color: var(--verm); }
.pause { position: absolute; z-index: 4; right: 0; bottom: 0; background: var(--bg); border: 1px solid var(--line-strong); color: var(--muted); font: 500 0.66rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; padding: 9px 12px; border-radius: var(--r-pill); cursor: pointer; }
.pause { transition: opacity 0.3s; }
.pause:hover { color: var(--ink); border-color: var(--ink); }
:focus-visible { outline: 2px solid var(--ochre); outline-offset: 3px; }

/* Hero */
.hero { position: relative; height: var(--hero-h, calc(100 * var(--vh1))); min-height: 560px; display: grid; align-items: center; padding: 84px var(--gutter) 56px var(--pad); overflow: clip; }
.hero-copy { position: relative; z-index: 3; max-width: 760px; }
.hero-title { font: 600 min(6.4vw, calc(11.5 * var(--vh1)), 7.4rem)/0.95 var(--serif); letter-spacing: -0.012em; max-width: 7.6em; text-wrap: balance; }
.hero-title .line { padding-bottom: 0.06em; }
.hero-sub { margin-top: min(34px, calc(3.4 * var(--vh1))); font-size: 1.24rem; line-height: 1.55; color: var(--ink); max-width: 36ch; }
.hero-compat { margin-top: 16px; color: var(--muted); font-size: 0.96rem; }
.hero-actions { margin-top: min(40px, calc(4 * var(--vh1))); display: flex; flex-wrap: wrap; align-items: center; gap: 28px; }
.hero-art { position: absolute; right: 0; top: 0; bottom: 0; width: 56%; z-index: 1; }
.hero-verbs { position: absolute; left: var(--pad); bottom: 22px; display: flex; gap: 28px; font: 500 0.66rem/1 var(--mono); letter-spacing: 0.3em; text-transform: uppercase; color: var(--faint); }
@media (max-width: 900px) {
  .hero { align-items: end; height: auto; min-height: var(--hero-h, calc(100 * var(--vh1))); padding-top: calc(44 * var(--vh1)); padding-bottom: 40px; }
  .hero-art { width: 100%; bottom: auto; height: calc(42 * var(--vh1)); top: 48px; }
  .hero .eyebrow { display: none; }
  .hero-title { font-size: clamp(2.5rem, 11.5vw, 4rem); }
  .hero-sub { font-size: 1.08rem; }
  .hero-verbs { display: none; }
}

/* Process */
.process { position: relative; }
.process-pin { position: relative; min-height: calc(100 * var(--vh1)); padding: 110px var(--gutter) 60px var(--pad); }
.process-head h2 { max-width: 26ch; font-size: clamp(2rem, 3.4vw, 3.3rem); }
.process-head .eyebrow { margin-bottom: 18px; }
.stage { position: relative; margin-top: 48px; max-width: 1272px; }
.stage-cap { color: var(--muted); font-size: 0.92rem; margin-bottom: 18px; }
.stage-cap .mono { color: var(--ink); }

/* Both runs: stations one under another along the braid's lane; notes and the refusal on the right. */
.stage { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); column-gap: clamp(32px, 5vw, 90px); align-items: start; margin-top: 56px; }
.row { position: relative; display: grid; grid-template-columns: 1fr; padding: 0 0 0 190px; }
.stage-cap { color: var(--muted); font-size: 0.92rem; margin: 0 0 18px; }
.stage-cap .mono { color: var(--ink); }
.st { position: relative; display: grid; grid-template-columns: 64px 1fr; column-gap: 12px; row-gap: 4px; padding: 16px 0 18px; border-bottom: 1px solid var(--line); }
.st-n { grid-row: 1; font: 500 0.7rem/1.6 var(--mono); color: var(--faint); letter-spacing: 0.08em; }
.st-t { grid-row: 1; grid-column: 2; font: 600 clamp(1.15rem, 1.4vw, 1.4rem)/1.15 var(--serif); color: var(--muted); transition: color 0.5s; }
.st-s { grid-row: 2; grid-column: 2; font: 500 0.66rem/1.3 var(--mono); color: var(--faint); min-height: 1.3em; }
.verb { grid-row: 3; grid-column: 2; font: 500 0.62rem/1 var(--mono); letter-spacing: 0.32em; text-transform: uppercase; color: var(--verm-text); opacity: 0; transition: opacity 0.6s; margin-top: 4px; }
.st.on .verb, .st.skipped .verb { opacity: 1; }
.st.on .st-t { color: var(--ink); }
.st.on .st-s { color: var(--muted); }
.st.skipped .st-t { text-decoration: line-through; text-decoration-color: var(--faint); }
.peg { position: absolute; left: -58px; top: 50%; width: 40px; height: 1px; background: var(--line-strong); transition: background 0.5s; }
.st.on .peg { background: var(--verm); }
.st .cut { position: absolute; left: -84px; top: calc(100% - 11px); width: 22px; height: 22px; opacity: 0; transition: opacity 0.3s; }
.cut::before, .cut::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--ochre); border-radius: var(--r-mark); }
.cut::before { transform: rotate(35deg); } .cut::after { transform: rotate(-35deg); }
.cut.on { opacity: 1; }
.notes { list-style: none; margin: 40px 0 0; padding: 0; display: grid; gap: 22px; font-size: 0.95rem; color: var(--faint); }
.notes li { border-top: 1px solid var(--line); padding-top: 12px; transition: color 0.6s, border-color 0.6s; }
.notes li.on { color: var(--ink); border-color: var(--verm); }
.row-2 .grp { margin: 6px 0 4px; font: 600 1.35rem/1.1 var(--serif); color: var(--ink); transition: color 0.25s; }
.row-2 .grp .st-n { margin-right: 8px; }
.row-2 .grp .mono { color: var(--faint); font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase; }
.row-2 .grp.flash { color: var(--ochre); }
.st.rv { padding: 10px 0 12px; grid-template-columns: 84px 1fr; }
.st.rv .st-n { white-space: nowrap; }
.st.rv .st-t { font-size: 1.1rem; }
.st.rv.ret.on .st-t, .st.rv.ret.on .st-s { color: var(--ochre); }
.st.dim .st-t { color: var(--muted); }
.st.dim .peg { background: none; border-top: 1px dashed var(--faint); }
.st.refused.flash .st-t { color: var(--ochre); }
.refusal { margin: calc(40 * var(--vh1)) 0 0; border-left: 2px solid transparent; padding: 4px 0 4px 16px; transition: border-color 0.3s; }
.refusal > * { visibility: hidden; }
.refusal.on { border-color: var(--ochre); }
.refusal.on > * { visibility: visible; }
.refusal-time { color: var(--ochre); font-size: 0.7rem; }
.refusal-msg { margin-top: 8px; font-size: 0.74rem; line-height: 1.55; color: var(--ink); overflow-wrap: anywhere; }
.refusal-fix { margin-top: 10px; font-size: 0.9rem; color: var(--faint); }
.refusal-fix.on { color: var(--ink); }
@media (max-width: 900px) {
  .stage { grid-template-columns: 1fr; }
  .row { padding-left: 64px; }
  .st { grid-template-columns: 34px 1fr; }
  .st.rv { grid-template-columns: 62px 1fr; }
  .peg { left: -40px; width: 28px; }
  .st .cut { left: -55px; }
  .refusal { margin: 20px 0 0 64px; }
}

/* Without motion (reduced motion, or the thread on a 2D canvas) everything the thread would reveal is shown. */
.tw-still .notes li, .tw-still .refusal-fix { color: var(--ink); }
.tw-still .verb, .tw-still .cut { opacity: 1; }
.tw-still .refusal { border-color: var(--ochre); } .tw-still .refusal > * { visibility: visible; }
.tw-still .st .st-t { color: var(--ink); } .tw-still .st.rv.ret .st-t, .tw-still .st.rv.ret .st-s { color: var(--ochre); }
.tw-still .st.dim .st-t { color: var(--muted); }
.tw-still .pause { display: none; }

/* Problem: replies sit where the frayed fibres break; the thread gathers at the conclusion. */
.problem-field { position: relative; min-height: 440px; }
.tangle2 { position: absolute; right: 0; top: -60px; width: 38%; height: 520px; }
.replies { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; max-width: 820px; position: relative; }
.replies li { display: grid; grid-template-columns: minmax(170px, 0.9fr) 1.1fr; gap: 24px; padding: 22px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.replies .cmd { font: 600 1.5rem/1.1 var(--serif); }
.replies .issue { color: var(--muted); transition: color 0.5s; }
.replies li.on .issue { color: var(--verm-text); }
.conclusion { margin-top: 64px; font: 500 clamp(1.5rem, 2.6vw, 2.2rem)/1.3 var(--serif); max-width: 34ch; color: var(--muted); }
.conclusion strong { color: var(--ink); font-weight: 600; }
@media (max-width: 900px) { .replies li { grid-template-columns: 1fr; gap: 4px; } .tangle2 { position: relative; width: 100%; height: 260px; top: 0; margin-bottom: 8px; } }
.replies { max-width: min(820px, 58%); }
@media (max-width: 900px) { .replies { max-width: none; } }

/* Agent first: three lines of a dialogue, one under another */
.dialog { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; max-width: 820px; }
.dialog li { display: grid; grid-template-columns: 150px 1fr; column-gap: 32px; row-gap: 8px; align-content: start; padding: 28px 0; border-bottom: 1px solid var(--line); }
.dialog .who { grid-row: span 2; color: var(--verm-text); font-size: 0.66rem; letter-spacing: 0.16em; text-transform: uppercase; padding-top: 6px; }
.dialog h3 { font: 600 1.55rem/1.1 var(--serif); }
.dialog p { color: var(--muted); }
.aside { margin-top: 44px; color: var(--muted); max-width: 70ch; }
.aside.quote { margin-top: 16px; color: var(--ink); font: 500 1.35rem/1.4 var(--serif); max-width: 52ch; }
@media (max-width: 720px) { .dialog li { grid-template-columns: 1fr; } .dialog .who { grid-row: auto; } }

/* Guarantees: four knots on the spine */
.knots { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; max-width: 760px; }
.knots li { display: grid; grid-template-columns: 1fr 1.4fr; gap: 32px; padding: 30px 0; border-bottom: 1px solid var(--line); }
.knots h3 { font: 600 1.7rem/1.1 var(--serif); }
.knots p { color: var(--muted); }
@media (max-width: 720px) { .knots li { grid-template-columns: 1fr; gap: 10px; } }

/* Learning examples */
.ex-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(24px, 4vw, 60px); }
.ex header { display: grid; gap: 8px; margin-bottom: 26px; min-height: 96px; align-content: start; }
.ex h3 { font: 600 1.55rem/1.1 var(--serif); }
.ex .teach { color: var(--muted); font-size: 0.92rem; }
.ex-steps { list-style: none; margin: 0; padding: 0 0 0 30px; display: grid; gap: 22px; }
.ex-end { margin: 22px 0 0 30px; color: var(--faint); font-size: 0.64rem; letter-spacing: 0.14em; text-transform: uppercase; }
.ex-step { display: grid; gap: 6px; }
.ex-n { color: var(--faint); font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase; }
.ex-step > p { font-size: 0.92rem; }
.branches { list-style: none; margin: 14px 0 0; padding: 0 0 0 22px; display: grid; gap: 14px; }
.branches p { font-size: 0.88rem; color: var(--muted); }
.br-l { color: var(--verm-text); font-size: 0.66rem; }
@media (max-width: 1000px) { .ex-list { grid-template-columns: 1fr; } .ex header { min-height: 0; } }

/* Ready workflows */
.flows { list-style: none; margin: 0; padding: 0; }
.flow { position: relative; display: grid; grid-template-columns: minmax(220px, 0.9fr) 1.3fr 1.1fr; gap: 32px; padding: 28px 0; border-bottom: 1px solid var(--line); outline: none; }
.flow::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 3px; border-radius: var(--r-line); background: var(--thread-grad); transform: scaleX(0); transform-origin: left; transition: transform 0.7s var(--ease-out); }
.flow:hover::after, .flow:focus-visible::after, .flow.current::after { transform: scaleX(1); }
.flow-name { display: grid; gap: 8px; align-content: start; }
.flow h3 { font: 600 1.6rem/1.05 var(--serif); }
.meta { color: var(--faint); font-size: 0.68rem; }
.flow p { color: var(--muted); font-size: 0.95rem; }
.when .mono { color: var(--ink); font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; }
@media (max-width: 900px) { .flow { grid-template-columns: 1fr; gap: 10px; } }

/* Roles */
.tabs { position: relative; display: flex; flex-wrap: wrap; gap: 6px 30px; border-bottom: 1px solid var(--line); margin-bottom: 40px; }
.tabs button, .clients button { background: none; border: 0; color: var(--muted); font: 500 1rem/1 var(--sans); padding: 14px 0 18px; cursor: pointer; }
.tabs button[aria-selected="true"], .clients button[aria-selected="true"] { color: var(--ink); }
.tab-thread { position: absolute; top: 0; left: 0; height: 3px; width: 40px; border-radius: var(--r-line); background: var(--thread-grad); transition: transform 0.7s var(--ease-out), width 0.7s var(--ease-out); }
.role-panel { display: grid; gap: 14px; max-width: 760px; }
.role-panel h3 { font: 600 2.2rem/1 var(--serif); }
.role-panel p { color: var(--muted); }
.role-panel .say { color: var(--ink); margin-top: 8px; }
.role-panel .say .mono { color: var(--faint); margin-right: 8px; }

/* Own workflow */
.methods { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; max-width: 820px; }
.methods li { display: grid; grid-template-columns: 1fr 1.3fr; column-gap: 32px; row-gap: 10px; align-content: start; border-bottom: 1px solid var(--line); padding: 26px 0; }
.methods li h3 { grid-row: span 2; font: 600 1.45rem/1.15 var(--serif); }
.methods p { color: var(--muted); }
.methods .ex-quote { color: var(--ink); font: 500 1.12rem/1.4 var(--serif); }
.convo { margin: 56px 0 0; max-width: 780px; border: 1px solid var(--line); border-radius: var(--r-line); padding: 26px 28px; display: grid; gap: 14px; font-family: var(--mono); font-size: 0.82rem; line-height: 1.7; }
.convo figcaption { color: var(--faint); font-size: 0.64rem; letter-spacing: 0.16em; text-transform: uppercase; }
.convo .who { display: inline-block; min-width: 72px; color: var(--verm-text); }
@media (max-width: 720px) { .methods li { grid-template-columns: 1fr; } .methods li h3 { grid-row: auto; } }

/* Built with Moira */
.sdf-steps { list-style: none; margin: 0 0 56px; padding: 0; display: flex; flex-wrap: wrap; gap: 14px clamp(26px, 5vw, 76px); font-size: 0.72rem; letter-spacing: 0.2em; color: var(--muted); }
.sdf-steps li { padding-top: 26px; }
.sdf-map { margin: 0; }
.sdf-map ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 14px; }
.sdf-map li { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; row-gap: 4px; align-content: start; padding: 12px 14px 12px; border: 1px solid var(--line); border-radius: var(--r-frame); background: color-mix(in srgb, var(--bg-raise) 70%, transparent); }
.sdf-map .n { color: var(--faint); font-size: 0.7rem; padding-top: 3px; }
.sdf-map .t { font: 500 1rem/1.25 var(--serif); }
.sdf-map .m { grid-column: 2; color: var(--muted); font-size: 0.66rem; }
.sdf-map .ret { color: var(--verm-text); }
.sdf-map figcaption { margin-top: 16px; color: var(--faint); font-size: 0.66rem; }
@media (max-width: 900px) { .sdf-map ol { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; } .sdf-map .t { font-size: 0.9rem; } }
.tagline { margin: 44px 0 20px; font: 500 1.6rem/1.3 var(--serif); text-wrap: balance; }

/* Telegram */
.tg-grid { display: grid; grid-template-columns: 1fr minmax(280px, 400px); gap: clamp(24px, 6vw, 96px); align-items: center; }
.tg-types { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px; }
.tg-types p { color: var(--muted); }
.tg-msg { margin: 0; background: var(--bg-raise); border: 1px solid var(--line); border-radius: var(--r-bubble); padding: 20px 22px; display: grid; gap: 6px; box-shadow: 0 30px 80px rgb(0 0 0 / 35%); }
.tg-msg figcaption { color: var(--faint); font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; margin-bottom: 6px; }
.tg-from { font-weight: 600; color: var(--verm-text); }
.tg-wf { font-weight: 500; }
.tg-time { color: var(--faint); font-size: 0.64rem; justify-self: end; }
@media (max-width: 900px) { .tg-grid { grid-template-columns: 1fr; } }

/* Self-host, quick start */
.cmd-block { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; background: var(--bg-code); border: 1px solid var(--line); border-radius: var(--r-frame); padding: 20px 22px; overflow-x: auto; font: 400 0.84rem/1.7 var(--mono); color: var(--ink); max-width: 820px; }
.oss .hero-actions { margin-top: 30px; }
.qa { max-width: 860px; border-top: 1px solid var(--line); }
.qa details { border-bottom: 1px solid var(--line); position: relative; }
.qa summary { cursor: pointer; list-style: none; padding: 26px 40px 26px 0; font: 600 1.55rem/1.2 var(--serif); position: relative; }
.qa summary::-webkit-details-marker { display: none; }
.qa summary::after { content: "+"; position: absolute; right: 0; top: 24px; font: 400 1.4rem/1 var(--mono); color: var(--muted); transition: transform 0.4s var(--ease-out); }
.qa details[open] summary::after { transform: rotate(45deg); }
.qa details p { color: var(--muted); padding: 0 0 28px 22px; max-width: 70ch; position: relative; }
.qa details[open] p::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 30px; width: 3px; border-radius: var(--r-line); background: var(--thread-grad-x); }
.clients { display: flex; flex-wrap: wrap; gap: 4px 26px; margin-bottom: 26px; border-bottom: 1px solid var(--line); }
.client-panel { display: grid; gap: 12px; }
.next { margin-top: 56px; max-width: 760px; }
.next h3 { font: 600 1.6rem/1.1 var(--serif); margin-bottom: 18px; }
.next ol { margin: 0; padding-left: 20px; display: grid; gap: 10px; color: var(--muted); }
.next code { color: var(--ink); }
.final { display: grid; gap: 20px; }
.start .quick { margin-top: 64px; }
.final h2 { font-size: clamp(3rem, 6.6vw, 6.4rem); }

.foot { padding: 48px var(--gutter) 64px var(--pad); color: var(--faint); font-size: 0.82rem; display: grid; gap: 8px; border-top: 1px solid var(--line); }
.foot .credits { font-size: 0.64rem; max-width: 90ch; }

/* Reveal helpers (JS adds .rv to targets when motion is allowed) */
.line-mask { overflow: clip; }

/* Compositions below the process: text and an object side by side, full width. */
.agent-grid, .own-grid, .roles-grid, .oss-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 110px); align-items: start; }
.agent-side { position: static; }
.agent-side .quote { margin-top: 0; font-size: clamp(1.5rem, 2.2vw, 2.1rem); line-height: 1.3; }
.own-grid .convo { margin: 0; }
.oss-grid .sec-head { margin-bottom: 0; }
.oss-side { display: grid; gap: 18px; padding-top: 12px; }
.role-cord { margin: 0; position: relative; min-height: 300px; }
.role-cord figcaption { position: absolute; left: 0; bottom: 0; color: var(--faint); font-size: 0.64rem; letter-spacing: 0.06em; }
.guarantees .knots { max-width: none; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(20px, 3vw, 48px); padding-top: 70px; }
.guarantees .knots li { grid-template-columns: 1fr; gap: 12px; border-bottom: 0; padding: 0; }
@media (max-width: 900px) {
  .agent-grid, .own-grid, .roles-grid, .oss-grid { grid-template-columns: 1fr; }
  .agent-side, .own-grid .convo { position: static; }
  .role-cord { min-height: 160px; }
  .guarantees .knots { grid-template-columns: 1fr; padding-top: 0; }
  .guarantees .knots li { padding: 24px 0; border-bottom: 1px solid var(--line); }
}
/* Pause controls are docked in the flow, beside their motion, never over text. */
.hero-art .pause { right: var(--gutter); bottom: 22px; }
.tg-grid { position: relative; } .pause-tg { position: static; justify-self: end; grid-column: 2; margin-top: 12px; }
@media (max-width: 900px) { .hero-art .pause { right: var(--gutter); bottom: 8px; } .pause-tg { grid-column: 1; } }

/* Stage 1 on wide screens: the rail, stations left to right, the braid under their labels. */
@media (min-width: 901px) {
  .stage-1 { display: block; }
  .stage-1 .row { grid-template-columns: repeat(7, minmax(0, 1fr)); column-gap: clamp(10px, 1.6vw, 26px); row-gap: 40px; padding: 0; }
  .stage-1 .stage-cap { grid-column: 1 / -1; }
  .stage-1 .st { grid-template-columns: 1fr; row-gap: 6px; padding: 0 0 128px; border-bottom: 0; align-content: start; }
  .stage-1 .st-n, .stage-1 .st-t, .stage-1 .st-s { grid-column: 1; grid-row: auto; }
  .stage-1 .verb { position: static; grid-column: 1; grid-row: 4; margin: 2px 0 0; }
  .stage-1 .st-n { grid-row: 1; } .stage-1 .st-t { grid-row: 2; } .stage-1 .st-s { grid-row: 3; }
  .stage-1 .peg { left: 0; top: auto; bottom: 70px; width: 1px; height: 44px; }
  .stage-1 .st .cut { left: calc(42% - 11px); top: auto; bottom: calc(92px - 11px); }
  .stage-1 .notes { grid-template-columns: repeat(4, 1fr); margin-top: 8px; }
}

/* Room under the notification card for the braid that goes round it. */
.tg .tagline { margin-top: 110px; }

/* Paging: the page is read in screens. A section is at least one screen tall with its content centred,
   and the screen itself separates the parts, so the section's own padding is small. */
.tw-page .sec { min-height: calc(100 * var(--vh1)); padding-top: 92px; padding-bottom: 48px; display: flex; flex-direction: column; justify-content: center; }
.tw-page .process-pin { padding-top: 92px; padding-bottom: 0; }
.tw-page .stage-2 { min-height: calc(100 * var(--vh1)); padding: 92px 0 48px; margin-top: 0; box-sizing: border-box; align-content: center; }
@media (max-width: 900px) { .tw-page .sec { padding-top: 84px; padding-bottom: 40px; } .tw-page .stage-2 { padding-top: 84px; } }
.final { position: relative; }
/* Small tangles in the empty parts of some screens (wide screens only); the braid winds them. */
.tangle-deco { display: none; position: absolute; pointer-events: none; }
@media (min-width: 901px) {
  .tw-page .tangle-deco { display: block; }
  /* Tangles beside a section's heading stay with the heading, whatever the window's height. */
  .tw-page .sec-head { position: relative; }
  /* «Сделано на Moira» on one screen: the steps across, then the tagline left and the map of the flow right. */
  .tw-page .sec.built { display: grid; grid-template-columns: minmax(240px, 0.55fr) minmax(0, 1.45fr); grid-template-areas: "head head" "steps steps" "text shot" "link shot"; column-gap: 64px; align-content: center; }
  .tw-page .built .sec-head { grid-area: head; margin-bottom: 28px; }
  .tw-page .built .sdf-steps { grid-area: steps; margin-bottom: 36px; }
  .tw-page .built .sdf-map { grid-area: shot; }
  .tw-page .built .tagline { grid-area: text; align-self: end; margin: 0 0 16px; }
  .tw-page .built > .link { grid-area: link; align-self: start; }
  /* Self-host and the questions share one screen. */
  .tw-page .sec.oss { min-height: 0; padding-top: 76px; padding-bottom: 20px; }
  .tw-page .sec.faq { min-height: 0; padding-top: 20px; padding-bottom: 24px; }
}
@media (min-width: 901px) {
  /* Screens hold one part each: headings keep less air below them, and the four flows fit one screen. */
  .tw-page .sec-head { margin-bottom: 36px; }
  .tw-page .faq .sec-head { margin-bottom: 56px; }
  .tw-page .ready .flow { padding-top: 16px; padding-bottom: 16px; }
}
@media (min-width: 901px) {
  /* More tangles in the empty parts of the screens: each is wound by the braid as it leaves the section. */
}
.tw-virt .st-s:not(.shown) { visibility: hidden; }

/* The last screen: the call to action left, the quick start right, «Что дальше?» across below. */
@media (min-width: 901px) {
  .tw-page .sec.start { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); grid-template-areas: "final quick" "next next"; column-gap: clamp(56px, 7vw, 110px); row-gap: 64px; align-content: center; }
  .tw-page .start .final { grid-area: final; align-content: center; }
  .tw-page .start .final h2 { font-size: clamp(3rem, 5.4vw, 5.6rem); }
  .tw-page .start .quick { grid-area: quick; align-self: center; min-width: 0; margin-top: 0; }
  .tw-page .start .quick .sec-head { gap: 10px; margin-bottom: 18px; }
  .tw-page .start .quick h2 { font-size: clamp(1.6rem, 2.2vw, 2.2rem); }
  .tw-page .start .next { grid-area: next; margin-top: 0; max-width: none; }
  .tw-page .start .next ol { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 40px; }
}
/* The braid's closing loop runs round «Начать»: the link beside it keeps clear of the loop. */
.final .hero-actions { gap: 48px; }
@media (min-width: 901px) {
  /* «Как выглядит воркфлоу» on one screen: tighter rhythm, the same content. */
  .tw-page .examples { padding-top: 84px; padding-bottom: 28px; }
  .tw-page .examples .sec-head { margin-bottom: 26px; }
  .tw-page .ex header { min-height: 0; margin-bottom: 16px; }
  .tw-page .ex-steps { gap: 13px; }
  .tw-page .ex-step > p { font-size: 0.86rem; line-height: 1.42; }
  .tw-page .ex-end { margin-top: 14px; }
  /* Sparse screens read larger: the guarantees and the notifications fill their screen. */
  .tw-page .guarantees .knots { padding-top: 90px; }
  .tw-page .guarantees .knots h3 { font-size: clamp(1.8rem, 2.3vw, 2.4rem); }
  .tw-page .guarantees .knots p { font-size: 1.06rem; line-height: 1.55; }
  .tw-page .tg-grid { grid-template-columns: 1fr minmax(340px, 480px); gap: clamp(90px, 9vw, 140px); }
  .tw-page .tg-types h3 { font-size: 1.35rem; }
  .tw-page .tg-types p { font-size: 1.02rem; }
  .tw-page .tg-msg { padding: 26px 28px; font-size: 1.08rem; }
}
@media (min-width: 901px) {
  /* The heading and its lede side by side: the three flows get the screen's height. */
  .tw-page .examples .sec-head { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 120px; align-items: end; }
}
@media (min-width: 901px) {
  /* The threads part round the notification card: its pause button stands clear of their loop. */
  .tw-page .pause-tg { grid-column: 1; justify-self: start; margin-top: 8px; }
}

/* ---------- The wall ---------- */
/* The whole page is a wall of warm dark plaster: a fine SVG grain, broad uneven patches and a soft shade
   (the two textures in assets/). It is the page layer's own background, so it moves with the page, under
   the thread. */
#page {
  background-color: var(--wall);
  background-image: url("./assets/wall-grain.svg"), url("./assets/wall-patches.png"), url("./assets/wall-shade.png");
  background-size: 320px 320px, 1024px 1024px, 512px 512px;
}

/* Stop-motion buttons sit above the tangles, clear of the shelves. */
.tangle2 .pause { top: -6px; bottom: auto; }
.hero-art .pause { top: 90px; bottom: auto; }
@media (max-width: 900px) {
  /* On a phone the text follows the tangle closely: room for the plank under the art. */
  .hero-art { height: calc(38 * var(--vh1)); }
  .tangle2 { margin-bottom: 34px; }
  /* The thread enters this tangle from above: its own stop button gives way (the first screen's stops all motion). */
  .tangle2 .pause { display: none; }
  .hero-art .pause { top: -2px; left: var(--gutter); right: auto; }
}

/* ---------- Planks under rows of cards (wide screens) ----------
   The four guarantees and the three example flows stand on long oak planks, as if put up on the wall.
   The plank is a real element (the thread keeps clear of it), just under the row. */
.on-plank { position: relative; }
.plank { display: none; }
@media (min-width: 901px) {
  .tw-page .on-plank .plank { display: block; position: absolute; left: -12px; right: 28px; bottom: -30px; height: 16px; border-radius: 2px 2px 3px 3px; pointer-events: none;
    background: linear-gradient(180deg, rgb(255 230 190 / 22%) 0 1px, transparent 2px, transparent 70%, rgb(0 0 0 / 28%) 100%), url("./assets/wood-front.png") 0 0 / 512px 16px repeat-x;
    box-shadow: 0 22px 28px -12px rgb(0 0 0 / 70%), 0 6px 10px -4px rgb(0 0 0 / 55%), 0 -8px 0 -1px #7a5536; }
}
@media (min-width: 901px) {
  /* The right lane runs 60 px from the edge (clear of the screen switcher): wide blocks keep clear of it. */
  .tw-page .sec { padding-right: 96px; }
  /* The process too: the thread leaves the rail of stations down the right lane, past the notes. */
  .tw-page .process-pin { padding-right: 96px; }
}

@media (min-width: 901px) {
  .tw-page .final .tangle-end { right: -10px; bottom: -34px; width: 190px; height: 190px; }
  .tw-page .final .tangle-end { display: block; }
}

/* On a phone the page ends with a tangle on its shelf, below the quick start. */
.tangle-end-m { display: none; }
@media (max-width: 900px) { .tw-page .tangle-end-m { display: block; position: relative; width: 170px; height: 170px; margin: 40px auto 30px; } }

