/* How It Works — Paper "Cubbi Website — How It Works" (desktop 22N-0 / mobile 4KR-0).
   Exact values pulled from the artboards via Paper MCP computed styles. */

.hiw-hero {
  background: var(--green-100);
  position: relative;
  overflow-x: clip;
  overflow-y: visible;
}
.hiw-hero .inner {
  display: grid;
  /* Copy column caps at 526px like the artboard; the rest is the phones' lane. */
  grid-template-columns: minmax(0, 33rem) 1fr;
  align-items: start;
  column-gap: 2.5rem;
  max-width: 90rem;
  margin-inline: auto;
  padding: 3.25rem 4rem 3.5rem;
}
.hiw-hero h1 {
  grid-column: 1;
  display: inline-block;
  width: fit-content;
  background: var(--lilac-500);
  color: var(--green-700);
  font-size: clamp(1.375rem, 3vw, 2.75rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  line-height: 1.23;
  border-radius: var(--radius-md, 16px);
  /* Artboard: 4px 4px 0 secondary-mid (#8B579C = --purple-500) */
  box-shadow: 4px 4px 0 var(--purple-500);
  padding: 0.875rem 1.25rem;
  margin: 0 0 1.75rem;
}
.hiw-hero-copy {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  gap: 1.125rem; /* features gap 18px per artboard */
}
.hiw-feature h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--green-700);
  margin: 0 0 0.15rem;
}
.hiw-feature p {
  font-size: 0.875rem;
  color: var(--green-700); /* CUB-209: body copy is primary green */
  margin: 0;
}
.hiw-hero .store-badges {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.625rem;
}
.hiw-hero-visual {
  grid-column: 2;
  grid-row: 1 / 3;
  position: relative;
  height: 100%;
  min-height: 26rem;
  /* Phone B runs ~27.5rem past the band's bottom edge into the white copy
     section below, per the artboard (translate y 501 in a 96–587 band). */
  z-index: 5;
}
.hiw-hero-visual .phone {
  position: absolute;
  border-radius: 34px;
  background: #111;
  padding: 5px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}
.hiw-hero-visual .phone img {
  border-radius: 28px;
  display: block;
  height: auto;
  width: 100%;
}
/* Bezel widths per artboard: A 241×512, B 248×526 (incl. frame). */
.hiw-hero-visual .phone-a { width: 241px; }
.hiw-hero-visual .phone-b { width: 248px; }
/* Artboard: phone A 241×512 rotate −10° at x825/y141; phone B 248×526 rotate +10°
   at x1099/y501 (1440 frame). Positions below are relative to the visual lane,
   which starts at x≈566 after the copy column. */
.hiw-hero-visual .phone-a {
  /* 19.5rem at ≥1440; collapses toward the lane's right edge as it narrows. */
  right: clamp(0.5rem, 100vw - 70.5rem, 19.5rem);
  top: -0.5rem;
  transform: rotate(-10deg);
}
.hiw-hero-visual .phone-b {
  right: clamp(0rem, 4.5vw - 2.25rem, 1.8rem);
  top: 22rem;
  transform: rotate(10deg);
}
/* Between the mobile breakpoint and full desktop the lane is too narrow for
   full-size phones — scale them down and stack them tighter to the right. */
@media (max-width: 82rem) {
  .hiw-hero-visual .phone-a { width: 190px; }
  .hiw-hero-visual .phone-b { width: 196px; top: 19rem; }
}

.hiw-copy {
  background: #fff;
  max-width: 90rem;
  margin-inline: auto;
  /* Artboard 23V-0: padding 64 top / 400 right / 120 bottom / 64 left, gap 22.
     The right padding is the phones' lane — headings and copy span the rest. */
  display: flex;
  flex-direction: column;
  gap: 1.375rem;
  padding: 4rem clamp(15rem, 27.8vw, 25rem) 7.5rem 4rem;
  color: var(--green-700);
}
.hiw-copy .block {
  margin: 0;
}
.hiw-copy .block + .block {
  margin-top: 1.375rem;
}
.hiw-copy h2 {
  position: relative;
  width: fit-content;
  max-width: 100%;
  font-size: clamp(1.875rem, 3.5vw, 2.75rem);
  line-height: 1.23;
  letter-spacing: -0.01em;
  margin: 0 0 1.375rem;
}
.hiw-copy p {
  color: var(--green-700);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 61rem;
  margin: 0;
}
.hiw-copy p + p {
  margin-top: 1.375rem;
}

.hiw-steps {
  background: var(--cream-200);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 2.3125rem; /* 37px per artboard */
  padding: 1.5rem 4rem 3.5rem; /* bottom 56px per artboard */
  margin-block: -1px; /* flush against both waves — no seam lines */
}
.hiw-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.875rem; /* 14px per artboard */
  width: 8.75rem; /* 140px per artboard */
  text-align: center;
  position: relative;
}
.hiw-step .icon {
  width: 5.5rem; /* 88px per artboard */
  height: 5.5rem;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--lilac-500);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green-700);
}
.hiw-step .icon svg {
  width: 32px;
  height: 32px;
}
.hiw-step .label {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--green-700);
}
.hiw-step:not(:last-child)::after {
  content: "";
  position: absolute;
  right: -1.85rem;
  top: 2.35rem;
  width: 0.7rem;
  height: 0.7rem;
  border-right: 2.5px solid var(--green-700);
  border-top: 2.5px solid var(--green-700);
  transform: rotate(45deg);
}

.hiw-evidence {
  background: #fff;
  max-width: 90rem;
  margin-inline: auto;
  padding: 4rem 4rem 4.5rem; /* 64px per artboard */
}
.hiw-evidence h2 {
  width: fit-content;
  margin-bottom: 1.75rem;
}
.hiw-evidence > p {
  max-width: 82rem;
  color: var(--green-700);
}
.evidence-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem;
  margin: 1.75rem 0;
  padding: 0;
}
.evidence-pills li {
  list-style: none;
  background: var(--lilac-500);
  color: var(--green-700);
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.875rem 1.5rem; /* 14/24 per artboard */
  border-radius: var(--radius-pill);
  /* Artboard: soft shadow, not the hard offset used on buttons. */
  box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.2);
}

@media (max-width: 63.9rem) {
  /* Mobile artboard 4KR-0: chip → phones (side by side, fully visible) → features. */
  .hiw-hero .inner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 1.25rem 4.5rem;
  }
  .hiw-hero h1 {
    margin-bottom: 0.625rem;
  }
  .hiw-hero-visual {
    order: 0;
    width: 100%;
    height: 24.5rem; /* fits both phones uncropped (tallest ends at ~391px) */
    min-height: 0;
    margin: 0;
  }
  /* Artboard: A 135×286 rotate −10° at x30/y101; B 138×294 rotate +10° at x216/y118. */
  .hiw-hero-visual .phone-a {
    left: 3%;
    right: auto;
    top: 1.5rem;
    width: clamp(112px, 36vw, 141px);
    transform: rotate(-10deg);
  }
  .hiw-hero-visual .phone-b {
    left: auto;
    right: 4%;
    top: 2.5rem;
    width: clamp(115px, 37vw, 144px);
    transform: rotate(10deg);
  }
  .hiw-hero-visual .phone {
    border-radius: 16px;
    padding: 3px;
  }
  .hiw-hero-visual .phone img {
    border-radius: 13px;
  }
  .hiw-copy {
    padding: 2.25rem 1.25rem 3rem;
    gap: 1rem;
  }
  .hiw-copy h2 {
    margin-bottom: 1rem;
  }
  .hiw-evidence {
    padding: 2.5rem 1.25rem 3rem;
  }
  /* Mobile steps run vertically with down-chevrons between, per the artboard. */
  .hiw-steps {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2.5rem 1.25rem;
  }
  .hiw-step {
    width: auto;
    gap: 0.75rem;
  }
  .hiw-step .icon {
    width: 4.75rem; /* 76px per artboard */
    height: 4.75rem;
  }
  .hiw-step:not(:last-child) {
    padding-bottom: 2rem;
  }
  .hiw-step:not(:last-child)::after {
    right: auto;
    top: auto;
    bottom: 0.5rem;
    left: 50%;
    margin-left: -0.35rem;
    transform: rotate(135deg);
  }
}

/* Word-aligned squiggle underlines (shared pattern with home). */
.uword { position: relative; display: inline-block; white-space: nowrap; }
.uword .uword-line { position: absolute; left: 0; right: 0; bottom: -0.04em; width: 100%; height: 0.22em; }

/* Strip transition waves: shallow so they read as the band's edge, not a stray sliver. */
.hiw-strip-wave {
  height: clamp(2.5rem, 4.5vw, 4rem);
}
