/* The home page's second section, "How we help": five cards that pin and stack as you scroll. Clay's "How We Help"
   (clay.global/fintech, measured 2026-10-20, docs/research/2026-10-20-clay-how-we-help.md) rebuilt with our colors, type and
   copy. Its breakpoints are kept (two columns from 1250 px, stacked from 768 px, the phone layout below) except on tablets:
   Clay's cards are width-driven only, but Rahul wants the iPad, in either orientation, to carry the desktop card, so from
   744 px (and 600 px tall) the card is two columns too, at a size that fits. The stacking itself follows 21st.dev's stacking card
   (Rahul, 2026-10-23; the original is ~/Developer/my-business/ui-components/sections/stacking-card.tsx): each card has the screen
   to itself, a full-screen sticky box with the card in the middle, so the cards stack even with scripts off; services.js adds the
   component's shrink and picture zoom, and the page scrolls with Lenis (src/components/smooth-scroll/).
   Sticky needs the page itself to scroll: nothing from here up to <body> may set overflow. */

.services,
.services *,
.services ::before,
.services ::after { box-sizing: border-box; }

.services {
  --services-card: #1a1d24;                      /* Night, one step up (Night + 14, 15, 18, Clay's step): the card face. 16.9:1 under white */
  --services-muted: rgb(255 255 255 / 0.7);      /* the pitch: 8.8:1 on the card */
  --services-faint: rgb(255 255 255 / 0.6);      /* the count: 6.8:1 on the card */
  --services-ease: cubic-bezier(0.23, 1, 0.32, 1);
  background-color: #0c0e12;                     /* Night: the band continues the hero */
  color: #fff;
  padding-block: 40px;                           /* the top is the room under the hero, see the two steps below */
  scroll-margin-top: -8px;                       /* lands at 80 px, under the nav bar (nav.css sets the 88 px scroll padding): "All services" lands the heading under it */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* Room under the hero (Rahul, 2026-10-22: "too close", "refer to Clay's website"). Clay's home (measured that day) starts its next
   section 60 px under the hero below 768, 80 from 768 and 100 from 1250 up, and on a wide screen its picture stops 88 px short of
   that edge, so the gap you see is 62 px at 390, 82 at 768, 85 at 1024 and 191 at 1440. Ours is the hero's own padding (40 px, 112
   on a phone, which keeps the stats clear of the pinned button) plus this top: 80 from 768 gives 119 px; 150 from 1250 gives 188
   (the -78 px scroll margin, with the 88 px scroll padding, lands "All services" where the 80 + 80 did); a phone keeps 40, which is already 151. */
@media (min-width: 768px) { .services { padding-block: 80px 40px; } }
@media (min-width: 1250px) { .services { padding-block: 150px 100px; scroll-margin-top: -78px; } }

/* The page's own padding steps (the hero uses the same), up to Clay's 1290 px column */
.services__inner { margin-inline: auto; max-width: calc(1290px + 2 * 24px); padding-inline: 24px; }
@media (min-width: 640px) { .services__inner { max-width: calc(1290px + 2 * 32px); padding-inline: 32px; } }
@media (min-width: 768px) { .services__inner { max-width: calc(1290px + 2 * 48px); padding-inline: 48px; } }
@media (min-width: 1024px) { .services__inner { max-width: calc(1290px + 2 * 56px); padding-inline: 56px; } }

.services__heading { margin: 0; color: #fff; }
/* Under the heading, where RSL/A is (the 2026-11-09 review: the home page never said it), linking the Bakersfield hub; and under
   the last card, the way to the other three services (/services) */
.services__lead { max-width: 40em; margin: 12px 0 0; color: var(--services-muted); }
.services__all { margin: 32px 0 0; }
@media (min-width: 1250px) { .services__all { margin-top: 40px; } }

/* The cards, one screen each. Each <li> is a full-screen sticky box (the stacking card's h-screen sticky top-0, on the small
   viewport, so the box keeps its size while a phone's toolbar slides) with its card centered in the part under the nav bar's
   80 px. The card sits 5vh above that center and 25 px lower than the card before it (the component's top: calc(-5vh + i *
   25px)), so the top edges of the cards under it show; a phone keeps it centered and steps 8 px. container-type gives the
   list's width to the tablet cqw below. */
.services__list {
  --services-top: 80px;
  --services-lift: 0px;
  --services-step: 8px;
  container-type: inline-size;
  margin: 0;
  padding: 24px 0 0;
  list-style: none;
}
@media (min-width: 768px) { .services__list { --services-lift: -5vh; --services-step: 25px; padding-top: 40px; } }
@media (min-width: 1250px) { .services__list { padding-top: 48px; } }

.services__list .services__item {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100vh;
  height: 100svh;
  padding-top: var(--services-top);
}
.services__list .services__item:nth-child(2) { --i: 1; }
.services__list .services__item:nth-child(3) { --i: 2; }
.services__list .services__item:nth-child(4) { --i: 3; }
.services__list .services__item:nth-child(5) { --i: 4; }
/* The part that shrinks as the next card comes over it: from its top edge, as the component's origin-top. Every card is as
   tall as the tallest (services.js measures it), so a card never shows under a shorter one. */
.services__list .services__stack { position: relative; top: calc(var(--services-lift) + var(--i, 0) * var(--services-step)); transform-origin: 50% 0; }
.services__list .services__card { min-height: var(--services-card-h, 0px); }
/* services.js sets this when a card can't be seen whole under the nav bar, with a phone's toolbar slid away (a phone held
   sideways, a short window): then the cards just scroll, 8 px apart (12 from 768 px, 16 from 1250 px) */
.services__list[data-stack-off] { display: grid; gap: 8px; }
@media (min-width: 768px) { .services__list[data-stack-off] { gap: 12px; } }
@media (min-width: 1250px) { .services__list[data-stack-off] { gap: 16px; } }
.services__list[data-stack-off] .services__item { position: static; height: auto; padding-top: 0; }
.services__list[data-stack-off] .services__stack { top: 0; }

.services__card {
  position: relative;                            /* the link's ::after covers the whole card */
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 16px;
  background-color: var(--services-card);
}
@media (min-width: 1250px) { .services__card { flex-direction: row; justify-content: space-between; } }

/* Phones: the count on top, then the title and pitch (DOM order is title, pitch, count) */
.services__content { display: flex; flex-direction: column-reverse; padding: 32px 20px; }
@media (min-width: 768px) { .services__content { padding: 40px 32px; } }
@media (min-width: 1250px) { .services__content { flex-direction: column; justify-content: space-between; width: 50%; padding: 32px 64px 28px 32px; } }

.services__title { margin: 0 0 8px; color: #fff; }
.services__pitch { margin: 0; color: var(--services-muted); }
@media (min-width: 768px) { .services__title { margin-bottom: 12px; } .services__pitch { max-width: 58.2%; } }
@media (min-width: 1250px) { .services__title { margin-bottom: 20px; } .services__pitch { max-width: 91.8%; } }

.services__count { margin: 0 0 48px; color: var(--services-faint); font-variant-numeric: tabular-nums; }
@media (min-width: 768px) { .services__count { margin-bottom: 56px; } }
@media (min-width: 1250px) { .services__count { margin: 40px 0 0; } }

/* The whole card is the link; the title's text is its name. Keyboard focus is a white ring inside the card edge
   (the card clips anything outside it). */
.services__link { color: inherit; text-decoration: none; }
.services__link::after { content: ""; position: absolute; inset: 0; z-index: 1; }   /* above the picture, which is positioned too */
.services__link:focus-visible { outline: none; }
.services__link:focus-visible::after { outline: 2px solid #fff; outline-offset: -6px; border-radius: 16px; }

/* Lucide arrow-up-right, the nav's "Let's talk" arrow; it nudges toward its corner under a mouse (never after a tap) */
.services__arrow { display: inline-flex; width: 0.6em; height: 0.6em; margin-left: 0.2em; vertical-align: 0.04em; transition: transform 150ms var(--services-ease); }
.services__arrow svg { width: 100%; height: 100%; }
@media (hover: hover) and (pointer: fine) { .services__card:hover .services__arrow { transform: translate(4px, -4px); } }

/* The picture: 4:3 (Clay's is 533 x 400). Each card's own picture (public/images/services/, 16:9, 3D clay and frosted glass in the
   service's color, its object inside the middle square) goes inside .services__media as <img> and fills the block, cropped from
   the center by object-fit: cover. The block's color, the picture's own field color, shows while it loads and matches the picture's edges.
   It clips the picture, which zooms from 2 to 1 as the card comes up into place (below). */
.services__media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background-color: var(--service-color); }
.services__media img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
@media (min-width: 1250px) { .services__media { flex: none; width: 47%; } }

/* The zoom is a scroll-driven animation where the browser has them (Chrome 115, Safari 26): the browser moves it with the scroll
   itself, off the main thread where it can, so on a 120 Hz phone it keeps pace with the page. services.js's zoom runs at most 60
   frames a second and fell behind it (Rahul, 2026-10-23: "laggy while zooming in and out"); it now zooms only where this isn't
   supported. The zoom runs from the box's top at the screen's foot to the box wholly on screen, which for a box one small screen
   tall is where it pins; it ends 8 px early, so a pinned card's picture rests at exactly 1. Cards that don't pin zoom until their
   top is 8 px from the top. The animation is on only while the box is on its way up (services.js sets data-zooming from its top): a
   picture with one on is drawn in a layer of its own, which measured up to a third less sharp at rest, so a pinned card's picture
   has none and is drawn pixel for pixel. At both ends the picture looks the same with it or without (offscreen; 1). */
@keyframes services-zoom { from { transform: scale(2); } to { transform: none; } }
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .services__list .services__item { view-timeline: --services-box block; }
    .services__list .services__item[data-zooming] .services__media img { animation: services-zoom linear both; animation-timeline: --services-box; animation-range: entry 0% entry calc(100% - 8px); }
    .services__list[data-stack-off] .services__item[data-zooming] .services__media img { animation-range: cover 0% cover calc(100vh - 8px); }
  }
}

/* Each picture's own field color, sampled from the flat field inside its 4:3 crop (docs/service-cards/README.md), so the block matches the
   picture's edges while it loads. Round 4's palette is #337AEE, #FFC21A, #FF3D8B, #00C27A and #0EB3CD for these five; the
   pictures' fields land 0.4 to 4.2 dE76 away from each. */
.services__item[data-service="local-seo"] { --service-color: #337AEE; }
.services__item[data-service="seo"] { --service-color: #FEC003; }
.services__item[data-service="web-design"] { --service-color: #FD3487; }
.services__item[data-service="automations"] { --service-color: #0FBA79; }
.services__item[data-service="crm"] { --service-color: #0DB2CA; }

/* Tablets: an iPad in either orientation (744 to 1249 px wide, 600 px tall or more). The card is the desktop card, text left and picture
   right, sized to fit: the content takes what the picture leaves, the title stays on one line (it is the link's name), and the
   picture is as tall as the card, 4:3 at the least. Width and height alone decide this, no device or user-agent check (Clay does
   none either). A phone, even turned sideways, is under 600 px tall and keeps the phone layout. */
@media (min-width: 744px) and (max-width: 1249px) and (min-height: 600px) {
  .services__list { padding-top: 40px; }
  .services__card { flex-direction: row; }
  .services__content { flex: 1 1 0; flex-direction: column; justify-content: space-between; min-width: 0; padding: 28px 24px 24px 28px; }
  .services__link { white-space: nowrap; }
  .services__title { margin-bottom: 12px; }
  .services__pitch { max-width: none; }
  .services__count { margin: 32px 0 0; }
  .services__media { flex: none; width: 44%; }
}

@media (prefers-reduced-motion: reduce) {
  .services__arrow, .services__card:hover .services__arrow { transform: none; transition: none; }
}
