/* "How it works": steps beside a pinned phone with HTML-built app screens. */

.how {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(24px, 6vw, 96px);
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
}

.step {
  min-height: 72vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0.35;
  transition: opacity 0.4s ease;
}

.step.is-active,
html:not(.anim) .step {
  opacity: 1;
}

.step .num {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  margin-bottom: 20px;
}

.step h3 {
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
}

.step p {
  color: var(--muted);
  font-size: 1.12rem;
  max-width: 36ch;
}

.phone-col {
  position: relative;
}

.phone-pin {
  position: sticky;
  top: calc(var(--header) + max(24px, (100svh - var(--header) - 640px) / 2));
  display: grid;
  place-items: center;
}

.phone {
  --pw: 300px;
  position: relative;
  width: var(--pw);
  height: calc(var(--pw) * 2.12);
  border-radius: 46px;
  background: #1e2a22;
  padding: 11px;
  box-shadow:
    0 50px 80px -40px rgb(30 42 34 / 0.6),
    inset 0 0 0 2px #3a4a3f;
}

.phone::before {
  content: "";
  position: absolute;
  z-index: 3;
  top: 20px;
  left: 50%;
  width: 22px;
  height: 22px;
  translate: -50% 0;
  border-radius: 50%;
  background: #0d130f;
}

.screen-area {
  position: relative;
  height: 100%;
  border-radius: 36px;
  overflow: hidden;
  background: var(--bg);
  font-size: 13px;
  line-height: 1.35;
}

.screen {
  position: absolute;
  inset: 0 0 58px;
  padding: 44px 16px 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.45s ease,
    transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.phone[data-screen="0"] .screen:nth-child(1),
.phone[data-screen="1"] .screen:nth-child(2),
.phone[data-screen="2"] .screen:nth-child(3),
.phone[data-screen="3"] .screen:nth-child(4) {
  opacity: 1;
  transform: none;
}

.screen .meta {
  color: var(--muted);
  font-weight: 600;
  font-size: 11.5px;
}

.screen h4 {
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1.1;
  margin: 2px 0 4px;
}

.screen .sub {
  color: var(--muted);
  margin: 0 0 10px;
  font-size: 12px;
}

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid #c9c0ab;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 12px;
  text-align: center;
}

.seg span {
  padding: 6px;
}

.seg span:first-child {
  background: var(--accent-soft);
  border-right: 1px solid #c9c0ab;
}

.chips {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  white-space: nowrap;
}

.chips span {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--chip);
  font-weight: 600;
  font-size: 11.5px;
}

.chips span.on {
  background: var(--accent);
  color: #fff;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 7px;
}

.offer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 8px;
}

.offer-row b {
  font-size: 14.5px;
}

.offer-row small {
  color: var(--muted);
  font-size: 11px;
}

.offer-row .price {
  grid-row: 1 / 3;
  grid-column: 2;
  text-align: right;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.15;
}

.price .off {
  display: block;
  color: var(--savings);
  font-size: 11px;
}

.plan-day {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 2px 8px;
  align-items: center;
}

.plan-day .d {
  grid-row: 1 / 3;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 16px;
  color: var(--accent);
}

.plan-day b {
  font-size: 13.5px;
}

.plan-day small {
  color: var(--muted);
  font-size: 11px;
}

.total {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 10px;
  font-weight: 700;
  font-size: 17px;
}

.total em {
  font-style: normal;
  color: var(--savings);
  font-size: 13.5px;
}

.total small {
  color: var(--muted);
  font-weight: 400;
  font-size: 11.5px;
}

.list-group {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.list-group .group {
  padding: 8px 12px 4px;
  color: var(--muted);
  font-weight: 700;
  font-size: 11.5px;
}

.item {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 2px 10px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
}

.item i {
  grid-row: 1 / 3;
  width: 16px;
  height: 16px;
  border: 1.5px solid #6d756a;
  border-radius: 4px;
}

.item.done i {
  background: var(--accent);
  border-color: var(--accent);
}

.item.done b {
  color: var(--muted);
  text-decoration: line-through;
}

.item b {
  font-weight: 400;
  font-size: 13.5px;
}

.item small {
  color: var(--muted);
  font-size: 11px;
}

.item small mark {
  background: none;
  color: var(--savings);
  font-weight: 700;
}

.item .p {
  grid-row: 1 / 3;
  grid-column: 3;
  text-align: right;
  font-weight: 600;
  font-size: 13px;
}

.item .p s {
  display: block;
  color: var(--muted);
  font-weight: 400;
  font-size: 10.5px;
}

.pantry-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.pantry-actions span {
  padding: 9px;
  border-radius: 12px;
  background: var(--accent-soft);
  text-align: center;
  font-weight: 600;
  font-size: 12.5px;
}

.screen h5 {
  margin: 10px 0 6px;
  font-size: 13.5px;
}

.screen h5.soon-use {
  color: var(--savings);
}

.pantry-item b {
  display: block;
  font-weight: 400;
  font-size: 13.5px;
}

.pantry-item small {
  color: var(--muted);
  font-size: 11px;
}

.tabbar {
  position: absolute;
  inset: auto 0 0;
  height: 58px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--card);
  border-top: 1px solid var(--border);
  font-size: 9.5px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  padding-top: 8px;
}

.tabbar svg {
  display: block;
  width: 20px;
  height: 20px;
  margin: 0 auto 2px;
}

.phone[data-screen="0"] .tabbar span:nth-child(5),
.phone[data-screen="1"] .tabbar span:nth-child(1),
.phone[data-screen="2"] .tabbar span:nth-child(4),
.phone[data-screen="3"] .tabbar span:nth-child(3) {
  color: var(--accent);
}

@media (max-width: 860px) {
  .how {
    grid-template-columns: 1fr;
  }

  .phone-col {
    order: -1;
    z-index: 2;
    position: sticky;
    top: var(--header);
    align-self: start;
    padding-block: 8px 12px;
    background: var(--bg);
    box-shadow: 0 12px 16px -12px rgb(30 42 34 / 0.15);
  }

  .phone-pin {
    position: static;
  }

  .phone {
    zoom: 0.58;
  }

  .step {
    min-height: 60svh;
    justify-content: flex-end;
    padding-bottom: 12svh;
  }

  .step > * {
    background: var(--bg);
  }
}
