/* ============================================================
   HOME SLIDES — the product slides on bir.ch/ (site/src/components/HomeSlides.astro + home-slides.js).
   Ported from our Webflow embed (embed/home-slides-embed.css at 19d45d60, four slides), rebuilt on the system:
   colours are tokens, the buttons are .btn, the slide label is .chip, type is t-* by role (title t-h4 as a card
   title, lead t-para-md as card text), the chat is chat-card.css. Requires: tokens, page, button, patterns,
   chat-card (imported below until the page loads it itself).

   Desktop (992 and up, motion allowed): .hs — a sticky track several screens long; .hs__card pins under the menu.
   The canvas is a 1232-unit frame scaled to the card's width: every fragment is placed in those units (--u, from cqw),
   so the whole scene scales with the card and no size is in px. Phones and tablets (≤ 991) and «reduce motion»:
   .hsm — the four slides as static cards, each collage a sideways scroller (cqw of the collage).
   ============================================================ */

.home-slides {
  --hs-head-gap: var(--space-sm);        /* menu → pinned card (live 20; read by the script, so a plain token) */
  --slide-gap-max: var(--space-md);      /* the most air under the pinned card */
  --slide-gap-bottom: var(--space-md);   /* written by the script: what the screen leaves, capped */
  --slide-split: var(--gap-main);        /* top bar → canvas: the two parts of one card, a grid gap apart */
  --head-cost: calc(var(--pad-card) * 2 + var(--slide-split));
  --hs-chrome-h: var(--nav-height, 0rem);
  --bar-h: 7rem;                         /* written by the script: the tallest bar, so the canvas never jumps */
  --scene-min: 364;                      /* canvas height, design units: the collage's own frame … */
  --scene-max: 550;                      /* … up to the tall frame the keyframes' d:[…] deltas lead to */
  --canvas-force: 364;
}
/* hidden text in the chat really hides (chat-card rows set their own display) */
.home-slides [hidden] { display: none !important; }

/* ── Desktop: the sticky scene ─────────────────────────────── */
.hs {
  --steps: 2;                            /* the script writes the track's length in screens */
  height: calc(var(--steps) * 100dvh);
}
.hs__sticky {
  position: sticky;
  top: calc(var(--hs-chrome-h) + var(--hs-head-gap));
}
.hs__card { --t: 0; --slide-bg: var(--color-accent-blue); --intro-settle: 0.42s; container-type: inline-size; position: relative; }
.hs__head,
.hs__canvas {
  background: var(--slide-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: background-color var(--duration-toggle) var(--ease-toggle);
}
.hs__head { padding-block: var(--pad-card); }

.hs__bars { position: relative; min-height: var(--bar-h); }
.hs__bar {
  --hs-chip-column: 8.5rem;              /* the widest label («Routines» in H4 with the S chip's padding) */
  position: absolute;
  inset-inline: 0;
  top: 0;
  display: grid;
  grid-template-columns: var(--hs-chip-column) minmax(0, 1fr) auto;
  column-gap: var(--gap-md);
  row-gap: var(--gap-heading-small);     /* H4 → its text */
  align-items: start;
  padding-inline: var(--space-xl) var(--pad-card);   /* the pager's column on the left (24 in, 20 wide) */
  pointer-events: none;
}
.hs__bar.is-active { pointer-events: auto; }
.hs__heading { display: grid; grid-column: 1 / 3; grid-template-columns: subgrid; align-items: baseline; }
/* the slide's label: the system's chip (S), its outline in the text colour */
.hs__chip, .hsm__chip { justify-self: start; color: var(--color-text); }
.hs__title, .hsm__title { margin: 0; color: var(--color-text); min-width: 0; text-wrap: balance; }
.hs__lead, .hsm__lead {
  margin: 0;
  color: var(--color-text);   /* live: half-white on the accent — 2.1–3.6:1, under AA on every card; white as the title */
  text-wrap: pretty;
}
.hs__lead { grid-column: 2; grid-row: 2; max-width: var(--measure-lead, 60ch); }
.hs__buttons { grid-column: 3; grid-row: 1 / span 2; justify-self: end; }
/* the yellow button's own hover is Indigo — the AI slide's card colour; on these fills it goes black, as live */
@media (hover: hover) {
  .hs__bar .btn-default:hover { background: var(--color-bg); color: var(--color-text); }
}

/* the bar's parts swap per slide: out quickly, in with the Reveal character, one step apart */
.hs__bar > * {
  opacity: 0;
  translate: 0 var(--space-xs);
  transition: opacity var(--duration-close) var(--ease-close), translate var(--duration-close) var(--ease-close);
}
.hs__bar.is-active > * {
  opacity: 1;
  translate: 0 0;
  transition: opacity var(--duration-reveal) var(--ease-reveal), translate var(--duration-reveal) var(--ease-reveal);
}
.hs__bar.is-active > .hs__heading { transition-delay: calc(var(--reveal-step, 0.12s) * 1.5); }
.hs__bar.is-active > .hs__lead { transition-delay: calc(var(--reveal-step, 0.12s) * 2.2); }
.hs__bar.is-active > .hs__buttons { transition-delay: calc(var(--reveal-step, 0.12s) * 2.9); }

/* Pager: a dot per slide; the active one stretches into a capsule that fills with the slide's progress */
.hs__pager {
  position: absolute;
  left: var(--pad-card);
  inset-block: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xxs);
}
.hs__dot {
  --fill: 0;
  position: relative;
  width: 1.25rem;
  flex: 0 0 1.25rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  cursor: pointer;
  transition: flex-basis var(--duration-toggle) var(--ease-toggle);
}
.hs__dot::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--space-xs);
  height: var(--space-xs);
  translate: -50% -50%;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--color-text) 45%, transparent);
}
.hs__dot::after {   /* the 44 touch area round a small dot */
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  width: 2.75rem;
  height: 2.75rem;
  min-height: 100%;
}
@media (hover: hover) { .hs__dot:hover::before { background: color-mix(in srgb, var(--color-text) 80%, transparent); } }
.hs__dot.is-active { flex: 1 1 0; }
.hs__dot.is-active::before {
  height: 100%;
  background: linear-gradient(180deg, var(--color-text) calc(var(--fill) * 100%), color-mix(in srgb, var(--color-text) 30%, transparent) 0);
}
.hs__dot:focus-visible { outline: var(--border-thin) solid var(--color-text); outline-offset: var(--border-thin); }

/* The canvas: as tall as the screen leaves, between the collage's frame (364) and the tall one (550) */
.hs__canvas {
  --u-w: calc(1cqw / 12.32);
  --cx: 616.5;
  position: relative;
  container-type: size;
  margin-top: var(--slide-split);
  height: clamp(
    calc(var(--scene-min) * var(--u-w)),
    calc(100dvh - var(--hs-chrome-h) - var(--hs-head-gap) - var(--head-cost) - var(--bar-h) - var(--slide-gap-bottom)),
    calc(var(--scene-max) * var(--u-w))
  );
}
/* short screens: the head tightens and the canvas keeps the collage's frame */
@media (min-width: 62rem) and (max-height: 50rem) {
  .home-slides { --slide-split: var(--space-xs); }
  .hs__head { padding-block: var(--space-xs); }
  .hs__canvas { height: calc(var(--canvas-force) * var(--u-w)); }
}

/* A fragment: blended between its two keyframes by --t; positions in design units (--u), plus a share of the
   extra height (--up) the canvas has over 364, toward the tall frame */
.hs__frag {
  --u:  calc(1cqw / 12.32);
  --up: clamp(0rem, (100cqh - 364 * var(--u)), 186 * var(--u));
  --dx: 0; --dy: 0; --dw: 0; --dh: 0;
  --dx2: var(--dx); --dy2: var(--dy); --dw2: var(--dw); --dh2: var(--dh);
  --r: 0; --r2: 0;
  --o1: 1; --o2: 1;
  --px1: calc(var(--x)  * var(--u) + var(--up) * var(--dx)  / 186);
  --px2: calc(var(--x2) * var(--u) + var(--up) * var(--dx2) / 186);
  --py1: calc(var(--y)  * var(--u) + var(--up) * var(--dy)  / 186);
  --py2: calc(var(--y2) * var(--u) + var(--up) * var(--dy2) / 186);
  --pw1: calc(var(--w)  * var(--u) + var(--up) * var(--dw)  / 186);
  --pw2: calc(var(--w2) * var(--u) + var(--up) * var(--dw2) / 186);
  --centre: calc(50cqw - var(--cx) * var(--u));
  position: absolute;
  display: block;
  max-width: none;
  left:   calc((1 - var(--t)) * var(--px1) + var(--t) * var(--px2) + var(--centre));
  top:    calc((1 - var(--t)) * var(--py1) + var(--t) * var(--py2));
  width:  calc((1 - var(--t)) * var(--pw1) + var(--t) * var(--pw2));
  height: auto;
  rotate: calc(((1 - var(--t)) * var(--r) + var(--t) * var(--r2)) * 1deg);
  transform-origin: center;
  opacity: calc(((1 - var(--t)) * var(--o1) + var(--t) * var(--o2)) * var(--lit, 1) * var(--hs-in, 1));
}
.hs__frag--sized {
  --ph1: calc(var(--h)  * var(--u) + var(--up) * var(--dh)  / 186);
  --ph2: calc(var(--h2) * var(--u) + var(--up) * var(--dh2) / 186);
  height: calc((1 - var(--t)) * var(--ph1) + var(--t) * var(--ph2));
}
.hs__frag--ad { border-radius: calc(var(--ad-r) * var(--u)); }
.hs__frag--clip { overflow: hidden; border-radius: calc(16 * var(--u)); }
.hs__frag--nested { --centre: 0rem; transition: filter var(--duration-reveal) var(--ease-reveal); filter: drop-shadow(0 0 0 transparent); }
.hs__frag--clip.is-stacked .hs__frag--nested { filter: drop-shadow(0 calc(6 * var(--u)) calc(18 * var(--u)) color-mix(in srgb, var(--color-bg) 22%, transparent)); }
.hs__frag--logo-lift {
  filter:
    drop-shadow(0 calc(5 * var(--u)) calc(9 * var(--u)) color-mix(in srgb, var(--color-bg) 24%, transparent))
    drop-shadow(0 calc(11 * var(--u)) calc(22 * var(--u)) color-mix(in srgb, var(--color-bg) 18%, transparent));
}
.hs__frag--fade { transition: opacity var(--duration-reveal) var(--ease-reveal); }

/* «Your automated rules»: the window closing round the three rule cards fills blue and gets its title */
.hs__rules-face {
  position: absolute;
  inset: 0;
  background: var(--color-accent-blue);
  opacity: calc((1 - var(--t)) * var(--o1) + var(--t) * var(--o2));
}
.hs__rules-title {
  position: absolute;
  left: calc(21 * var(--u));
  top: calc(18 * var(--u));
  color: var(--color-text);
  font-size: calc(19.2 * var(--u));      /* H5 at the 1232 frame, scaled with the scene */
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  translate: 0 calc(8 * var(--u));
  scale: 0.96;
  transform-origin: left top;
  /* the scene's pop: a hard 120 ms step (its own rhythm, kept from live) */
  transition: opacity 0.12s steps(3, end), translate 0.12s var(--ease-open), scale 0.12s var(--ease-open);
}
.hs__frag--clip.is-closed .hs__rules-title { opacity: 1; translate: 0 0; scale: 1; }

/* The AI chat on the canvas: the system's chat card, sized by its fragment */
.hs__chat .chat-card-wrap,
.hsm__chat .chat-card-wrap { width: 100%; height: 100%; aspect-ratio: auto; }
.hs__chat .chat-card,
.hsm__chat .chat-card { font-size: 4.8cqi; border-radius: 6.67cqi; }
.hs__chat-icon {
  position: absolute;
  left: calc(-67 * var(--u));
  top: 0;
  width: calc(64 * var(--u));
  max-width: none;
  height: auto;
}
.hs__tools { display: grid; grid-template-rows: 1fr; transition: grid-template-rows var(--duration-toggle) var(--ease-toggle), opacity var(--duration-close) var(--ease-close); }
.hs__tools.is-done { grid-template-rows: 0fr; opacity: 0; }
.hs__tools > div { overflow: hidden; }
.hs__tool {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.15em 0;
  color: var(--color-text-grey-inverted);
  opacity: 0;
  transform: scale(0.94);
  transform-origin: left center;
  transition: opacity 0.12s steps(3, end), transform 0.12s var(--ease-open);   /* the scene's pop */
}
.hs__tool.is-on { opacity: 1; transform: none; }
.hs__tool::before { content: ""; width: 0.5em; height: 0.5em; border-radius: 50%; background: currentColor; flex: none; }
.hs__tool.is-live::before { animation: hs-blink 0.9s ease-in-out infinite; }   /* a loop: its own tempo */
@keyframes hs-blink { 50% { opacity: 0.15; } }

/* The sources the chat reads: pictures as backgrounds (the ring needs ::before), rising when lit */
.hs__pic { background-size: 100% 100%; background-repeat: no-repeat; border-radius: calc(var(--ring-r, 16) * var(--u)); }
@property --hs-ring-angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.hs__frag--ring::before {
  content: "";
  position: absolute;
  inset: calc(-3 * var(--u));
  padding: calc(3 * var(--u));
  border-radius: calc((var(--ring-r) + 3) * var(--u));
  background: conic-gradient(from var(--hs-ring-angle),
    var(--color-primary) 0deg, var(--color-accent-light-blue) 90deg,
    var(--color-accent-pink) 180deg, var(--color-primary) 360deg);
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0;
  transition: opacity var(--duration-toggle) var(--ease-toggle);
  pointer-events: none;
}
.hs__frag--ring.is-lit::before { opacity: 1; animation: hs-ring 2.6s linear infinite; }   /* a loop: its own tempo */
.hs__frag--clip.hs__frag--ring::before { inset: 0; border-radius: calc(var(--ring-r) * var(--u)); z-index: 5; }
@keyframes hs-ring { to { --hs-ring-angle: 360deg; } }

/* The first state's entrance: pieces step in one by one (timing in the script, the step here) */
@property --hs-in { syntax: '<number>'; inherits: false; initial-value: 1; }
.hs__frag[data-intro] {
  transition: --hs-in 0.12s steps(3, end), scale var(--intro-settle) var(--ease-open), filter var(--duration-reveal) var(--ease-reveal);
}
.hs__card.is-intro .hs__frag[data-intro]:not(.is-in) { --hs-in: 0; scale: 0.85; }
.hs__card.no-anim .hs__frag[data-intro] { transition: none; }

/* MCP: the logo and the action chips pop in, the dotted line draws itself to the phone */
.hs__pop { scale: 0.92; opacity: 0; transition: opacity 0.12s steps(3, end), scale 0.12s var(--ease-open); }
.hs__pop.is-in { scale: 1; opacity: 1; }
.hs__line {
  height: 0 !important;
  border-top: calc(3 * var(--u)) dotted var(--color-text);
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.7s var(--ease-open);   /* the line's draw, kept from live */
}
.hs__line.is-in { clip-path: inset(0 0 0 0); }

/* The phone: a screenshot of the Claude app with the conversation laid over it in DOM. Its colours are the
   screenshot's own (sampled off the picture, not the site's), its type the app's. */
.hs__phone {
  --ph-ink: #1d1d1f; --ph-bubble: #ececea; --ph-caret: #f0742e; --ph-floor: #f9faf7; --ph-kb-fill: #e0e2e4;
  overflow: hidden;
  border-radius: calc(32 * var(--u));
  font-family: -apple-system, system-ui, "Helvetica Neue", sans-serif;
}
.hs__phone, .hs__phone * { font-weight: 500; }   /* the app's regular, on our scale (live 400) */
.hs__phone > * { position: absolute; }
.hs__phone-shot { display: block; width: 100%; max-width: none; height: auto; }
.hs__ph-msg { left: calc(18 * var(--u)); right: calc(18 * var(--u)); top: calc(96 * var(--u)); height: calc(154 * var(--u)); color: var(--ph-ink);
  display: flex; flex-direction: column; align-items: flex-start; gap: calc(12 * var(--u)); }
.hs__ph-greet { position: absolute; inset: calc(-30 * var(--u)) 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(14 * var(--u)); transition: opacity var(--duration-close) var(--ease-close); }
.hs__ph-greet.is-gone { opacity: 0; }
.hs__ph-star { width: calc(28 * var(--u)); height: auto; }
.hs__ph-title { font-family: "PP Pangaia", "Times New Roman", serif; font-size: calc(14 * var(--u)); letter-spacing: -0.01em; text-align: center; }
.hs__ph-q, .hs__ph-a { font-size: calc(10 * var(--u)); line-height: 1.35; letter-spacing: -0.005em; opacity: 0; translate: 0 calc(10 * var(--u));
  transition: opacity var(--duration-close) var(--ease-open), translate var(--duration-close) var(--ease-open); }
.hs__ph-q { align-self: flex-end; max-width: 78%; display: none; }
.hs__ph-q span { display: block; background: var(--ph-bubble); border-radius: calc(12 * var(--u)); padding: calc(6 * var(--u)) calc(9 * var(--u)); }
.hs__ph-a { display: none; padding-right: calc(6 * var(--u)); }
.hs__ph-q.is-in, .hs__ph-a.is-in { display: block; opacity: 1; translate: 0 0; }
.hs__ph-typed { left: calc(18 * var(--u)); top: calc(251 * var(--u)); width: calc(188 * var(--u)); height: calc(17 * var(--u)); font-size: calc(10 * var(--u)); line-height: calc(17 * var(--u)); color: var(--ph-ink); white-space: nowrap; overflow: hidden; }
.hs__ph-scroll { display: inline-block; white-space: nowrap; }
.hs__ph-caret { display: inline-block; width: calc(1.2 * var(--u)); height: calc(12 * var(--u)); background: var(--ph-caret); vertical-align: -0.15em; margin-left: calc(1 * var(--u)); animation: hs-caret 1s steps(2, end) infinite; }
@keyframes hs-caret { 50% { opacity: 0; } }
.hs__ph-floor { left: 0; right: 0; top: calc(300 * var(--u)); height: calc(210 * var(--u)); background: var(--ph-floor); }
.hs__ph-kb { left: 0; right: 0; top: calc(300 * var(--u)); height: calc(210 * var(--u)); background: var(--ph-kb-fill) var(--ph-kb) 0 calc(-330 * var(--u)) / 100% auto no-repeat; }
.hs__ph-keys { position: absolute; inset: 0; }
.hs__ph-key { position: absolute; border-radius: calc(4 * var(--u)); background: transparent; transition: background-color 0.09s ease, scale 0.09s ease; }   /* a key tap: the phone's own */
.hs__ph-key.is-down { background: color-mix(in srgb, var(--color-bg) 14%, transparent); scale: 0.94; }
.hs__ph-send { left: calc(214 * var(--u)); top: calc(282 * var(--u)); width: calc(16 * var(--u)); height: calc(16 * var(--u)); border-radius: 50%; background: transparent; transition: background-color 0.09s ease, scale 0.09s ease; }
.hs__ph-send.is-down { background: color-mix(in srgb, var(--color-text) 35%, transparent); scale: 0.9; }

/* ── Phones, tablets and «reduce motion»: static cards ─────── */
.hsm { display: none; }
@media (max-width: 61.9375rem), (prefers-reduced-motion: reduce) {
  .hs { height: auto; }
  .hs__sticky { display: none; }
  /* a slide and its buttons read as one group: the buttons 8 under their card, the slides 48 apart (Liliya,
     review 01.12.2026: «it is not obvious the buttons belong to the block above») */
  .hsm { display: grid; gap: var(--space-lg); }
  .hsm__block { min-width: 0; display: grid; gap: var(--space-xs); }
  /* option (compare): the buttons inside the card, under the picture */
  .hsm--actions-in .hsm__block { gap: 0; background: var(--hsm-bg); border-radius: var(--radius-lg); overflow: hidden; padding-bottom: var(--pad-card-fluid); }
  .hsm--actions-in .hsm__surface { background: none; border-radius: 0; }
  .hsm--actions-in .hsm__actions { padding: var(--pad-card-fluid) var(--pad-card-fluid) 0; }

  /* which picture a card shows: the scaled-down desktop end state (mini) or the sideways collage (swipe) */
  .hsm--mini .hsm__collage, .hsm--swipe .hsm__mini { display: none; }
  /* mini: the scene's 1232 × 364 frame cropped to what the slide's end state shows (--bx/--by/--bw/--bh, design
     units, written by the script), scaled to the card's width; the pieces are the desktop fragments themselves */
  .hsm__mini {
    position: relative;
    overflow: hidden;
    container-type: size;
    aspect-ratio: var(--bw, 1232) / var(--bh, 364);
    margin-bottom: var(--pad-card-fluid);
  }
  .hsm__mini-stage {
    --cx: 616.5;
    --t: 0;
    position: absolute;
    container-type: size;
    width: calc(100cqw * 1232 / var(--bw, 1232));
    aspect-ratio: 1232 / 364;
    left: calc(-100cqw * var(--bx, 0) / var(--bw, 1232));
    top: calc(-100cqw * var(--by, 0) / var(--bw, 1232));
  }
  .hsm__surface { display: grid; grid-template-rows: auto 1fr; overflow: hidden; background: var(--hsm-bg); border-radius: var(--radius-lg); }

  /* tablets: the label beside the title, the lead under the title */
  .hsm__copy {
    display: grid;
    grid-template-columns: 8.5rem minmax(0, 1fr);   /* one label column for every card, as the desktop bar */
    grid-template-areas: "chip title" ".    lead";
    column-gap: var(--space-md);
    row-gap: var(--gap-heading-small);
    align-items: baseline;
    padding: var(--pad-card-fluid);
  }
  .hsm__chip { grid-area: chip; }
  .hsm__title { grid-area: title; }
  .hsm__lead { grid-area: lead; max-width: var(--measure-lead); }

  .hsm__collage {
    position: relative;
    min-height: clamp(20rem, 43.7cqw, 34rem);
    overflow-x: auto;
    overflow-y: hidden;
    container-type: inline-size;
    touch-action: pan-x pan-y;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }
  .hsm__collage::-webkit-scrollbar { display: none; }
  .hsm__collage:focus-visible { outline: var(--border-medium) solid var(--color-primary); outline-offset: calc(0rem - var(--border-medium)); }
  .hsm__collage.has-room { cursor: grab; }
  .hsm__collage.has-room.is-dragging { cursor: grabbing; }
  .hsm__stage { position: relative; width: 132cqw; height: 100%; margin-right: var(--space); }
  .hsm__stage--ai {
    --hsm-zoom: 1.1;
    width: calc(100cqw + var(--space) / var(--hsm-zoom));
    height: calc(100% / var(--hsm-zoom));
    transform: scale(var(--hsm-zoom));
    transform-origin: 0 0;
  }
  .hsm__asset { position: absolute; display: block; max-width: none; height: auto; pointer-events: none; user-select: none; -webkit-user-drag: none; }
  .hsm__shadow, .hsm__rules-duplicate, .hsm__rules-meta, .hsm__rules-tiktok, .hsm__rules-filter, .hsm__routines-trigger, .hsm__routines-routine {
    filter: drop-shadow(0 0.5rem 1.25rem color-mix(in srgb, var(--color-bg) 16%, transparent));
  }

  .hsm__rules-schedule { left: -3cqw; top: 1.5cqw; width: 31cqw; z-index: 1; }
  .hsm__rules-snap { left: -2cqw; top: 24cqw; width: 8cqw; z-index: 5; }
  .hsm__rules-google { left: 17cqw; top: 30cqw; width: 8cqw; z-index: 20; }
  .hsm__rules-account { left: -5cqw; top: 34cqw; width: 28cqw; z-index: 6; }
  .hsm__rules-duplicate { left: 4cqw; top: 5cqw; width: 85cqw; z-index: 4; }
  .hsm__rules-meta { left: 76cqw; top: 2.5cqw; width: 8cqw; z-index: 7; }
  .hsm__rules-integrations { left: 39cqw; top: 37cqw; width: 52cqw; z-index: 3; }
  .hsm__rules-section { left: 96cqw; top: 0; width: 34cqw; z-index: 2; }
  .hsm__rules-frequency { left: 105cqw; top: 8cqw; width: 18cqw; z-index: 5; }
  .hsm__rules-tiktok { left: 98cqw; top: 25cqw; width: 9cqw; z-index: 6; }
  .hsm__rules-filter { left: 85cqw; top: 29cqw; width: 55cqw; z-index: 5; }

  .hsm__auto-rules {
    position: absolute;
    left: 2.31cqw; top: 5.46cqw; width: 22.4cqw; height: 22.32cqw;
    z-index: 2;
    overflow: hidden;
    border-radius: 1.3cqw;
    background: var(--color-accent-blue);
    box-shadow: 0 0.5rem 1.25rem color-mix(in srgb, var(--color-bg) 12%, transparent);
  }
  .hsm__auto-title {
    position: absolute;
    left: 1.7cqw; top: 1.46cqw;
    z-index: 6;
    color: var(--color-text);
    font-size: clamp(0.65rem, 1.56cqw, 1.2rem);
    line-height: 1.15;
    font-weight: 600;
  }
  .hsm__auto-rules .hsm__asset { filter: drop-shadow(0 0.35rem 0.8rem color-mix(in srgb, var(--color-bg) 12%, transparent)); }
  .hsm__ai-pause { left: 7.04cqw; top: 5.03cqw; width: 39.99cqw; }
  .hsm__ai-increase { left: 4.53cqw; top: 8.36cqw; width: 44.95cqw; }
  .hsm__ai-duplicate { left: 2.35cqw; top: 11.93cqw; width: 49.32cqw; }
  .hsm__ai-context { left: 18.3cqw; top: 13.59cqw; width: 15.77cqw; z-index: 4; }
  .hsm__ai-library { left: 3.86cqw; top: 22.1cqw; width: 27.31cqw; z-index: 5; }
  .hsm__ai-icon { left: 31.21cqw; top: 5.22cqw; width: 5.19cqw; z-index: 8; }
  .hsm__chat {
    position: absolute;
    left: 36.65cqw; top: 5.22cqw; width: 24.35cqw; height: 31.72cqw;
    z-index: 6;
    border-radius: 6.67cqi;
    box-shadow: 0 0.75rem 2rem color-mix(in srgb, var(--color-bg) 12%, transparent);
  }

  .hsm__stage--routines { width: calc(86cqw + var(--space)); }
  .hsm__routines-trigger { left: 3cqw; top: 10.97cqw; width: 38.95cqw; z-index: 18; }
  .hsm__routines-routine { left: 49.93cqw; top: 12.34cqw; width: 28.45cqw; z-index: 18; }
  .hsm__routines-folder { left: 62.11cqw; top: 30.08cqw; width: 14.38cqw; z-index: 12; rotate: -11.93deg; }
  .hsm__routines-ad-1 { left: 35.06cqw; top: 21.18cqw; width: 21.97cqw; z-index: 7; border-radius: 1.26cqw; rotate: -9.74deg; }
  .hsm__routines-ad-2 { left: 44.53cqw; top: 6.92cqw; width: 20.99cqw; z-index: 9; border-radius: 2.52cqw; rotate: 9.26deg; }
  .hsm__routines-ad-3 { left: 61.48cqw; top: 4.78cqw; width: 20.99cqw; z-index: 8; border-radius: 2.52cqw; rotate: 26.39deg; }

  .hsm__mcp-ads { left: 24cqw; top: 7cqw; width: 40cqw; z-index: 2; }
  .hsm__mcp-duplicate { left: 8cqw; top: 4cqw; width: 26cqw; z-index: 5; rotate: -15deg; }
  .hsm__mcp-notify { left: 2cqw; top: 31cqw; width: 20cqw; z-index: 6; rotate: -2deg; }
  .hsm__mcp-budget { left: 13cqw; top: 39cqw; width: 27cqw; z-index: 6; rotate: -10deg; }
  .hsm__mcp-scale { left: -2cqw; top: 24cqw; width: 8cqw; z-index: 6; rotate: -8deg; }
  .hsm__mcp-time { left: 36cqw; top: 5cqw; width: 8cqw; z-index: 6; rotate: 8deg; }
  .hsm__mcp-logo { left: 10cqw; top: 20cqw; width: 43cqw; z-index: 5; }
  .hsm__mcp-line { position: absolute; left: 49cqw; top: 24cqw; width: 18cqw; border-top: 0.35cqw dotted var(--color-text); z-index: 4; }
  .hsm__phone {
    --u: calc(1cqw / 2.42);              /* the phone's own 242-unit frame */
    position: absolute;
    aspect-ratio: 242 / 526;
    container-type: inline-size;
    border-radius: 13.22% / 6.08%;
  }
  .hsm__mcp-phone { left: 64cqw; top: 1.5cqw; width: 32cqw; z-index: 3; filter: drop-shadow(0 0.75rem 2rem color-mix(in srgb, var(--color-bg) 16%, transparent)); }

  /* the buttons under the card: side by side, one width (.btn-group), the whole card's width */
  .hsm__actions { display: grid; width: 100%; }
}

/* phones: one column of copy; the collages wider and taller (as live), buttons stacked (.btn-group) */
@media (max-width: 47.9375rem) {
  /* 48 from the text to the picture, as a bento card's picture on phones (Liliya, 01.12.2026, docs/layout-rules.md) */
  .hsm__copy { display: flex; flex-direction: column; align-items: flex-start; gap: var(--gap-heading-small); padding-bottom: var(--space-lg); }
  /* the collages a quarter lower than live on phones (Liliya, 01.12.2026): the box 72 instead of 94 of the card's width,
     the drawing scaled by the same 0.76 so nothing in it moves against anything else.
     A scale, not `zoom`: Safari places the drawing's parts unscaled inside a zoomed box and cuts them off at the bottom
     (iPhone, 01.12.2026). Chrome scrolls by the stage's own box and Safari by the scaled drawing, so the box is given
     the drawing's scaled width (the same scroll in both), the gap after it is its right margin. */
  .hsm__collage { min-height: clamp(14.5rem, 72cqw, 30rem); }
  /* Routines: the picture ends a little under the Drive logo on the folder, the rest of the folder cut, so the card is
     shorter (Liliya, 02.12.2026); from the collage's own width, as the drawing is */
  .hsm__collage--routines { min-height: 0; aspect-ratio: 100 / 67.5; }
  .hsm__stage {
    --hsm-zoom: 0.76;
    height: calc(100% / var(--hsm-zoom));
    margin: 0 var(--space);
    transform: scale(var(--hsm-zoom));
    transform-origin: 0 0;
  }
  /* the 48 under the text counts to the drawing's first visible part, as on the Stage card (Liliya, 01.12.2026): each
     drawing is lifted by the empty strip over its topmost part, measured in the collage's width. The topmost part of
     the whole drawing, the ones seen only after a sideways scroll too: the collage clips its top, so a lift past
     them cuts them (Rules' Schedule card and a Routines ad, 02.12.2026). Rules has no empty strip. */
  .hsm__stage { translate: 0 calc(0cqw - var(--hsm-lift, 0cqw)); }
  .hsm__stage--ai { --hsm-lift: 4.3cqw; }
  .hsm__stage--routines { --hsm-lift: 12.5cqw; }
  .hsm__stage--mcp { --hsm-lift: 1.35cqw; }
  /* Safari ignores the margin when it scrolls a scaled box: this empty strip after the drawing keeps the same end gap */
  .hsm__stage::after { content: ''; position: absolute; top: 0; left: calc(100% / var(--hsm-zoom)); width: calc(var(--space) / var(--hsm-zoom)); height: 1px; }
  .hsm__stage--rules { width: calc(312cqw * var(--hsm-zoom)); }
    .hsm__stage--ai { --hsm-zoom: calc(1.45 * 0.76); width: calc(122cqw * var(--hsm-zoom)); }
  .hsm__stage--routines { width: calc(188cqw * var(--hsm-zoom)); }
  .hsm__stage--mcp { width: calc(180cqw * var(--hsm-zoom)); }

  .hsm__rules-schedule { left: 4.25cqw; top: 3.25cqw; width: 66.75cqw; }
  .hsm__rules-snap { left: 6.5cqw; top: 51.5cqw; width: 17.25cqw; }
  .hsm__rules-google { left: 47.25cqw; top: 64.5cqw; width: 17.25cqw; }
  .hsm__rules-account { left: 0; top: 73cqw; width: 60.25cqw; }
  .hsm__rules-duplicate { left: 19.25cqw; top: 10.75cqw; width: 182.75cqw; }
  .hsm__rules-meta { left: 174cqw; top: 5.5cqw; width: 17.25cqw; }
  .hsm__rules-integrations { left: 94.5cqw; top: 79.5cqw; width: 111.75cqw; }
  .hsm__rules-section { left: 217cqw; top: 0; width: 73cqw; }
  .hsm__rules-frequency { left: 236.5cqw; top: 17.25cqw; width: 38.75cqw; }
  .hsm__rules-tiktok { left: 221.5cqw; top: 53.75cqw; width: 19.25cqw; }
  .hsm__rules-filter { left: 193.5cqw; top: 62.25cqw; width: 118.25cqw; }

  .hsm__auto-rules { left: 4.62cqw; top: 10.92cqw; width: 44.8cqw; height: 44.64cqw; border-radius: 2.6cqw; }
  .hsm__auto-title { left: 3.4cqw; top: 2.92cqw; font-size: clamp(0.75rem, 3.12cqw, 1.2rem); }
  .hsm__ai-pause { left: 14.08cqw; top: 10.06cqw; width: 79.98cqw; }
  .hsm__ai-increase { left: 9.06cqw; top: 16.72cqw; width: 89.9cqw; }
  .hsm__ai-duplicate { left: 4.7cqw; top: 23.86cqw; width: 98.64cqw; }
  .hsm__ai-context { left: 36.6cqw; top: 27.18cqw; width: 31.54cqw; }
  .hsm__ai-library { left: 7.72cqw; top: 44.2cqw; width: 54.62cqw; }
  /* the chat and its icon raised so the chat's input clears the bottom of the box by as much as the chat clears its
     top (Liliya, 01.12.2026: «it sticks to the bottom — just raise the chat a little») */
  .hsm__ai-icon { left: 62.42cqw; top: 3.9cqw; width: 10.38cqw; }
  .hsm__chat { left: 73.3cqw; top: 3.9cqw; width: 48.7cqw; height: 63.44cqw; }

  .hsm__routines-trigger { left: 2cqw; top: 38.8cqw; width: 89.04cqw; }
  .hsm__routines-routine { left: 109.28cqw; top: 41.92cqw; width: 65.04cqw; }
  .hsm__routines-folder { left: 137.12cqw; top: 82.48cqw; width: 32.88cqw; }
  .hsm__routines-ad-1 { left: 75.27cqw; top: 62.13cqw; width: 50.22cqw; border-radius: 2.88cqw; }
  .hsm__routines-ad-2 { left: 96.92cqw; top: 29.54cqw; width: 47.99cqw; border-radius: 5.76cqw; }
  .hsm__routines-ad-3 { left: 135.68cqw; top: 24.64cqw; width: 47.99cqw; border-radius: 5.76cqw; }

  .hsm__mcp-ads { left: 48cqw; top: 15cqw; width: 64cqw; }
  .hsm__mcp-duplicate { left: 20cqw; top: 8cqw; width: 50cqw; }
  .hsm__mcp-notify { left: 7cqw; top: 72cqw; width: 38cqw; }
  .hsm__mcp-budget { left: 28cqw; top: 86cqw; width: 46cqw; }
  .hsm__mcp-scale { left: 2cqw; top: 48cqw; width: 12cqw; }
  .hsm__mcp-time { left: 84cqw; top: 12cqw; width: 12cqw; }
  .hsm__mcp-logo { left: 8cqw; top: 45cqw; width: 80cqw; }
  .hsm__mcp-line { left: 86cqw; top: 54cqw; width: 18cqw; border-top-width: 0.7cqw; }
  .hsm__mcp-phone { left: 110cqw; top: 6cqw; width: 68cqw; }
}

/* tablets (and a wide screen under «reduce motion»): the collages fit their card, no sideways scroll */
@media (min-width: 48rem) and (max-width: 61.9375rem), (min-width: 48rem) and (prefers-reduced-motion: reduce) {
  .hsm__collage { overflow: clip; }
  .hsm__stage--ai { width: 61cqw; margin-inline: auto; translate: -4.32cqw 0; }
  .hsm__stage--mcp { width: 96cqw; margin-inline: auto; translate: 1.26cqw 0; }
  .hsm__stage--rules { translate: 3.5cqw 0; }
  .hsm__stage--routines { width: 84cqw; margin-inline: auto; translate: -2.5cqw 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hs__bar > *, .hs__head, .hs__canvas, .hs__frag, .hs__dot { transition: none !important; animation: none !important; }
  .hs__ph-caret, .hs__tool.is-live::before { animation: none; }
}
