.promises {
  border-top: 1px solid #e6efe9;
  border-bottom: 1px solid #e6efe9;
  background-color: #f6faf7;
}

.promises__wrap {
  display: flex;
  flex-direction: column;
  gap: 64px;
  max-width: 1152px;
  width: 100%;
  min-width: 0;
}

.promises__head {
  text-align: center;
}

.promises__title {
  margin-top: 0;
}

.promises__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.promises__card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  border: 1px solid #e6efe9;
  border-radius: 28px;
  background-color: var(--opt-white);
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

/* Only where there is a pointer to hover with. On a tablet a tap leaves :hover on, and the
   tapped card stayed tilted until the next tap somewhere else. */
@media (hover: hover) {
  .promises__card:hover {
    border-color: #9fd2b4;
    box-shadow: 0 40px 70px -40px rgba(0, 80, 40, 0.5);
    transform: perspective(900px) rotateX(4deg) rotateY(-4deg) translateY(-6px);
  }
}

.promises__visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 240px;
  background: radial-gradient(260px 180px at 50% 40%, var(--opt-mint), #f6faf7);
}

.promises__stage {
  perspective: 700px;
}

.promises__stage--deep {
  perspective: 800px;
}

.promises__tiles {
  display: grid;
  grid-template-columns: repeat(3, 46px);
  gap: 10px;
  transform: rotateX(55deg) rotateZ(-38deg);
  transform-style: preserve-3d;
}

.promises__tile {
  width: 46px;
  height: 46px;
  border: 1px solid var(--opt-line-green);
  border-radius: 10px;
  background-color: var(--opt-white);
}

.promises__tile--lift {
  border-color: #e3bde7;
  background-color: #f2c9fa;
  box-shadow: 0 18px 24px -10px rgba(146, 0, 127, 0.5);
  animation: promises-lift 2.6s ease-in-out infinite;
}

/* top: 23px centres the stack in its panel. The three layers climb the panel as they rise (the
   top one is at translateZ 68px), so the drawing sat high: measured, 4px under the top edge and
   51px above the bottom one on a phone (210px panel), 19px and 66px on desktop (240px). Moved
   down 23px the two margins are equal at every width (27 / 28px on a phone, 42 / 43px on
   desktop), which also leaves the room the layers need when they lift in the animation below. */
.promises__stack {
  position: relative;
  top: 23px;
  width: 130px;
  height: 130px;
  transform: rotateX(58deg) rotateZ(-38deg);
  transform-style: preserve-3d;
}

.promises__layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--opt-line-green);
  border-radius: 16px;
  background-color: rgba(255, 255, 255, 0.92);
  font-size: 14px;
  font-weight: 800;
  color: #111111;
}

.promises__layer--server {
  transform: translateZ(0);
}

/* The stack breathes: the Cache and Visitor layers lift away from the Server layer and settle
   back, on the same 2.6s ease-in-out loop as the tiles of the first card (promises-lift), so the
   three cards move together. The Visitor layer starts 0.2s after the Cache layer, which makes the
   lift read as a ripple through the stack instead of one block. At the top of the loop the three
   layers are evenly spaced (0 / 44 / 88px); at rest they are at 0 / 34 / 68px as before, which
   is also the first frame, so nothing jumps when the animation starts. The lift is kept to what
   the panel has room for: at 50 / 100px the top layer went 24px past the top edge of a phone
   panel and was cut off by the card. */
.promises__layer--cache {
  border-color: #e9c8bd;
  background-color: rgba(255, 205, 183, 0.92);
  color: var(--opt-white);
  transform: translateZ(34px);
  animation: promises-stack-cache 2.6s ease-in-out infinite;
}

.promises__layer--visitor {
  transform: translateZ(68px);
  animation: promises-stack-visitor 2.6s ease-in-out 0.2s infinite;
}

.promises__layer-label {
  transform: rotateZ(38deg) rotateX(-20deg);
}

.promises__badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  border-radius: 28px;
  background: linear-gradient(150deg, #ffd440, #fce68e);
  box-shadow: 0 30px 40px -20px rgba(0, 80, 40, 0.6);
  animation: promises-spin 6s linear infinite;
}

.promises__badge svg {
  fill: none;
  stroke: var(--opt-white);
}

.promises__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 26px 28px 30px;
}

.promises__card-title {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.03em;
  color: var(--opt-ink);
}

.promises__card-title--tall {
  min-height: 51px;
}

.promises__card-text {
  max-width: 300px;
  margin: 0;
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--opt-body);
}

@keyframes promises-lift {
  0%,
  100% {
    transform: translateZ(0);
  }

  50% {
    transform: translateZ(26px);
  }
}

@keyframes promises-stack-cache {
  0%,
  100% {
    transform: translateZ(34px);
  }

  50% {
    transform: translateZ(44px);
  }
}

@keyframes promises-stack-visitor {
  0%,
  100% {
    transform: translateZ(68px);
  }

  50% {
    transform: translateZ(88px);
  }
}

@keyframes promises-spin {
  from {
    transform: rotateY(0deg);
  }

  to {
    transform: rotateY(360deg);
  }
}

/* Tablet: one card per row, laid out sideways (artwork left, text right) instead of
   a tall stack or two cards with one left over. */
@media (max-width: 899.98px) {
  .promises__wrap {
    gap: 40px;
  }

  .promises__grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .promises__card {
    flex-direction: row;
    gap: 0;
  }

  .promises__visual {
    flex: 0 0 42%;
    height: auto;
    min-height: 220px;
  }

  .promises__body {
    flex: 1 1 0;
    justify-content: center;
    padding: 24px 28px;
  }

  /* The reserved second title line only exists to align cards side by side. */
  .promises__card-title--tall {
    min-height: 0;
  }
}

/* Phone: the card is stacked again, with a shorter artwork area and tighter text. */
@media (max-width: 575.98px) {
  .promises__wrap {
    gap: 32px;
  }

  .promises__card {
    flex-direction: column;
  }

  .promises__visual {
    flex: 0 0 auto;
    min-height: 0;
    height: 210px;
  }

  .promises__body {
    padding: 20px 20px 24px;
  }

  .promises__card-text {
    max-width: none;
    font-size: 15px;
  }
}

/* Tablet, one row per card (artwork left, text right). */
@media (min-width: 576px) and (max-width: 899.98px) {
  /* The three rows are as tall as the tallest one. They were 262 / 222 / 237px at 768px,
     because each took the height of its own paragraph, so the artwork panels were three
     different sizes and the artwork sat at three different heights. */
  .promises__grid {
    grid-auto-rows: 1fr;
  }

  /* The panel's own tone. The 3-column layout fades the panel into the section's #f6faf7,
     which is fine on top of a card, but in a row it dissolved the whole left half of the
     card into the page and left a white panel on the right with two rounded corners: it
     looked like half a card. The edge colour is now a visible mint, and the border and a
     soft shadow outline the card. */
  .promises__card {
    border-color: #d4e8db;
    box-shadow: 0 22px 40px -32px rgba(0, 80, 40, 0.4);
  }

  .promises__visual {
    background: radial-gradient(260px 180px at 50% 45%, var(--opt-mint), #e9f4ed);
  }

  /* The paragraph stopped at 300px and left 70-100px of blank at the right of a 430-500px
     column; 420px is about 55 characters a line. text-wrap: pretty keeps a last line from
     being one word ("lab.", "else."). */
  .promises__card-text {
    max-width: 420px;
    text-wrap: pretty;
  }
}

@media (prefers-reduced-motion: reduce) {
  .promises__card {
    transition: none;
  }

  .promises__card:hover {
    transform: none;
  }

  .promises__tile--lift,
  .promises__layer--cache,
  .promises__layer--visitor,
  .promises__badge {
    animation: none;
  }
}
