/* Ampirs, Lexbor and Vodka — one stylesheet for all three sites.
   Fonts: Adwaita Sans and Adwaita Mono subsets, SIL OFL 1.1 (FONT-LICENSE.txt). */
@font-face {
  font-family: "Ampirs Sans";
  src: url("fonts/ampirs-sans.woff2") format("woff2"), local("Adwaita Sans");
  font-weight: 400 780;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Ampirs Mono";
  src: url("fonts/ampirs-mono.woff2") format("woff2"), local("Adwaita Mono");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Ampirs Mono";
  src: url("fonts/ampirs-mono-bold.woff2") format("woff2"), local("Adwaita Mono Bold");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Tokens ----------------------------------------------------------------- */
:root {
  color-scheme: light dark;
  --font-sans: "Ampirs Sans", "Adwaita Sans", Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "Ampirs Mono", "Adwaita Mono", ui-monospace, "SFMono-Regular", "JetBrains Mono", Consolas, monospace;

  --paper: light-dark(#ffffff, #111419);
  --paper-2: light-dark(#f5f6f8, #171a20);
  --card: light-dark(#ffffff, #1b1f26);
  --card-2: light-dark(#f9fafb, #1f242c);
  --ink: light-dark(#15181e, #eef0f3);
  --ink-2: light-dark(#252a31, #d5d9e0);
  --muted: light-dark(#4f5866, #a7afbb);
  --quiet: light-dark(#646b78, #868f9d);
  --line: light-dark(#e3e6ea, #272c34);
  --line-2: light-dark(#cdd2d9, #383e48);

  --ampirs: #e0312b;
  --ampirs-ink: light-dark(#c4261f, #ff6b5f);
  --gold: #d9a200;
  --blue: light-dark(#3d6fcc, #8fb3f2);
  --lexbor: light-dark(#2f5fb8, #8fb3f2);
  --lexbor-fill: light-dark(#3d6fcc, #7aa6f0);
  --vodka: light-dark(#b54100, #ff9a4a);
  --vodka-fill: light-dark(#eb6400, #ff8a2e);
  --browser: light-dark(#0b7d6c, #4fd1bb);
  --designer: light-dark(#7344c9, #b394f0);
  --mail: light-dark(#c42a62, #f07aa3);

  --accent: var(--ampirs-ink);
  --accent-fill: var(--ampirs);
  --on-accent: #ffffff;

  --radius: 10px;
  --radius-lg: 14px;
  --gutter: clamp(1.25rem, 4.5vw, 3rem);
  --measure: 42rem;
  --wide: 68rem;
  --header: 3.75rem;
  --space: clamp(5.5rem, 11vw, 9.5rem);

  --diagram-ink: var(--ink);
  --diagram-muted: var(--muted);
  --diagram-rule: light-dark(#c5cbd3, #3a414c);
  --diagram-card: var(--card);
}
body.site-lexbor, .card-lexbor, .cross-lexbor, .tm-lexbor { --accent: var(--lexbor); --accent-fill: var(--lexbor-fill); }
body.site-lexbor { --on-accent: light-dark(#ffffff, #111419); }
body.site-lexbor .button-accent { --accent-fill: var(--lexbor); }
body.site-vodka, .card-vodka, .cross-vodka, .tm-vodka { --accent: var(--vodka); --accent-fill: var(--vodka-fill); --on-accent: #1b0f05; }
.cross-ampirs { --accent: var(--ampirs-ink); --accent-fill: var(--ampirs); --on-accent: #ffffff; }
#designer, .app-tabs a[href="#designer"], .tm-designer { --accent: var(--designer); --accent-fill: var(--designer); }
#browser, .app-tabs a[href="#browser"], .tm-browser { --accent: var(--browser); --accent-fill: var(--browser); }
#mail, .app-tabs a[href="#mail"], .tm-mail { --accent: var(--mail); --accent-fill: var(--mail); }
/* Derived colours are recomputed wherever a block changes its accent. */
:root, body, .card-lexbor, .card-vodka, .cross-card, [class*="tm-"], .app-tabs a, .application, .diagram, #viewer {
  --accent-soft: color-mix(in oklab, var(--accent-fill) 10%, var(--card));
  --accent-line: color-mix(in oklab, var(--accent-fill) 36%, var(--line));
  --diagram-accent: var(--accent);
  --diagram-fill: color-mix(in oklab, var(--accent-fill) 13%, var(--card));
  --diagram-band: color-mix(in oklab, var(--accent-fill) 6%, color-mix(in oklab, var(--ink) 4%, var(--card)));
}

/* Base ------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height, var(--header)) + 1rem); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink);
  font: 400 1.0625rem/1.6 var(--font-sans); font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg { max-width: 100%; }
img { display: block; height: auto; }
h1, h2, h3, h4, p, figure, blockquote, ol, ul, dl, dd { margin: 0; }
ol, ul { padding: 0; list-style: none; }
h1, h2, h3, h4 { text-wrap: balance; color: var(--ink); }
p { text-wrap: pretty; }
a { color: inherit; text-decoration: none; }
button, summary { cursor: pointer; color: inherit; font: inherit; }
button { background: none; border: 0; padding: 0; }
code { font-family: var(--font-mono); font-size: .88em; padding: .06em .32em; border-radius: 4px; background: color-mix(in oklab, var(--ink) 6%, transparent); color: var(--ink-2); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent-fill); outline-offset: 3px; border-radius: 4px; }
::selection { background: color-mix(in oklab, var(--accent-fill) 25%, transparent); color: var(--ink); }
[hidden] { display: none !important; }
.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; }
.wrap { width: min(100%, 1240px); margin-inline: auto; padding-inline: var(--gutter); padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); }
.icon { flex: none; }
.skip { position: fixed; top: -6rem; left: 1rem; z-index: 50; background: var(--ink); color: var(--paper); padding: .7rem 1rem; border-radius: 8px; }
.skip:focus { top: .75rem; }

/* Typography ------------------------------------------------------------- */
h1 { font-size: clamp(2.9rem, 6.6vw, 5.75rem); font-weight: 650; line-height: 1.02; letter-spacing: -.035em; }
h2 { font-size: clamp(2.1rem, 4.4vw, 3.75rem); font-weight: 640; line-height: 1.06; letter-spacing: -.03em; }
h3 { font-size: 1.25rem; font-weight: 620; line-height: 1.25; letter-spacing: -.012em; }
h4 { font-size: 1rem; font-weight: 620; }
.eyebrow { margin-bottom: 1rem; font-size: clamp(1rem, 1.3vw, 1.2rem); font-weight: 600; color: var(--accent); }
.lead { font-size: clamp(1.15rem, 1.6vw, 1.4rem); line-height: 1.55; color: var(--muted); }
.prose { max-width: var(--measure); margin-inline: auto; text-align: center; }
.prose p { color: var(--muted); font-size: 1.125rem; line-height: 1.7; }
.prose p + p { margin-top: 1.2rem; }
.fine { margin: 2.5rem auto 0; max-width: var(--measure); text-align: center; color: var(--quiet); font-size: .92rem; line-height: 1.6; }

/* Header ------------------------------------------------------------------ */
.site-header { container-type: inline-size; position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top); background: var(--paper); border-bottom: 1px solid var(--line); }
.head { height: var(--header); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1.5rem; }
.brand-group { display: inline-flex; align-items: center; gap: .55rem; white-space: nowrap; min-width: 0; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-size: 1.2rem; font-weight: 640; letter-spacing: -.015em; line-height: 1; }
.brand .mark { width: 1.6rem; height: 1.6rem; }
.brand-separator { color: var(--line-2); font-size: 1.35rem; font-weight: 300; line-height: 1; }
.brand-separator, .brand-product { transition: opacity .3s ease, translate .4s cubic-bezier(.2, .7, .2, 1), visibility 0s; }
.brand-product { transition-delay: .07s; }
/* On a product overview the header names the product only after the large mark in the
   page title has scrolled under it: the slash shows first and the product slides out of it.
   Only opacity and translate change, so the header keeps its size and nothing else repaints. */
.js .site-header[data-brand-reveal]:not([data-brand-shown]) :is(.brand-separator, .brand-product) {
  opacity: 0; visibility: hidden; transition-delay: 0s, 0s, .4s;
}
.js .site-header[data-brand-reveal]:not([data-brand-shown]) .brand-separator { translate: -.25rem 0; }
.js .site-header[data-brand-reveal]:not([data-brand-shown]) .brand-product { translate: -.8rem 0; }
@media (prefers-reduced-motion: reduce) {
  .brand-separator, .brand-product { translate: none !important; transition: opacity .15s, visibility 0s; }
}
.main-nav { display: flex; align-items: center; gap: 1.75rem; }
.main-nav a { padding: .4rem 0; font-size: .9rem; font-weight: 500; color: var(--muted); }
.main-nav a:hover, .main-nav a[aria-current="location"] { color: var(--ink); }
.head-actions { display: flex; align-items: center; justify-content: flex-end; gap: .55rem; }
.theme-button, .mobile-menu summary { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 8px; border: 1px solid var(--line); color: var(--muted); }
.theme-button:hover, .mobile-menu summary:hover { color: var(--ink); border-color: var(--line-2); }
.theme-button .icon:last-child, [data-theme="dark"] .theme-button .icon:first-child { display: none; }
[data-theme="dark"] .theme-button .icon:last-child { display: block; }
.languages { display: flex; padding: 2px; border: 1px solid var(--line); border-radius: 8px; }
.languages a { padding: .36rem .55rem; border-radius: 6px; font: 500 .74rem/1 var(--font-mono); color: var(--muted); }
.languages a:hover { color: var(--ink); }
.languages a[aria-current] { background: var(--ink); color: var(--paper); }
.mobile-menu { display: none; }
.mobile-menu summary { list-style: none; }
.mobile-menu summary::-webkit-details-marker { display: none; }
.mobile-menu summary .icon:last-child, .mobile-menu[open] summary .icon:first-child { display: none; }
.mobile-menu[open] summary .icon:last-child { display: block; }
.mobile-menu nav { position: absolute; inset: 100% 0 auto; display: grid; max-height: calc(100vh - var(--header-height, var(--header))); max-height: calc(100dvh - var(--header-height, var(--header))); overflow-y: auto; overscroll-behavior: contain; padding: .5rem var(--gutter) max(.75rem, env(safe-area-inset-bottom)); padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); background: var(--paper); border-bottom: 1px solid var(--line); }
.mobile-menu nav a { padding: .9rem 0; font-size: 1.05rem; font-weight: 560; border-bottom: 1px solid var(--line); }
.mobile-menu nav a:last-child { border-bottom: 0; }
.mobile-menu nav a[aria-current="location"] { color: var(--accent); }

/* Buttons ----------------------------------------------------------------- */
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin-top: 2.25rem; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.9rem; padding: .7rem 1.3rem;
  border-radius: 8px; font-size: 1rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent;
  transition: background-color .15s, border-color .15s;
}
.button-accent { background: var(--accent-fill); color: var(--on-accent); }
.button-accent:hover { background: color-mix(in oklab, var(--accent-fill) 85%, var(--ink)); }
.button-ghost { border-color: var(--line-2); color: var(--ink); }
.button-ghost:hover { border-color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chips li { padding: .28rem .6rem; border: 1px solid var(--line); border-radius: 6px; font: 500 .78rem/1.3 var(--font-mono); color: var(--muted); }

/* Panels ------------------------------------------------------------------ */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); }

/* Hero: one centred statement, then the picture --------------------------- */
.hero { position: relative; isolation: isolate; padding-block: clamp(4.5rem, 10vw, 8rem) var(--space); }
/* A faint drafting grid behind the opening statement. */
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px; background-position: center top;
  -webkit-mask-image: radial-gradient(ellipse 62rem 30rem at 50% 0, #000 20%, transparent 80%);
  mask-image: radial-gradient(ellipse 62rem 30rem at 50% 0, #000 20%, transparent 80%);
  opacity: .55;
}
.hero-layout { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: clamp(3.5rem, 7vw, 5.5rem); }
.hero-copy { display: grid; justify-items: center; text-align: center; max-width: 60rem; }
.hero h1 em { display: block; font-style: normal; color: var(--accent); }
.hero .eyebrow { color: var(--muted); }
.hero-lead { margin-top: 1.75rem; max-width: 40rem; color: var(--muted); font-size: clamp(1.15rem, 1.7vw, 1.4rem); line-height: 1.55; }
.hero-product h1 { display: grid; justify-items: center; gap: 1.1rem; }
.h1-name { display: inline-flex; align-items: center; gap: .18em; font-size: clamp(3.4rem, 8vw, 6.5rem); color: var(--ink); }
.h1-mark { width: .8em; height: .8em; }
.h1-tag { max-width: 30ch; font-size: clamp(1.5rem, 2.8vw, 2.4rem); line-height: 1.15; letter-spacing: -.022em; font-weight: 600; color: var(--ink-2); }
.hero-art, .dossier-art { width: 100%; max-width: var(--wide); min-width: 0; padding: clamp(1rem, 2vw, 1.5rem); }
.hero-art figcaption, .dossier-art figcaption { display: flex; gap: 1rem; align-items: flex-start; margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .92rem; line-height: 1.5; }
.hero-art figcaption > span, .dossier-art figcaption > span { flex: 1; }
.hero-art .expand, .dossier-art .expand { flex: none; padding: 0; }

/* Statement and highlights --------------------------------------------------- */
.statement-text { max-width: 58rem; margin-inline: auto; text-align: center; font-size: clamp(1.7rem, 3.4vw, 2.9rem); font-weight: 600; line-height: 1.22; letter-spacing: -.028em; color: var(--muted); text-wrap: balance; }
.statement-text strong { color: var(--ink); font-weight: 650; }
.highlight-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: var(--wide); margin-inline: auto; text-align: center; }
.highlight-list li { display: grid; justify-items: center; align-content: start; gap: .7rem; padding: .5rem clamp(1rem, 3vw, 2.5rem); }
.highlight-list li + li { border-left: 1px solid var(--line-2); }
.highlight-icon { color: var(--ink-2); margin-bottom: .3rem; }
.highlight-list h3 { font-size: clamp(1.3rem, 1.9vw, 1.6rem); letter-spacing: -.02em; }
.highlight-list p { max-width: 21rem; color: var(--muted); font-size: 1rem; line-height: 1.55; }

/* Sections ---------------------------------------------------------------- */
.section { padding-block: var(--space); }
.tonal { background: var(--paper-2); }
.section-head { max-width: 52rem; margin: 0 auto clamp(3rem, 6vw, 5rem); text-align: center; }
.section-head .lead { max-width: 40rem; margin: 1.4rem auto 0; }
.split .section-head { margin-bottom: 2.5rem; }
.split > .prose, .split > div:not(.section-head) { margin-inline: auto; }
.sub-heading { margin: var(--space) auto 2.5rem; text-align: center; font-size: clamp(1.6rem, 2.6vw, 2.2rem); letter-spacing: -.025em; }

/* Cards ------------------------------------------------------------------- */
/* Every block of content shares one measure, so the edges line up down the page. */
.cards, .service-steps, .tiers, .stages, .proofs, .pipeline { max-width: var(--wide); margin-inline: auto; }
.cards { display: grid; gap: 1rem; }
.cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: clamp(3.5rem, 7vw, 5.5rem); }
.cards-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cases { margin-top: clamp(3.5rem, 7vw, 5.5rem); }
.card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .7rem; padding: 1.75rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.card p { color: var(--muted); font-size: 1rem; line-height: 1.6; }
.card-icon { display: block; color: var(--ink-2); margin-bottom: .35rem; }
.card-code { font: 500 .78rem var(--font-mono); color: var(--quiet); }

/* Company home --------------------------------------------------------------- */
.hero-home .hero-copy { width: min(100%, 68rem); max-width: 68rem; }
.hero-home h1 { font-size: clamp(2.35rem, 5.4vw, 4.9rem); }
.hero-home .hero-lead { max-width: 44rem; }

/* Highlights ------------------------------------------------------------------ */
.highlights { padding-block: clamp(3.5rem, 7vw, 6rem); }

/* Values and directions ---------------------------------------------------------- */
.points { display: grid; gap: 2.75rem 2rem; max-width: var(--wide); margin-inline: auto; }
.points-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.points-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.points li { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; align-content: start; gap: .65rem; padding-top: 1.75rem; text-align: center; border-top: 1px solid var(--line-2); }
.point-icon { display: grid; place-items: center; width: 3rem; height: 3rem; margin-bottom: .35rem; border: 1px solid var(--line); border-radius: 50%; background: var(--card); color: var(--ink-2); }
.points h3 { font-size: 1.2rem; }
.points p { max-width: 22rem; color: var(--muted); font-size: 1rem; line-height: 1.6; }
.prose + .points { margin-top: clamp(3rem, 6vw, 4.5rem); }

/* Product cards: on the home page and the product list ------------------------- */
.catalog-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1rem; max-width: var(--wide); margin-inline: auto; }
.catalog-item { grid-column: span 2; display: flex; flex-direction: column; min-width: 0; overflow: hidden; transition: border-color .15s, box-shadow .2s; }
.catalog-item.is-platform { grid-column: span 3; }
.catalog-item:hover, .catalog-item:focus-within { border-color: var(--accent-fill); box-shadow: 0 18px 40px -28px color-mix(in oklab, var(--accent-fill) 80%, transparent); }
.product-card { display: flex; flex: 1; flex-direction: column; }
.product-picture { display: grid; place-items: center; height: clamp(10rem, 15vw, 12.5rem); padding: .75rem; border-bottom: 1px solid var(--line); background: var(--card-2); }
.is-platform .product-picture { height: clamp(12rem, 21vw, 16.5rem); }
.product-picture .diagram { width: 100%; height: 100%; min-height: 0; }
.product-copy { display: flex; flex: 1; flex-direction: column; align-items: center; gap: .55rem; padding: 1.4rem 1.5rem 1.6rem; text-align: center; }
.product-copy .app-kind { flex-direction: row; gap: .5rem; color: var(--muted); font-size: .92rem; }
.product-copy .app-kind .mark { width: 1.5rem; height: 1.5rem; }
.product-copy h2, .product-copy h3 { font-size: clamp(1.35rem, 2vw, 1.75rem); font-weight: 640; letter-spacing: -.02em; }
.product-copy p:not(.app-kind) { max-width: 34rem; color: var(--muted); font-size: 1rem; line-height: 1.55; }
.catalog-detail { display: block; padding: .8rem 1.5rem; border-top: 1px solid var(--line); text-align: center; font-size: .94rem; }
.catalog-detail:hover { color: var(--accent); text-decoration: underline; text-underline-offset: .2em; }

/* Compact product row on the home page: wraps and stays centred as the line grows. */
.product-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; max-width: var(--wide); margin-inline: auto; }
.product-tiles > li { display: flex; flex: 1 1 12.5rem; max-width: 15rem; min-width: 0; }
.product-tile { display: grid; flex: 1; justify-items: center; align-content: start; gap: .35rem; padding: 1.6rem 1rem 1.4rem; text-align: center; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); transition: border-color .15s, translate .2s, box-shadow .2s; }
.product-tile:hover { border-color: var(--accent-fill); translate: 0 -2px; box-shadow: 0 14px 30px -22px color-mix(in oklab, var(--accent-fill) 80%, transparent); }
.product-tile .mark { width: 2.6rem; height: 2.6rem; margin-bottom: .55rem; }
.product-tile strong { font-size: 1.1rem; font-weight: 620; letter-spacing: -.015em; line-height: 1.25; }
.product-tile small { color: var(--muted); font-size: .9rem; line-height: 1.4; }
@media (max-width: 40rem) { .product-tiles > li { flex-basis: 9.5rem; } }
@media (prefers-reduced-motion: reduce) { .product-tile:hover { translate: none; } }

/* Ways in at the end of the home page ------------------------------------------------- */
.section-head + .cards { margin-top: 0; }
.doors > li { display: flex; min-width: 0; }
.door { flex: 1; transition: border-color .15s; }
.door:hover { border-color: var(--accent-fill); }
.door-action { display: inline-flex; align-items: center; gap: .35rem; margin-top: auto; padding-top: .5rem; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.door:hover .door-action { color: var(--accent); }

/* About and closing ----------------------------------------------------------- */
.about-grid { display: grid; justify-items: center; text-align: center; }
.about-lead { max-width: 56rem; }
.mission-lead { margin-top: 2rem; font-size: clamp(1.5rem, 2.8vw, 2.4rem); line-height: 1.3; letter-spacing: -.02em; color: var(--ink-2); font-weight: 500; }
.about-text { margin-top: 3rem; }
.closing-panel { display: grid; justify-items: center; gap: 2.5rem; text-align: center; }
.closing-copy { max-width: 40rem; }
.closing-copy p { margin-top: 1rem; color: var(--muted); font-size: 1.15rem; }
.cross-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; width: 100%; max-width: 52rem; text-align: left; }
.cross-card { display: flex; align-items: center; gap: 1rem; padding: 1.25rem 1.4rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); transition: border-color .15s; }
.cross-card:hover { border-color: var(--accent-fill); }
.cross-card .mark { width: 2.5rem; height: 2.5rem; }
.cross-copy { display: grid; flex: 1; }
.cross-copy strong { font-size: 1.2rem; letter-spacing: -.02em; }
.cross-copy span { color: var(--muted); font-size: .92rem; }
.cross-card > .icon { color: var(--quiet); }

/* Lexbor ------------------------------------------------------------------------- */
.split .prose { margin-inline: auto; }
.tiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.tier { position: relative; padding: 1.75rem; padding-top: 7rem; text-align: center; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.tier-ring { position: absolute; top: 1.5rem; left: 50%; translate: -50% 0; width: 4rem; height: 4rem; border-radius: 50%; border: 1.5px dashed var(--line-2); display: grid; place-items: center; }
.tier-ring::before, .tier-ring::after { content: ""; position: absolute; border-radius: 50%; }
.tier-ring::after { width: 2.4rem; height: 2.4rem; border: 1.5px dashed var(--line-2); }
.tier-ring::before { width: .95rem; height: .95rem; background: var(--ink-2); z-index: 1; }
.tier-2 .tier-ring::after, .tier-3 .tier-ring::after { border-style: solid; border-color: var(--ink-2); }
.tier-3 .tier-ring { border-style: solid; border-color: var(--ink-2); }
.tier-code { font-size: .85rem; font-weight: 600; color: var(--quiet); margin-bottom: .45rem; }
.tier h3 { font-size: 1.35rem; }
.tier > p:last-child { margin-top: .6rem; color: var(--muted); font-size: 1rem; }

.stages { display: grid; gap: 1rem; }
.stages-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stages-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: clamp(3.5rem, 7vw, 5.5rem); }
.stage { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 1.75rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); }
.stage-top { display: flex; justify-content: center; margin-bottom: 1.25rem; }
.stage-num { display: none; }
.stage-icon { display: block; color: var(--ink-2); }
.stage-code { font: 500 .82rem var(--font-mono); color: var(--quiet); margin-bottom: .45rem; }
.stage h3 { font-size: 1.3rem; }
.stage h3 + p { margin-top: .65rem; color: var(--muted); font-size: 1rem; line-height: 1.6; }


.app-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin: -1.5rem 0 3.5rem; }
.app-tabs a { display: inline-flex; align-items: center; gap: .5rem; padding: .55rem .9rem .55rem .65rem; border-radius: 8px; border: 1px solid var(--line); background: var(--card); font-weight: 580; font-size: .95rem; transition: border-color .15s; }
.app-tabs a:hover { border-color: var(--accent-fill); }
.app-tabs .mark { width: 1.35rem; height: 1.35rem; }
.apps { display: grid; gap: clamp(5rem, 10vw, 8rem); }
.application { display: grid; justify-items: center; gap: clamp(2.5rem, 5vw, 3.5rem); }
.app-copy { display: grid; justify-items: center; text-align: center; max-width: 46rem; }
.app-kind { display: flex; flex-direction: column; align-items: center; gap: .75rem; font-size: 1rem; font-weight: 600; color: var(--muted); }
.app-kind .mark { width: 3.5rem; height: 3.5rem; }
.app-copy h3 { margin: .6rem 0 1.25rem; font-size: clamp(2rem, 3.8vw, 3.1rem); letter-spacing: -.03em; font-weight: 640; line-height: 1.08; }
.ticks { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem 1.75rem; margin-top: 1.75rem; }
.ticks li { display: flex; align-items: flex-start; gap: .5rem; font-size: .98rem; color: var(--ink-2); }
.ticks .icon { margin-top: .22rem; color: var(--quiet); }
.app-art { width: 100%; max-width: var(--wide); padding: 1rem; min-width: 0; background: var(--card); }

.media-story { display: grid; justify-items: center; gap: clamp(3rem, 6vw, 4.5rem); }
.story-text { order: -1; display: grid; justify-items: center; text-align: center; max-width: 52rem; }
.story-text h2 { margin-bottom: 1.5rem; }
.story-art { width: 100%; max-width: var(--wide); padding: 1rem; min-width: 0; }

/* Vodka -------------------------------------------------------------------------- */
.pipeline { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 1.6rem; }
.pipe { position: relative; text-align: center; padding: 1.3rem 1.25rem 1.4rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); }
.pipe:not(:last-child)::after { content: ""; position: absolute; top: 50%; right: -1.25rem; width: .9rem; height: .9rem; translate: 0 -50%; background: var(--line-2); clip-path: polygon(0 15%, 70% 50%, 0 85%, 15% 50%); }
.pipe-file .pipe-code::before { content: ""; display: inline-block; width: .62rem; height: .78rem; margin-right: .45rem; vertical-align: -.08rem; border: 1.5px solid currentColor; border-radius: 2px 5px 2px 2px; opacity: .8; }
.pipe-code { font: 600 .82rem var(--font-mono); color: var(--quiet); margin-bottom: .75rem; }
.pipe h3 { font-size: 1.1rem; }
.pipe h3 + p { margin-top: .35rem; color: var(--muted); font-size: .92rem; line-height: 1.5; }


.arch-grid { display: grid; justify-items: center; gap: clamp(3rem, 6vw, 4.5rem); }
.stack { display: grid; gap: .5rem; width: 100%; max-width: var(--wide); }
.layer { position: relative; display: grid; justify-items: center; gap: .9rem; padding: 1.4rem 1.5rem; text-align: center; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); }
.layer-app { --layer: var(--quiet); }
.layer-genuine { --layer: var(--blue); }
.layer-floor { --layer: var(--vodka-fill); background: color-mix(in oklab, var(--vodka-fill) 4%, var(--card)); }
.layer-primitive { --layer: var(--vodka-fill); background: color-mix(in oklab, var(--vodka-fill) 7%, var(--card)); }
.layer-host { --layer: var(--ink); background: var(--paper-2); }
.layer-label { font-size: .8rem; font-weight: 600; color: var(--quiet); }
.layer-floor .layer-label, .layer-primitive .layer-label { color: var(--vodka); }
.layer h3 { margin-top: .2rem; font-size: 1.15rem; }
.layer-meta > p:last-child { margin-top: .25rem; color: var(--muted); font-size: .92rem; line-height: 1.45; }
.layer-items { display: flex; flex-wrap: wrap; gap: .3rem; justify-content: center; }
.layer-items li { padding: .26rem .5rem; border-radius: 6px; border: 1px solid var(--line); background: var(--card); font: 500 .76rem var(--font-mono); color: var(--ink-2); }

.proofs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.proof { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 1.75rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); }
.proof-icon { display: block; color: var(--ink-2); margin-bottom: 1.1rem; }
.proof-area { font-size: .82rem; font-weight: 600; color: var(--quiet); }
.proof h3 { margin-top: .3rem; font-size: 1.2rem; }
.proof h3 + p { margin-top: .5rem; color: var(--muted); font-size: .98rem; line-height: 1.55; }

/* Stories ----------------------------------------------------------------------- */
.story-points { margin-top: 0; }
.approaches { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; max-width: var(--wide); margin-inline: auto; }
.approach { display: grid; justify-items: center; text-align: center; align-content: start; gap: .6rem; padding: 1.75rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); }
.approach h3 { font-size: 1.3rem; }
.approach p { color: var(--muted); font-size: 1rem; line-height: 1.6; }
.approach-ours { border: 2px solid var(--accent-fill); background: var(--accent-soft); }
.approach-ours h3 { color: var(--accent); }
.compare-text { margin: clamp(3rem, 6vw, 4.5rem) auto 0; }

/* Services -------------------------------------------------------------------- */
.service-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.service { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: .7rem; padding: 1.75rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); }
.service-step { display: none; }
.service p { color: var(--muted); font-size: 1rem; line-height: 1.6; }

/* Worlds and tools -------------------------------------------------------------- */
.world-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.5rem 2rem; max-width: var(--wide); margin-inline: auto; }
.world-list li { display: grid; justify-items: center; text-align: center; align-content: start; gap: .6rem; padding-top: 1.25rem; border-top: 1px solid var(--line-2); }
.world-icon { display: block; color: var(--ink-2); }
.world-list h3 { font-size: 1.2rem; }
.world-list p { color: var(--muted); font-size: 1rem; line-height: 1.6; }
.worlds-media { display: grid; justify-items: center; gap: 2rem; margin-top: clamp(4rem, 8vw, 6rem); }
.worlds-media .story-art { order: -1; }

/* Contacts and documents ---------------------------------------------------------- */
.section-cta { margin-top: clamp(2.5rem, 5vw, 3.5rem); text-align: center; }
.contact .contact-mail { margin-top: auto; padding-top: .6rem; font-weight: 600; color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: .25em; }
.contact .contact-mail:hover { text-decoration-color: currentColor; }
.requisites { max-width: 44rem; margin: clamp(3rem, 6vw, 4.5rem) auto 0; padding: clamp(1.25rem, 3vw, 2rem); text-align: center; }
.requisites h2 { font-size: 1.25rem; letter-spacing: -.015em; }
.requisites p { margin-top: .4rem; color: var(--muted); }
.requisites dl { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem 2rem; margin-top: .9rem; }
.requisites dl div { display: flex; gap: .45rem; }
.requisites dt { color: var(--quiet); }
.requisites dd { font-family: var(--font-mono); font-size: .92rem; color: var(--ink-2); }
.foot-details { flex-basis: 100%; order: 5; color: var(--quiet); font-size: .8rem; }
.foot-mail a { font-size: .9rem; }
.doc { max-width: 44rem; margin-inline: auto; }
.doc h1 { font-size: clamp(2.2rem, 4.2vw, 3.2rem); }
.doc .doc-date { margin-top: 1rem; color: var(--quiet); }
.doc section { margin-top: 2.75rem; }
.doc h2 { font-size: 1.35rem; letter-spacing: -.015em; }
.doc section p { margin-top: .75rem; color: var(--muted); font-size: 1.06rem; line-height: 1.7; }
.not-found { min-height: 60vh; display: grid; align-items: center; }

/* Galleries and diagrams --------------------------------------------------------- */
.slider { min-width: 0; }
.slides { display: flex; position: relative; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: thin; border-radius: var(--radius); }
.slider[data-ready] .slides { scrollbar-width: none; }
.slider[data-ready] .slides::-webkit-scrollbar { display: none; }
.slide { position: relative; flex: 0 0 100%; min-width: 0; display: grid; place-items: center; scroll-snap-align: start; }
.slide > img, .slide > .diagram { width: 100%; height: 100%; object-fit: contain; }
.gallery-full .slide { aspect-ratio: 16 / 10; }
.slide img { border-radius: 8px; }
.slide figcaption { position: absolute; left: .8rem; bottom: .8rem; padding: .3rem .6rem; border-radius: 6px; background: var(--card); color: var(--ink-2); font-size: .82rem; font-weight: 560; }
.slider-tools { display: none; }
.slider[data-ready] .slider-tools { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; padding-top: .9rem; }
.slider-tools button:not(.expand) { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 8px; border: 1px solid var(--line); background: var(--card); }
.slider-tools button:not(.expand):hover { border-color: var(--line-2); }
.slider-tools output { min-width: 3rem; text-align: center; font: 500 .8rem var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.slider-tools .expand { margin-right: auto; }
.expand { display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .2rem; color: var(--muted); font-size: .88rem; font-weight: 540; }
.expand:hover { color: var(--ink); }
.empty-screen { height: 100%; width: 100%; display: grid; align-content: center; justify-items: center; gap: .9rem; border-radius: 8px; border: 1px solid var(--line); color: var(--quiet); font-size: .86rem; background: var(--paper-2); }
.empty-screen .mark { width: 3rem; height: 3rem; }
.diagram { display: block; width: 100%; height: auto; }
.hero-diagram { min-width: 0; container-type: inline-size; }
.hero-diagram > .compact-scheme { display: none; }
@container (max-width: 40rem) {
  .hero-diagram > .diagram:not(.compact-scheme) { display: none; }
  .hero-diagram > .compact-scheme { display: block; width: min(100%, 25rem); margin-inline: auto; }
}
.no-js [data-expand], .no-js .theme-button { display: none; }
.diagram-filters { display: flex; flex-wrap: wrap; gap: .25rem; margin: 0 auto 1.1rem; padding: 3px; border-radius: 8px; background: var(--paper-2); border: 1px solid var(--line); width: fit-content; max-width: 100%; }
.diagram-filters button { padding: .42rem .85rem; border-radius: 6px; color: var(--muted); font-size: .88rem; font-weight: 560; line-height: 1.2; }
.diagram-filters button:hover { color: var(--ink); }
.diagram-filters button[aria-pressed="true"] { background: var(--card); color: var(--path-ink, var(--accent)); box-shadow: 0 0 0 1px var(--line); }
.diagram-filters [data-path="script"], .diagram [data-circuit="script"] { --path-ink: var(--designer); --diagram-accent: var(--designer); --diagram-fill: color-mix(in oklab, var(--designer) 13%, var(--card)); }
.diagram-filters [data-path="media"], .diagram [data-circuit="media"] { --path-ink: var(--browser); --diagram-accent: var(--browser); --diagram-fill: color-mix(in oklab, var(--browser) 13%, var(--card)); }
.diagram .context-muted { opacity: .22; }
[data-explore] .diagram [data-pick], #viewer .diagram [data-pick] { cursor: pointer; }
@media (scripting: none) { [data-explore] .diagram [data-pick] { cursor: default; } }
.diagram-note { margin-top: .8rem; padding-top: .75rem; border-top: 1px solid var(--line); min-height: 3.2em; color: var(--muted); font-size: .9rem; line-height: 1.5; }

/* Viewer --------------------------------------------------------------------------- */
#viewer { width: min(94vw, 90rem); max-width: none; max-height: 94dvh; padding: 0; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); }
#viewer[open] { display: flex; flex-direction: column; }
#viewer::backdrop { background: rgb(8 11 14 / .72); }
.viewer-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem; padding: .7rem; border-bottom: 1px solid var(--line); flex: none; }
.viewer-bar > button { display: inline-flex; align-items: center; gap: .4rem; padding: .48rem .9rem; border-radius: 8px; border: 1px solid var(--line); font-size: .88rem; font-weight: 560; }
.viewer-bar > button:hover { border-color: var(--line-2); }
.viewer-bar [aria-pressed="true"] { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.viewer-pages { display: inline-flex; align-items: center; gap: .5rem; margin-right: auto; }
.viewer-pages button { display: grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: 8px; border: 1px solid var(--line); }
.viewer-pages output { min-width: 2.6rem; text-align: center; font: 500 .82rem var(--font-mono); color: var(--muted); }
.viewer-guide { padding: .9rem 1rem 0; }
.viewer-guide .diagram-filters { margin-bottom: .2rem; }
.viewer-stage { flex: 1 1 auto; min-height: 0; display: flex; overflow: auto; overscroll-behavior: contain; }
.viewer-media { flex: none; margin: auto; width: fit-content; padding: 1rem; max-width: 100%; }
.viewer-media > * { display: block; width: auto; height: auto; max-width: 100%; max-height: calc(90dvh - 6rem); margin: auto; }
.viewer-media .diagram { width: min(76rem, 88vw); max-height: calc(90dvh - 12rem); }
#viewer[data-zoomed] .viewer-media, #viewer[data-zoomed] .viewer-media > * { max-width: none; max-height: none; }
#viewer[data-zoomed] .diagram { width: var(--media-native-width, auto); }
.viewer-note { padding: .8rem 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }

/* Footer ----------------------------------------------------------------------- */
.site-footer { --accent: var(--vodka); --accent-fill: var(--vodka-fill); border-top: 1px solid var(--line); background: var(--paper-2); padding-top: clamp(3.5rem, 6vw, 5rem); padding-bottom: env(safe-area-inset-bottom); }
.foot-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(4, minmax(0, 1fr)); gap: 2rem; }
.foot-brand .brand { font-size: 1.3rem; }
.foot-brand p { margin-top: 1rem; color: var(--muted); font-size: .92rem; max-width: 32ch; }
.foot-col h2 { font-size: .82rem; font-weight: 600; letter-spacing: 0; color: var(--quiet); margin-bottom: .9rem; }
.foot-col ul { display: grid; gap: .55rem; }
.foot-col a { display: inline-flex; align-items: center; gap: .5rem; color: var(--ink-2); font-size: .93rem; }
.foot-col a:hover { color: var(--accent); }
.foot-col .mark { width: 1.1rem; height: 1.1rem; }
.foot-base { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.75rem; margin-top: clamp(2.5rem, 5vw, 3.5rem); padding-block: 1.4rem; border-top: 1px solid var(--line); color: var(--quiet); font-size: .85rem; }
.foot-base a:hover { color: var(--ink); }
.foot-base .top { display: inline-flex; align-items: center; gap: .35rem; color: var(--ink-2); font-weight: 560; }
.foot-langs { display: inline-flex; flex-wrap: wrap; gap: .4rem 1.1rem; margin-left: auto; }
.foot-langs a[aria-current] { color: var(--ink-2); font-weight: 560; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
html:has(#viewer[open]) { overflow: hidden; }

/* Responsive -------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .head { grid-template-columns: auto 1fr; }
  .main-nav { display: none; }
  .mobile-menu { display: block; }
  .cards-4, .service-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pipe:nth-child(2)::after { display: none; }
  .stages-6, .stages-4, .proofs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .world-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .foot-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .foot-brand { grid-column: 1 / -1; }
  .points-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .cards-3, .tiers, .cross-grid { grid-template-columns: minmax(0, 1fr); }
  .highlight-list { grid-template-columns: minmax(0, 1fr); gap: 2.75rem; }
  .highlight-list li + li { border-left: 0; }
  .approaches { grid-template-columns: minmax(0, 1fr); }
  .points-3 { grid-template-columns: minmax(0, 1fr); }
  .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-item, .catalog-item.is-platform { grid-column: auto; }
  .catalog-item:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (max-width: 44rem) {
  .catalog-grid { grid-template-columns: minmax(0, 1fr); }
  .catalog-item:last-child:nth-child(odd) { grid-column: auto; }
}
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .head { gap: .75rem; }
  .brand { font-size: 1.08rem; gap: .4rem; }
  .brand .mark { width: 1.4rem; height: 1.4rem; }
  .brand-group { gap: .4rem; }
  .brand-separator { font-size: 1.15rem; }
  .theme-button, .mobile-menu summary { width: 2.15rem; height: 2.15rem; }
  .languages a { padding: .34rem .45rem; }
  .head-actions { gap: .4rem; }
  .cards-4, .stages-6, .stages-4, .proofs, .pipeline, .service-steps, .world-list, .points-4 { grid-template-columns: minmax(0, 1fr); }
  .pipeline { gap: 1.4rem; }
  .pipe:not(:last-child)::after { display: block !important; top: auto; bottom: -1.2rem; right: auto; left: 50%; translate: -50% 0; rotate: 90deg; }
  .tm-row { grid-template-columns: minmax(0, 1fr); gap: .45rem; }
  .tm-label { justify-self: start; }
  .tm-cells { grid-template-columns: minmax(0, 1fr); }
  .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .foot-base .top, .foot-langs { margin-left: 0; }
  .hero-actions .button { flex: 1 1 100%; }
}
@media (max-width: 380px) {
  .brand-company span { display: none; }
  .site-ampirs .brand-company span { display: inline; }
}
@media print {
  .site-header, .slider-tools, .diagram-filters, #viewer, .closing { display: none !important; }
  body { background: #fff; }
}

/* Keep the complete company / product wordmark in the same header at phone widths. */
.menu-tools, .menu-tools .theme-button { display: none; }
.main-nav a[aria-current="page"], .mobile-menu nav a[aria-current="page"] { color: var(--ink); }
@container (max-width: 65rem) {
  .head { grid-template-columns: minmax(0,1fr) auto; }
  .head .main-nav { display: none; }
  .head .mobile-menu { display: block; }
}
@container (max-width: 34rem) {
  .head { height: auto; min-height: var(--header); padding-block: .3rem; gap: .4rem; }
  .head .brand-company span { display: inline; }
  .brand-group { flex-wrap: wrap; gap: .15rem .3rem; }
  .head .brand { min-width: 0; max-width: 100%; gap: .25rem; font-size: 1rem; white-space: normal; overflow-wrap: anywhere; }
  .head .brand .mark { flex-shrink: 0; }
  .head-actions > .theme-button, .head-actions > .languages { display: none; }
  .mobile-menu .menu-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem; }
  .menu-languages { display: flex; gap: .5rem; }
  .mobile-menu nav .menu-languages a { display: grid; min-width: 2.75rem; min-height: 2.75rem; padding: .4rem; place-items: center; border: 0; }
  .menu-languages a[aria-current] { color: var(--accent); }
  .js .menu-tools .theme-button { display: grid; }
}
@container (max-width: 23.75rem) {
  .head { padding-left: max(.6rem, env(safe-area-inset-left)); padding-right: max(.6rem, env(safe-area-inset-right)); gap: .25rem; }
  .head .brand { font-size: .94rem; gap: .22rem; }
  .brand-group { gap: .15rem .22rem; }
}
@container (min-width: 68.8125rem) {
  .product-header .head { grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr); }
}
@media (max-width: 64rem) {
  .project-dossier, .project-dossier .card-copy { grid-template-columns: minmax(0, 1fr); min-width: 0; width: 100%; }
  .project-facts { grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); }
}
@media (max-width: 40rem) {
  .dossier-product { flex-wrap: wrap; }
  .dossier-kind { flex-basis: 100%; border-left: 0; padding-left: 0; margin-left: 0; }
  .doc h1 { font-size: clamp(1.7rem, 5.5vw, 2.6rem); overflow-wrap: anywhere; }
  .hero-art figcaption, .dossier-art figcaption { flex-direction: column; align-items: start; }
}

/* Reflow long labels and balance spacing on smaller screens. */
.hero-copy, .about-grid > *, .foot-grid > *, .viewer-bar > * { min-width: 0; }
:where(h1, h2, h3, h4, p, li, dt, dd, figcaption, .card, .foot-base, .foot-col a) { overflow-wrap: anywhere; }
@media (max-width: 53.75rem) {
  :root { --space: clamp(3.5rem, 8.5vw, 5.5rem); }
  .cards-3 { grid-template-columns: minmax(0, 1fr); max-width: 36rem; }
  .hero-layout { gap: clamp(1.75rem, 6vw, 3.25rem); }
  .section-head { margin-bottom: clamp(1.75rem, 5vw, 3rem); }
}
@media (max-width: 40rem) {
  .hero { padding-block: clamp(2.5rem, 8vw, 4.25rem) var(--space); }
  h2 { font-size: clamp(1.7rem, 6vw, 2.35rem); }
  .hero-actions { margin-top: 1.5rem; }
  .button { max-width: 100%; white-space: normal; text-align: center; }
  .foot-grid { gap: 1.75rem 1rem; }
  .foot-col a { max-width: 100%; }
  .foot-base { gap: .6rem 1rem; }
  .foot-details { line-height: 1.6; }
  .hero-art, .dossier-art { padding: clamp(.7rem, 2.8vw, 1rem); }
}
@media (pointer: coarse), (max-width: 48rem) {
  .theme-button, .mobile-menu summary, .slider-tools button:not(.expand), .viewer-pages button { min-width: 2.75rem; min-height: 2.75rem; }
  .languages a { display: grid; place-items: center; min-width: 2.25rem; min-height: 2.5rem; }
  .expand, .diagram-filters button, .viewer-bar > button { min-height: 2.75rem; }
  .diagram-filters { justify-content: center; }
}
@media (max-width: 20rem) {
  :root { --gutter: min(1rem, 5vw); }
  .head { gap: .35rem; }
  .head-actions { gap: .25rem; }
  .languages a { min-width: 2rem; }
}

/* An expanded image gets the available screen, including in landscape. */
@media (max-width: 48rem), (max-height: 32rem) {
  #viewer { inset: 0; width: 100%; height: 100vh; height: 100dvh; max-height: none; margin: 0; border: 0; border-radius: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
  .viewer-stage { container-type: size; flex: 1 1 0; }
  .viewer-media { width: 100%; padding: .6rem; }
  .viewer-media > *, .viewer-media .diagram { max-height: calc(100cqh - 1.2rem); }
  .viewer-media .diagram { width: 100%; }
  #viewer[data-zoomed] .viewer-media { width: max-content; }
  .viewer-bar { padding: .5rem; }
  .viewer-guide { padding: .4rem .6rem 0; }
  .viewer-note { overflow-y: auto; max-height: 25dvh; padding: .6rem .9rem; }
}
@media (max-width: 30rem) {
  .viewer-pages { order: 1; width: 100%; margin: 0; justify-content: center; }
}
@media (orientation: landscape) and (max-height: 32rem) and (min-width: 32rem) {
  #viewer[open]:has(.viewer-guide:not([hidden])) { display: grid; grid-template-columns: minmax(0,1fr) minmax(12rem,30%); grid-template-rows: auto minmax(0,1fr) auto; }
  #viewer .viewer-bar { grid-column: 1 / -1; }
  #viewer .viewer-stage { grid-area: 2 / 1 / 4 / 2; }
  #viewer .viewer-guide { grid-area: 2 / 2; overflow: auto; }
  #viewer .viewer-note { grid-area: 3 / 2; font-size: .88rem; max-height: 35dvh; }
}
@media (prefers-reduced-motion: reduce) {
  .button, .tm-app, .tm-product, .app-tabs a, .cross-card, .diagram [data-circuit] { transition: none; }
  .tm-product:hover, .tm-app:hover { transform: none; }
}


/* Intrinsic grid tracks must also shrink when the reader enlarges type. */
.hero-copy, .closing-panel, .arch-grid, .stack, .layer, .approach, .world-list li, .highlight-list li { grid-template-columns: minmax(0, 1fr); }
.hero-copy { width: min(100%, 60rem); }
.closing-copy, .cross-copy, .hero-copy h1, .highlight-list li > *, .layer > * { min-width: 0; max-width: 100%; }
.cross-copy { overflow-wrap: anywhere; }
.slider[data-ready] .slider-tools { flex-wrap: wrap; }
.slider-pages { display: inline-flex; align-items: center; gap: .5rem; }
@media (max-width: 40rem) {
  :root { --gutter: clamp(12px, 4.5vw, 1.25rem); }
  .hero-product .h1-name { display: block; max-width: 100%; font-size: clamp(2.1rem, 8vw, 3.4rem); overflow-wrap: anywhere; }
  .h1-name .h1-mark { display: inline-block; vertical-align: -.06em; margin-inline-end: .2em; }
  .cross-card, .approach, .layer { padding: clamp(.7rem, 3.5vw, 1.4rem); }
  .cross-card { flex-wrap: wrap; }
  .cross-copy { flex: 1 1 min(100%, 8rem); }
  .slider-pages { margin-inline-start: auto; }
}

/* Blocks rise into place as they scroll in; only where the browser ties animation to scrolling. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .section-head, .about-grid > *, .prose, .product-tiles > li, .points > li, .cards > li, .catalog-item,
    .service-steps > li, .tiers > li, .stages > li, .proofs > li, .pipeline > li, .highlight-list > li, .world-list > li, .approaches > li {
      animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 30%;
    }
  }
}
@keyframes rise { from { opacity: 0; translate: 0 1.5rem; } to { opacity: 1; translate: 0 0; } }
