/* Hero panel block — loaded on the front end and in the editor. */

.hero-panel {
  position: relative;
  box-sizing: border-box;
  padding: var(--wp--preset--spacing--60);
  border-radius: clamp(24px, 0.75vw + 21.6px, 36px);
  background-color: var(--wp--preset--color--primary);
  color: var(--wp--preset--color--base);
}

/* `.hero-panel >` outweighs the flow layout's gap, which would push it
   down: a margin moves an absolutely placed box too. */
.hero-panel > .hero-panel-icon {
  margin: 0;
}

/* A few pixels below the padding: level with the tops of the letters of
   the first line, not with its line box. */
.hero-panel-icon {
  position: absolute;
  top: calc(var(--wp--preset--spacing--60) + 6px);
  right: var(--wp--preset--spacing--60);
  width: 36px;
  height: 36px;
  background-color: var(--wp--preset--color--secondary);
  mask: var(--hero-panel-icon) no-repeat center / contain;
  -webkit-mask: var(--hero-panel-icon) no-repeat center / contain;
}

/* Yellow (Security & Fraud): navy text, and a larger navy icon above the
   title instead of in the corner. The icon stays last in the markup and
   placed absolutely (see render.php); the padding makes its room. */
.hero-panel--yellow {
  background-color: var(--wp--preset--color--secondary);
  color: var(--wp--preset--color--primary);
}

.hero-panel--yellow:has(> .hero-panel-icon) {
  padding-top: calc(2 * var(--wp--preset--spacing--60) + 44px);
}

.hero-panel--yellow > .hero-panel-icon {
  top: var(--wp--preset--spacing--60);
  right: auto;
  left: var(--wp--preset--spacing--60);
  width: 44px;
  height: 44px;
  background-color: var(--wp--preset--color--primary);
}

/* Label and value pairs under a line (Payments). */
.hero-panel .wp-block-table {
  margin-top: var(--wp--preset--spacing--50);
}

.hero-panel .wp-block-table table {
  border-collapse: collapse;
  border-top: 1px solid color-mix(in srgb, var(--wp--preset--color--secondary) 60%, transparent);
}

.hero-panel .wp-block-table td {
  padding: var(--wp--preset--spacing--50) 0 0;
  border: 0;
  font-size: var(--wp--preset--font-size--large);
  font-weight: 200;
  line-height: 1.3;
  vertical-align: top;
}

.hero-panel .wp-block-table td + td {
  padding-left: var(--wp--preset--spacing--40);
  font-weight: 600;
}

/* A Column breaks words anywhere (core's word-break on .wp-block-column),
   which splits a label mid-word on a phone. */
.hero-panel .wp-block-table td {
  word-break: normal;
  overflow-wrap: normal;
}

@media (max-width: 599px) {
  .hero-panel .wp-block-table td {
    font-size: var(--wp--preset--font-size--medium);
  }
}

/* Narrow phones: tighter padding, and everything inside a size smaller.
   !important because the preset classes carry it themselves. */
@media (max-width: 424px) {
  .hero-panel {
    padding: var(--wp--preset--spacing--50);
  }

  .hero-panel-icon {
    top: calc(var(--wp--preset--spacing--50) + 5px);
    right: var(--wp--preset--spacing--50);
    width: 28px;
    height: 28px;
  }

  .hero-panel--yellow:has(> .hero-panel-icon) {
    padding-top: calc(2 * var(--wp--preset--spacing--50) + 36px);
  }

  .hero-panel--yellow > .hero-panel-icon {
    top: var(--wp--preset--spacing--50);
    left: var(--wp--preset--spacing--50);
    width: 36px;
    height: 36px;
  }

  .hero-panel .wp-block-table td {
    font-size: var(--wp--preset--font-size--small);
  }

  .hero-panel .has-huge-font-size {
    font-size: var(--wp--preset--font-size--xxl) !important;
  }

  .hero-panel .has-xxl-font-size {
    font-size: var(--wp--preset--font-size--xl) !important;
  }

  .hero-panel .has-xl-font-size {
    font-size: var(--wp--preset--font-size--large) !important;
  }

  .hero-panel .has-large-font-size {
    font-size: var(--wp--preset--font-size--medium) !important;
  }

  .hero-panel .has-medium-font-size {
    font-size: var(--wp--preset--font-size--normal) !important;
  }
}

/* --------- In the hero --------- */

/* The panel sits in a Column beside the hero's text and hangs past the
   hero's lower edge by half the next section's top padding, so it never
   reaches that section's heading. The Column in the selector: core's flow
   layout zeroes a first and last child's margins with a rule of the same
   weight as `.hero .hero-panel`, printed later. */
.hero .wp-block-column > .hero-panel {
  margin-block-end: calc(-1 * (var(--hero-padding-bottom) + var(--wp--preset--spacing--80) / 2));
}

.hero .wp-block-columns:has(.hero-panel) {
  margin-bottom: 0;
}

/* Beside the text it rises a little above the title, and its right edge
   lines up with the header bar's (the wide size) rather than the text's. */
.hero .wrapper:has(.hero-panel) {
  container-type: inline-size;
}

@media (min-width: 1024px) {
  .hero .wp-block-column > .hero-panel {
    margin-block-start: calc(-1 * var(--wp--preset--spacing--60));
    margin-right: calc((min(100cqw, var(--wp--style--global--wide-size)) - min(100cqw, var(--wp--style--global--content-size))) / -2);
  }
}

/* Narrower, both columns ask for the whole row: beside the text they share
   it half and half, and below 782, where core's Columns stack, the panel
   goes under the text, no wider than it is drawn at 1440. The section after
   the hero moves down by the panel's overhang, so its heading keeps its full
   top padding clear. Only a section without a background: on a coloured
   one the margin would show as a white strip. */
@media (max-width: 1023px) {
  .hero:has(.hero-panel) + .alignfull:not(.has-background) {
    margin-block-start: calc(var(--wp--preset--spacing--80) / 2);
  }

  .hero .wp-block-columns:has(.hero-panel) > .wp-block-column {
    flex-basis: 100% !important;
  }

  .hero .hero-panel {
    max-width: 580px;
  }
}

/* On a phone the hero's text sits 15px in from the page gutter
   (blocks/hero/style.css); the panel goes back out to it, in line with
   the cards below, for the room. */
@media (max-width: 599px) {
  .hero .wp-block-column > .hero-panel {
    margin-inline: -15px;
  }
}
