/* The site's base and its entities, shared by every case. Values come from tokens.css.
   A case's own stylesheet comes after this one and adds what only that case has.
   Entities: base · links · header · section (row, label, text, side, lead, kicker, subhead)
   · media (full, shot, panels, bleed-row) · callout (line, oval, reveal) · steps
   · switch · case nav (tabs) · footer. See DESIGN-TOKENS.md. */

/* ── Base ── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-sans); font-size: var(--fs-body); line-height: var(--lh-body); letter-spacing: 0; -webkit-font-smoothing: antialiased; overflow-x: clip; }
img { display: block; max-width: 100%; height: auto; }
picture { display: block; }
figure { margin: 0; }
strong, b { font-weight: var(--fw-medium); }
a { color: inherit; }
a:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
/* The page's column: 1440px at most, the side padding never under the safe area. */
.wrap { padding-left: max(var(--pad), var(--gutter)); padding-right: max(var(--pad), var(--gutter-r)); max-width: var(--page-max); margin: 0 auto; }

/* ── Links: a 1px line in the link's own colour that rises into a red plate on hover.
   (A small script sets each link's --lc to its colour at rest; without it, currentColor.) ── */
a:not(.ring, .tabs a, .pills a) { text-decoration: none !important; padding: 0 2px; margin: 0 -2px; background: linear-gradient(var(--lc, currentColor), var(--lc, currentColor)) center bottom / calc(100% - 4px) var(--line) no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; transition: background-size var(--dur-hover) ease-out, color var(--dur-hover) ease-out; }
@media (hover: hover) { a:not(.ring, .tabs a, .pills a):hover { background-size: 100% 100%; --lc: var(--link-fill) !important; color: var(--link-fill-text) !important; } }
a:not(.ring, .tabs a, .pills a):focus-visible { background-size: 100% 100%; --lc: var(--link-fill) !important; color: var(--link-fill-text) !important; outline: none; }
@media (prefers-reduced-motion: reduce) { a:not(.ring, .tabs a, .pills a) { transition: none; } }

/* ── Header: the name at the left, the nav from the middle; no line under the links until hovered ── */
.bar { position: absolute; top: env(safe-area-inset-top, 0px); left: 0; right: 0; z-index: var(--z-bar); color: var(--text); }
.bar .wrap { display: grid; grid-template-columns: 1fr 1fr; align-items: center; padding-block: var(--space-16); }
.bar .wrap > a { justify-self: start; }
.bar nav { display: flex; gap: var(--space-24); flex-wrap: wrap; justify-content: flex-start; }
.bar nav .bar-contact { margin-left: auto; }
.bar a { font-size: var(--fs-body); line-height: var(--lh-body); }
.bar a:not(:hover):not(:focus-visible) { background-size: calc(100% - 4px) 0; }
.bar .at { color: var(--accent); }
.bar a:hover .at, .bar a:focus-visible .at { color: inherit; } /* white on the red plate */

/* ── Section: a row of label (left half) and text (right half); one column on phones.
   Each labelled row carries the gap between sections on top; a row without a label is 24px under the block before. ── */
.row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-16) 0; }
.row > .side, .row > .label { padding-right: var(--space-24); }
@media (max-width: 720px) { .row { grid-template-columns: 1fr; } }
.row, .sub .row { padding-block: var(--section-gap) 0; }
.row:not(:has(.label)) { padding-top: var(--inner-gap); }
.label { margin: 0; font-weight: var(--fw-regular); font-size: var(--fs-heading); line-height: var(--lh-heading); letter-spacing: var(--ls-heading); }
.side { display: grid; gap: var(--space-24); align-content: start; }
.text { min-width: 0; max-width: none; display: grid; gap: var(--text-gap); }
.text p { margin: 0; font-size: var(--fs-body); line-height: var(--lh-body); text-wrap: pretty; }
/* A lead: a paragraph at the heading's size; its inline drawings in the accent. */
.lead { margin: 0; font-size: var(--fs-heading); line-height: var(--lh-heading); letter-spacing: var(--ls-heading); max-width: 30ch; text-wrap: pretty; }
.lead svg { color: var(--accent); }
/* A subhead: the one style for every heading over a paragraph or a callout's text (.subhead, .callout > b): body size, semibold. */
.subhead, .callout > b { font-size: var(--fs-body); line-height: var(--lh-body); font-weight: var(--fw-semibold); letter-spacing: 0; }
.subhead { margin: 0; }
.text > * + .subhead { margin-top: var(--space-16); }
.text > .subhead + * { margin-top: calc(var(--space-4) - var(--text-gap)); }
/* A kicker: the small medium-weight word over a lead. */
.kicker { margin: 0; font-size: var(--fs-body); line-height: var(--lh-body); font-weight: var(--fw-medium); letter-spacing: 0; }
.note { margin: 0; font-size: var(--fs-body); line-height: var(--lh-body); max-width: none; }

/* ── Media: pictures as they are, no frames or backgrounds. 32px from text to a picture and back. ── */
.shot { background: none; padding: 0 !important; border-radius: 0; display: block; overflow: hidden; }
.shot img, .shot video { width: 100% !important; border-radius: 0 !important; box-shadow: none !important; display: block; }
/* Full width: the page's column, a big screenshot never wider than its 1280px file (.wide lets it). */
.full { padding-block: var(--block-gap) 0; }
.full .shot img { max-width: 1280px; margin: 0 auto; }
.full .shot img.wide { max-width: none; }
/* Panels: pictures side by side, three (or .two) a row, one a row on phones. */
.panels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-8); padding-block: var(--block-gap) 0; }
.panels.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panels .shot img, .panels .shot video { height: auto; }
@media (max-width: 720px) { .panels, .panels.two { grid-template-columns: 1fr; } }
.panels + .row, .full + .row, figure + .row { padding-top: var(--block-gap); }
/* A bleed row: a sideways scroller whose cards start at the column's edge and run out to the window's. */
.bleed-row { --bleed: calc(max(var(--pad), var(--gutter-r)) + max(0px, (100vw - var(--page-max)) / 2)); --bleed-l: calc(max(var(--pad), var(--gutter)) + max(0px, (100vw - var(--page-max)) / 2)); display: flex; gap: var(--space-16); list-style: none; margin: 0 calc(-1 * var(--bleed)) 0 calc(-1 * var(--bleed-l)); padding: 0 var(--bleed) 0 var(--bleed-l); scroll-padding-inline-start: var(--bleed-l); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.bleed-row::-webkit-scrollbar { display: none; }
.bleed-row > li { scroll-snap-align: start; }

/* ── Callout (врезка): a side note. Plain: a red line at its left.
   .oval is a device, not a fixed part: the words on paper strips (.plate) in a tilted red oval whose size, offset
   and angle are set per placement, by eye against its text: --oval-w, --oval-h (of the note's box), --oval-x,
   --oval-y (the shift, as translate()), --oval-angle. Defaults below; set them on the note (style or case.css). ── */
.callout { border-left: var(--line) solid var(--accent); padding-left: 10px; display: grid; gap: var(--space-8); max-width: var(--callout-max); }
.text .callout p, .callout p { font-size: var(--fs-body); line-height: var(--lh-body); }
.callout p { margin: 0; }
.side .callout { margin-right: var(--space-24); }
@media (max-width: 720px) { .side .callout { margin-right: 0; } .callout { max-width: none; } }
.callout.oval { position: relative; isolation: isolate; border-left: 0 !important; padding: 0 !important; gap: var(--space-8); }
.callout.oval::before { content: ""; position: absolute; z-index: -1; left: 50%; top: 50%; width: var(--oval-w, 112%); height: var(--oval-h, 125%); transform: translate(var(--oval-x, -55%), var(--oval-y, -50%)) rotate(var(--oval-angle, -15deg)); border: var(--line) solid var(--accent); border-radius: 50%; box-sizing: border-box; pointer-events: none; }
.callout.oval .plate { background: var(--bg); padding: .2em 4px; margin: 0 -4px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.callout.oval b .plate { padding-bottom: calc(.2em + var(--space-8)); } /* no line of the oval between the title and the text */
/* Reveal (the page's script adds html.draw-ready / .rise-ready, then .drawn / .risen once in view):
   the oval drawn round the note, the text rising in. */
@property --draw { syntax: '<angle>'; inherits: false; initial-value: 360deg; }
@keyframes oval-draw { from { --draw: 0deg; } to { --draw: 360deg; } }
.callout.oval::before { -webkit-mask: conic-gradient(from var(--from, -40deg), #000 var(--draw), transparent 0); mask: conic-gradient(from var(--from, -40deg), #000 var(--draw), transparent 0); }
html.draw-ready .callout.oval::before { --draw: 0deg; }
html.draw-ready .callout.oval.drawn::before { animation: oval-draw var(--dur-draw) var(--ease-draw) .15s both; }
html.rise-ready .callout > b, html.rise-ready .callout > p { opacity: 0; transform: translateY(var(--rise)); }
html.rise-ready .callout.risen > b, html.rise-ready .callout.risen > p { opacity: 1; transform: none; transition: opacity var(--dur-reveal) var(--ease-out), transform var(--dur-reveal) var(--ease-out); }
html.rise-ready .callout.risen > p { transition-delay: .12s; }

/* ── Steps: a numbered list, each number in a red oval as tall as its line; the ovals hang out to the left on wide screens. ── */
.steps { list-style: none; margin: 0 0 0 calc((.6em - 40px) / 2); padding-left: 0; font-size: var(--fs-body); line-height: var(--lh-body); letter-spacing: 0; font-weight: var(--fw-regular); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0; }
.steps li { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: start; }
.steps .step-n { position: relative; display: block; width: 40px; margin-right: var(--space-4); box-sizing: border-box; color: var(--accent); font-size: var(--fs-body); font-weight: var(--fw-regular); line-height: var(--lh-body); letter-spacing: 0; font-variant-numeric: tabular-nums; text-align: center; }
.steps .step-n::before { content: ""; position: absolute; left: 50%; top: 0; width: 40px; height: 100%; margin: 0 0 0 -20px; border: var(--line) solid var(--accent); border-radius: 50%; box-sizing: border-box; }
@media (max-width: 720px) { .steps { margin-left: 0; } }

/* ── Switch: two or more tabs in a pill, the chosen one solid; a video (or a text) per tab. Two equal halves on phones. ── */
.switch { display: inline-flex; justify-self: start; width: fit-content; padding: 0; gap: 0; overflow: visible; border: var(--line) solid var(--text); border-radius: var(--radius-pill); }
.switch button { font: inherit; font-size: var(--fs-body); line-height: var(--lh-body); letter-spacing: 0; color: var(--text); background: transparent; border: 0; border-radius: var(--radius-pill); padding: 5px 14px 6px; margin: -1px; position: relative; cursor: pointer; }
.switch button[aria-selected="true"] { background: var(--inverse-bg); color: var(--inverse-text); }
.switch button:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
@media (max-width: 720px) { .switch { display: grid; grid-template-columns: 1fr 1fr; width: 100%; justify-self: stretch; } .switch button { padding-inline: 8px; } }

/* ── Case nav (.view-tabs > .tabs): the case's versions (full, tl;dr), the active one's sections in a strip,
   stuck to the window's top; the section in view on red. ── */
.view-tabs { position: sticky; top: -22px; z-index: var(--z-sticky); pointer-events: none; padding-top: 22px; margin-top: calc(var(--section-gap) - 22px); }
@media (max-width: 720px) { .view-tabs { top: -21px; padding-top: 21px; margin-top: calc(var(--section-gap) - 21px); } }
.view-tabs .tabs { pointer-events: auto; background: var(--bg); }
.tabs { display: flex; align-items: flex-start; gap: 0; width: 100%; overflow: visible; border-bottom: var(--line) solid var(--rule); }
.tabs a { border: 0; padding: 5px 14px 6px; font-size: var(--fs-body); line-height: var(--lh-body); letter-spacing: 0; color: var(--text); text-decoration: none; text-align: center; position: relative; }
@media (max-width: 720px) { .tabs a { padding-inline: 8px; white-space: nowrap; } }
.tabs a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tabs .seg { display: flex; align-items: flex-start; min-width: 0; margin: 0 0 -1px; position: relative; }
.tabs .seg a { margin: 0; flex: none; white-space: nowrap; }
/* the other version: as wide as its label, its bottom line only */
.tabs .seg:has(> a[aria-selected="false"]) { flex: none; align-self: stretch; }
.tabs .seg:has(> a[aria-selected="false"]) > a { padding-inline: 24px; }
.tabs .seg > a[aria-selected="false"] { align-self: stretch; }
@media (hover: hover) { .tabs a[aria-selected="false"]:hover { background: var(--c-black-06); } .tabs a[role="tab"][aria-selected="false"]:hover { color: var(--nav-hover-text) !important; } }
/* the active version: the rest of the width, a line at its right and bottom, its sections after a colon */
.tabs .seg:has(> a[aria-selected="true"]) { flex: 1 1 0; min-width: 0; background: var(--bg); color: var(--text); border-right: var(--line) solid var(--rule); border-bottom: var(--line) solid var(--rule); }
.tabs .seg:last-child { border-right: 0 !important; }
.tabs .seg:has(> a[aria-selected="false"]) + .seg:has(> a[aria-selected="true"]) { border-left: var(--line) solid var(--rule); }
.tabs .seg > a[aria-selected="true"] { background: none; color: var(--text); align-self: stretch; padding-right: 14px; }
.tabs .seg > a[aria-selected="true"]::after { content: ":"; }
@media (max-width: 720px) { .tabs .seg:has(> a[aria-selected="false"]) > a { padding-inline: 16px; } .tabs .seg > a[aria-selected="true"] { padding-left: 16px; padding-right: 16px; } }
/* the sections' strip: scrolls sideways, fading where it has more */
.tabs .toc { display: none; }
.tabs .toc::-webkit-scrollbar { display: none; }
.tabs .seg:has(> a[aria-selected="true"]) .toc { display: flex; flex: 1; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; padding-inline: 6px 18px; --fade-l: #000; --fade-r: #000; -webkit-mask-image: linear-gradient(90deg, var(--fade-l) 0, #000 14px, #000 calc(100% - 24px), var(--fade-r)); mask-image: linear-gradient(90deg, var(--fade-l) 0, #000 14px, #000 calc(100% - 24px), var(--fade-r)); }
.tabs .toc.fade-l { --fade-l: transparent; } .tabs .toc.fade-r { --fade-r: transparent; }
.tabs .toc a { color: var(--text); padding-inline: 10px; align-self: stretch; display: flex; align-items: center; position: relative; white-space: nowrap; }
@media (max-width: 720px) { .tabs .toc a { padding-inline: 6px; } }
@media (hover: hover) { .tabs .toc a:hover { background: none; } .tabs .toc a:not(.cur):not(.try):hover { color: var(--nav-hover-text) !important; } }
/* the section in view on red; before any is (the page just opened) the version itself */
.tabs .toc a.cur, .tabs .seg:not(:has(.toc a.cur)) > a[aria-selected="true"] { background: var(--nav-active); color: var(--link-fill-text); }
/* a link out in the strip ("try it"): no line at rest, the red plate on hover, as the page's links */
.tabs .toc a.try { align-self: center; padding: 0 2px; margin-inline: 12px; line-height: 1.25; background: linear-gradient(var(--text), var(--text)) center bottom / calc(100% - 4px) 0 no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; transition: background-size var(--dur-hover) ease-out, color var(--dur-hover) ease-out; }
@media (max-width: 720px) { .tabs .toc a.try { margin-inline: 4px; } }
@media (hover: hover) { .tabs .toc a.try:hover { background-size: 100% 100%; background-image: linear-gradient(var(--link-fill), var(--link-fill)); color: var(--link-fill-text); } }
.tabs .toc a.try:focus-visible { background-size: 100% 100%; background-image: linear-gradient(var(--link-fill), var(--link-fill)); color: var(--link-fill-text); outline: none; }
.tabs .toc a.try .try-arrow { width: .62em; height: .62em; margin-left: .2em; vertical-align: .08em; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: square; overflow: visible; }
@media (prefers-reduced-motion: reduce) { .tabs .toc a.try { transition: none; } }

/* ── Footer ── */
footer { background: var(--media-bg); color: var(--c-white); }
footer .wrap { padding-block: 40px; display: flex; flex-wrap: wrap; gap: var(--space-16) var(--space-32); justify-content: space-between; align-items: center; font-size: var(--fs-body); line-height: var(--lh-body); }
footer small { color: var(--c-white-40); font-size: var(--fs-body); line-height: var(--lh-body); }
