/* 04 · What we do on phones (<= 767px). No pinned screen, plain scroll. Services and
   integrations share one accordion, switched by two tabs set like the section's overline
   (the active one in ink). The open entry (services-ui.js placeOpen) shows its number
   above the title, then the tagline, and the copy beside a grey plate with the mark
   (tab-figure.js) that runs out to the screen's edge; the other entries stand closed in
   grey. Under it the stack is a block of its own: the desktop's grey screen with the big
   mark, the headline and the chips (services-ui.js placeTech). The scroll changes nothing.
   (sections.css's tablet rules for this card stop at 768px: nothing here needs !important.) */

@media (max-width: 767px) {
  .s-what {
    --open-air: var(--m-4); /* the open entry's air above and below (see "The open entry") */
    height: auto;
    padding: 0;
  }
  .s-what .what-sticky {
    position: relative;
    display: block;
    height: auto;
    padding: 0;
  }

  /* ---- The card: one column in flow ---- */
  .s-what .what-card {
    display: flex;
    flex-direction: column;
    padding: var(--section-y) var(--card-x) 0;
  }
  .s-what .what-card .what-list { display: contents; }
  .s-what .what-card .what-detail { display: none; } /* its pieces live in the open entry */
  /* ---- Tabs: the overline's type, the active one in ink behind the slash ---- */
  .s-what .what-tabs {
    display: flex;
    /* = the slash's own air to its word (1.3em of the slash, ~12.8px; the word's trailing
       letter-spacing and the slash's cancel out), so word / word is evenly spaced */
    gap: 12px;
    margin-bottom: var(--m-4);
  }
  .what-tab {
    min-height: 44px;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: var(--fs-m-min);
    font-weight: 400;
    letter-spacing: var(--track-caps);
    text-transform: uppercase;
    color: var(--quiet); /* the tab that is off: lighter than the one in ink, and still 4.67:1 on the white card (was #a3a5ac, 2.46:1) */
    cursor: pointer;
    transition: color var(--dur-base) ease;
  }
  .what-tab::before {
    content: "/";
    margin-right: var(--slash-gap);
    font-size: var(--slash-fs);
  }
  .what-tab.is-on {
    color: var(--ink);
    font-weight: 500;
  }
  /* The tabs name the subsection; the h2 stays for screen readers only */
  .s-what .what-card .what-sec {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  /* ---- Groups: the tab's one in flow, the other out; the stack's lives in its block ---- */
  .s-what .what-card[data-sec] .what-group {
    position: relative;
    inset: auto;
    translate: none;
    visibility: visible;
    gap: var(--m-2);
  }
  .s-what .what-card .what-list .what-group:not(.is-on) { display: none; }
  /* The accordion fills a screen (lvh: with Safari's toolbar away too) whatever is open: the card's top air, the tabs (44 + 40)
     and the gap to the stack's block make up the rest. It also keeps the block from
     changing height when the tab switches. */
  .s-what .what-card .what-list > .what-group.is-on { min-height: calc(100lvh - 2 * var(--section-y) - 84px); }

  /* ---- Rows: closed in grey, the open one in ink. Their line masks stay open: the rows
     are a plain list here, not the pinned screen's entrance. ---- */
  .s-what .what-card .what-row { color: var(--muted); }
  .s-what .what-card .what-row.is-now,
  .s-what .what-card .what-group[data-sec="tech"] .what-row { color: var(--ink); }
  .s-what .what-card .what-row .rli {
    transform: none;
    transition: none;
  }
  /* ...except into a service's page (case-leave.js, the open entry's disc): the rows go up
     out of their masks with the copy, as on the desktop (.rv.is-out), at the card's quick
     exit (sections.css .what-card .rv.is-in.is-out) -- the open masks above held them, and
     the title stood over the opening plate. Back from the page they rise again. The disc
     goes with them whatever its reveal holds. */
  html.case-leaving .s-what .what-card .what-list .what-row.rv.is-in.is-out .rli {
    transform: translateY(var(--rise-mask-out));
    transition: transform 0.25s var(--ease-in) calc(var(--d-in, 0s) * var(--exit-stagger));
  }
  html.case-returning .s-what .what-card .what-list .what-row .rli {
    transition: transform 0.45s var(--ease-out) var(--d-in, 0s); /* = .what-card .rv.is-in .rli */
  }
  html.case-leaving .s-what .what-open .what-go { opacity: 0; }
  /* ...and the tabs, which stand where the desktop's eyebrow leaves through its mask: up out
     of their row, which clips only then (the focus ring stands out of it otherwise) */
  html:is(.case-leaving, .case-returning) .s-what .what-tabs { overflow: clip; }
  html.case-leaving .s-what .what-tab {
    transform: translateY(var(--rise-mask-out));
    transition: transform 0.25s var(--ease-in);
  }
  html.case-returning .s-what .what-tab { transition: transform 0.45s var(--ease-out); }
  /* Sizes from the type scale (typography.css), not one-offs: the service titles take the
     36 step (.h5), the integrations the 28 step (.h3 / .h4 floor); the stack's headline
     below is the 34 step (.list-xl floor). 36 is the largest step at which the longest
     title ("Hotel & Brand Websites") still holds one line. */
  .s-what .what-card .list-lg { font-size: var(--fs-m-list-lg); }
  .s-what .what-card .list { font-size: var(--fs-m-list); }

  /* ---- The open entry ---- */
  /* The open entry stands apart from the closed ones: --open-air above its number (or
     its title, where there is no number) and below its block (.s-what sets it, above) */
  .s-what .what-card .what-num {
    margin: calc(var(--open-air) - var(--m-2)) 0 -2px; /* the group's gap makes up the rest */
    font-size: var(--fs-m-min);
  }
  .s-what .what-card[data-sec="integrations"] .what-group[data-sec="integrations"] .what-row.is-now {
    margin-top: calc(var(--open-air) - var(--m-2));
  }
  /* First in its group: the label's own gap is the air above */
  .s-what .what-card .what-num:first-child,
  .s-what .what-card .what-group .what-row.is-now:first-child { margin-top: 0; }
  /* The plate stands absolutely at the entry's lower right, flush with the screen's edge;
     the copy keeps clear of it (--plate-w + 16px) and is at least as tall, so the plate
     never climbs over the tagline or the title */
  .what-open {
    --plate-w: var(--m-plate-w);
    --plate-h: var(--m-plate-h);
    position: relative;
    align-self: stretch; /* the group's column aligns its items to the start: the entry spans the card */
    display: flex;
    flex-direction: column;
    gap: var(--m-2);
    margin: 4px 0 calc(var(--open-air) - var(--m-2));
  }
  .what-open .what-text { display: contents; }
  .s-what .what-open .what-tag {
    max-width: 30ch;
    font-size: 16px;
    color: var(--ink);
  }
  .s-what .what-open .what-copy {
    max-width: calc(100% - var(--plate-w) - var(--m-2));
    min-height: var(--plate-h);
    font-size: var(--fs-m-copy);
    color: var(--ink);
    white-space: normal;
  }
  /* The grey plate travels to the entry that opens (services-ui.js), and the new mark wipes
     down over it -- the works tiles' reveal, with its curve and length */
  .s-what .what-open .what-slot {
    position: absolute;
    inset: auto calc(-1 * var(--card-x)) 0 auto;
    width: calc(var(--plate-w) + var(--card-x));
    height: var(--plate-h);
    overflow: hidden;
  }
  /* The plate and its mark arrive together, wiping down (sections.css .is-visual-in), as every
     picture does; a tap moves the plate, already there, and wipes the new mark over it */
  /* A service's own page (sections.css .what-go): the disc centred on the small plate's top
     edge, near its right (the plate stands at the entry's lower right, out to the screen's edge) */
  .what-open .what-go {
    top: auto;
    right: calc(16px - var(--card-x));
    bottom: calc(var(--plate-h) - 24px);
  }
  .s-what .what-card[data-slot-sec] .what-slot::before,
  .s-what .what-card[data-slot-sec] .tab-figure {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transition: clip-path var(--dur-wipe) var(--ease-io);
  }
  /* The desktop's optical nudge for the two top-heavy forms is a flat 12px -- 5% of its
     panel, but 15% of this small plate, which threw them visibly low. Kept in proportion. */
  .s-what .what-open .tab-figure canvas[data-form="funnel"],
  .s-what .what-open .tab-figure canvas[data-form="rings"] { translate: 6% 5%; } /* and a touch right: their mass leans left on the plate */

  /* ---- The stack: the desktop's grey screen, full bleed -- the big mark above, the
     overline, the headline and the chips at the foot ---- */
  .what-tech {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 100lvh; /* the whole screen with the toolbar away, like the accordion above */
    margin: var(--section-y) calc(-1 * var(--card-x)) 0;
    padding: var(--section-y) var(--card-x) calc(48px + env(safe-area-inset-bottom));
    background: var(--plate-grey) var(--plate-lit);
    overflow: hidden; /* clips the mark's bleed past the gutter (below) */
  }
  /* The overline at the block's top, where the accordion's tabs stand in theirs */
  .what-tech::before {
    content: "/\2003tech stack";
    font-size: var(--fs-m-min);
    font-weight: 400;
    letter-spacing: var(--track-caps);
    text-transform: uppercase;
    color: var(--muted);
  }
  /* Big, off to the right (the desktop has it in the upper right too) and standing on the
     headline rather than floating mid-block; the bleed past the gutter is clipped */
  .what-tech-figure {
    flex: 1 1 auto;
    display: grid;
    place-items: end;
    min-height: 0;
    pointer-events: none;
  }
  .what-tech-figure canvas {
    display: block;
    width: min(86vw, 50svh);
    height: min(86vw, 50svh);
    margin-right: calc(-0.5 * var(--card-x));
  }
  .s-what .what-tech .what-row { cursor: default; }
  .s-what .what-tech .list-xl {
    font-size: var(--fs-m-list-lg);
    line-height: 1.2; /* the desktop's 1.08 reads cramped at this size over three lines */
  }
  .s-what .what-card .what-chips {
    position: relative;
    inset: auto;
    width: auto;
    visibility: visible;
    pointer-events: auto;
    flex-wrap: wrap;
    overflow: visible;
    margin: var(--m-3) 0 0;
    padding: 0;
  }
  .s-what .what-card .what-chips .chip {
    visibility: visible;
    opacity: 1;
    transform: none;
  }

  /* ---- The stack's way in (services-ui.js, as the block scrolls up): the grey screen and
     its mark wipe down together (.is-mark-in, once: every picture and mark arrives with its
     plate), the overline with them; the headline rises through its masks, the chips after
     it (.is-text-in). The rows above keep their masks open; these rules go one step past. */
  .what-tech {
    clip-path: inset(0 0 100% 0);
    transition: clip-path var(--dur-wipe-panel) var(--ease-io); /* = the desktop's panel (sections.css .what-slot::before) */
  }
  .what-tech.is-mark-in { clip-path: inset(0); }
  .s-what .what-card .what-tech .what-row .rli {
    transform: translateY(var(--rise-mask));
    transition: transform var(--dur-exit) var(--ease-in);
  }
  .s-what .what-card .what-tech.is-text-in .what-row .rli {
    transform: none;
    transition: transform var(--dur-reveal) var(--ease-out) var(--d-in, 0s);
  }
  .s-what .what-card .what-tech .what-chips .chip {
    opacity: 0;
    transform: translateY(var(--rise-block));
    transition: opacity 0.3s ease, transform 0.3s ease;
  }
  .s-what .what-card .what-tech.is-text-in .what-chips .chip {
    opacity: 1;
    transform: none;
    transition: opacity var(--dur-slow) ease calc(0.3s + var(--d-in, 0s)),
      transform var(--dur-slow) ease calc(0.3s + var(--d-in, 0s));
  }
  /* (the way back up: at once, as all text -- global.css html.scroll-up) */
  html.scroll-up .s-what .what-card .what-tech.is-text-in .what-row .rli {
    transition-delay: calc(var(--d-in, 0s) * var(--back-stagger));
  }
  html.scroll-up .s-what .what-card .what-tech.is-text-in .what-chips .chip {
    transition-delay: calc((0.3s + var(--d-in, 0s)) * var(--back-stagger));
  }
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
  .s-what .what-card[data-slot-sec] .what-slot::before,
  .s-what .what-card[data-slot-sec] .tab-figure { transition: none; }
  /* The stack stands as it is */
  .what-tech { clip-path: none; transition: none; }
  .s-what .what-card .what-tech .what-row .rli,
  .s-what .what-card .what-tech.is-text-in .what-row .rli { transform: none; transition: none; }
  .s-what .what-card .what-tech .what-chips .chip,
  .s-what .what-card .what-tech.is-text-in .what-chips .chip { opacity: 1; transform: none; transition: none; }
}
