/* css/blocks/307-custom-page-blocks.css */
/* =================== custom-page blocks =================== */
/* Blocks the custom-page template (/p/*) has always been able to render and
 * nothing has ever styled: the markup existed, the CSS did not, so a page that
 * used them came out as unstyled full-bleed text.
 *
 * Described once here, with explicit modifiers — no page-scoped overrides. The
 * column these sit in belongs to .page-custom .hc-wrap (171-hc-wrap.css), so
 * nothing here sets its own width. */

/* A heading over a card grid is a section heading inside an article, not a
 * page title: t-title set it at 36px, competing with the H1 above it. */
.cp-cards__title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: var(--hc-ink, #1a1714);
  font-size: clamp(22px, 2vw, 28px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.cp-cards__title::before {
  content: "";
  flex: 0 0 34px;
  width: 34px;
  height: 4px;
  border-radius: 999px;
  background: var(--hc-accent, #2864dc);
}

.cp-cards__grid {
  display: grid;
  /* Procedural cards often contain several paragraphs imported from the donor.
     Narrow equal columns turn those steps into metre-long text strips. */
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin-top: 22px;
  counter-reset: cp-card;
}

.cp-cards__item {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px 18px;
  min-height: 136px;
  padding: 26px 30px;
  border: 1px solid #dce5f4;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(43, 102, 220, .075), transparent 42%),
    var(--hc-surface, #fff);
  box-shadow: 0 12px 32px rgba(31, 55, 94, .06);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.cp-cards__item::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--hc-accent, #2864dc);
}

.cp-cards__item:hover {
  border-color: color-mix(in srgb, var(--hc-accent) 34%, var(--hc-line, #e6e9ef));
  box-shadow: 0 16px 38px rgba(31, 55, 94, .11);
  transform: translateY(-2px);
}

/* The step number. A numeral, not an illustration — set as a counter chip so a
 * procedure reads as ordered without asking the page for an icon set. */
.cp-cards__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 1px solid color-mix(in srgb, var(--hc-accent) 22%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--hc-accent) 10%, #fff);
  color: var(--hc-accent);
  font: 700 16px/1 var(--hc-mono, "JetBrains Mono", monospace);
  grid-row: 1 / span 2;
}

.cp-cards__item h4 {
  grid-column: 2;
  margin: 0;
  color: var(--hc-ink, #1a1714);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

.cp-cards__item p {
  grid-column: 2;
  margin: 0;
  color: #536074;
  font-size: 15px;
  line-height: 1.65;
}

/* A list of one-line requirements reads better as a dense grid than as cards
 * with a heading each; the modifier is on the block, set by the template. */
.cp-cards--dense .cp-cards__grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.cp-cards--dense .cp-cards__item {
  counter-increment: cp-card;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 88px;
  padding: 18px 22px;
  background:
    radial-gradient(circle at 100% 0, rgba(43, 102, 220, .09), transparent 42%),
    #fff;
}

.cp-cards--dense .cp-cards__item::before {
  content: counter(cp-card, decimal-leading-zero);
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: var(--hc-accent, #2864dc);
  background: #edf3ff;
  font: 700 12px/1 var(--hc-mono, "JetBrains Mono", monospace);
  letter-spacing: .04em;
}

.cp-cards--dense .cp-cards__item p {
  grid-column: 2;
  color: #344158;
  font-weight: 500;
}

/* A three/seven-item list must not end with a half-width orphan and an empty
   white cell beside it. The final odd card completes the row. */
.cp-cards--dense .cp-cards__item:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

@media (max-width: 700px) {
  .cp-cards__title {
    align-items: flex-start;
    font-size: 22px;
  }

  .cp-cards__title::before {
    flex-basis: 24px;
    width: 24px;
    margin-top: 12px;
  }

  .cp-cards__item {
    grid-template-columns: 44px minmax(0, 1fr);
    min-height: 0;
    padding: 20px 18px;
  }

  .cp-cards__icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .cp-cards--dense .cp-cards__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .cp-cards--dense .cp-cards__item {
    min-height: 76px;
    padding: 14px 16px;
  }
}

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

  .cp-cards__item:hover {
    transform: none;
  }
}
