/* How It Works block — full-bleed deep-violet band that doubles as a page break.
 *
 * Violet, NOT navy. Navy was the first attempt and it duplicated the footer
 * exactly, so the block and the footer merged into one dark mass at the foot of
 * the page with only a hairline between them. Deep violet separates the two and
 * bookends the page against the hero, which is the same violet world — so the
 * page now reads violet → light → white → violet → navy, darkening into the
 * footer instead of colliding with it.
 *
 * Full-bleed uses the same centred-container break-out as the countdown block;
 * the resulting overflow is clipped by #page (see _alignment.scss). */

.ep-hiw-block {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: clamp(2.75rem, 5vw, 4.25rem) 1.25rem;
  background: #1b0b38;
  color: #fff;
}

.ep-hiw {
  max-width: 1360px;
  margin: 0 auto;
}

.ep-hiw__heading {
  margin: 0 0 clamp(2rem, 4vw, 3rem);
  text-align: center;
  color: #fff;
  font-size: var(--ep-fs-h2, 1.75rem);
  line-height: var(--ep-lh-tight, 1.2);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ---- Steps ---------------------------------------------------------------
   One row on desktop. The connector line is drawn on the <ol> rather than per
   step so it can stop at the first and last marker instead of running off the
   edges — a deliberate difference from the reference, where the rule bleeds
   past both ends. */

.ep-hiw__steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--ep-hiw-count, 4), 1fr);
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.ep-hiw__steps::before {
  content: "";
  position: absolute;
  top: 1.375rem; /* centre of a 2.75rem marker */
  /* Start and end at the centre of the first and last marker. */
  left: calc(100% / var(--ep-hiw-count, 4) / 2);
  right: calc(100% / var(--ep-hiw-count, 4) / 2);
  height: 2px;
  /* Echoes the ticket progress bar on the competition cards. */
  background: linear-gradient(90deg, #7c3aed 0%, #a855f7 100%);
  opacity: 0.75;
}

.ep-hiw__step {
  position: relative;
  text-align: center;
  padding: 0 0.5rem;
}

.ep-hiw__marker {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0 auto 1.125rem;
  border-radius: 50%;
  background: #7c3aed;
  color: #fff;
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: var(--ep-fs-lg, 1.125rem);
  line-height: 1;
  /* The ring separates the marker from the connector line running behind it. */
  box-shadow: 0 0 0 6px #1b0b38;
}

.ep-hiw__step-title {
  margin: 0 0 0.5rem;
  color: #fff;
  font-size: var(--ep-fs-h5, 1.125rem);
  line-height: var(--ep-lh-tight, 1.2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ep-hiw__step-text {
  margin: 0 auto;
  max-width: 32ch;
  color: rgba(255, 255, 255, 0.72);
  font-size: var(--ep-fs-sm, 0.875rem);
  line-height: var(--ep-lh-base, 1.6);
}

/* ---- Free entry ----------------------------------------------------------
   Deliberately visible rather than buried. The free postal route is what
   carries the prize-competition exemption, and it must not be materially
   harder to find than the paid one — so it sits in the same band as the paid
   flow, not in a footer link. */

.ep-hiw__free {
  margin: clamp(2rem, 4vw, 3rem) auto 0;
  max-width: 62ch;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  text-align: center;
  color: rgba(255, 255, 255, 0.72);
  font-size: var(--ep-fs-sm, 0.875rem);
  line-height: var(--ep-lh-base, 1.6);
}

.ep-hiw__free-link {
  color: #fff;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  white-space: nowrap;
}

.ep-hiw__free-link:hover,
.ep-hiw__free-link:focus {
  color: #c9b6f5;
}

/* ---- Stacked ------------------------------------------------------------- */

@media (max-width: 767px) {
  .ep-hiw__steps {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  /* A single full-height rule would run behind the titles and body copy once
     the steps stack. Instead each step after the first draws a short segment
     into the gap above its own marker, so the sequence still reads without the
     line crossing any text. */
  .ep-hiw__steps::before {
    display: none;
  }

  .ep-hiw__step + .ep-hiw__step::before {
    content: "";
    position: absolute;
    top: -2rem; /* the grid gap */
    left: 50%;
    width: 2px;
    height: 2rem;
    transform: translateX(-1px);
    background: linear-gradient(180deg, rgba(124, 58, 237, 0.15) 0%, #7c3aed 100%);
  }

  .ep-hiw__step-text {
    max-width: 40ch;
  }
}

/* Editor preview sits inside a narrower canvas; drop the viewport break-out so
   it does not overflow the block list. */
.ep-hiw-block.is-admin {
  width: auto;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}

/* Sit flush against the footer.
 *
 * The page templates put `pb-5` (3rem) on #content, which showed as a thin
 * white strip between this band and the footer — reading as a mistake rather
 * than a separation. When the band is the last thing in the content, it
 * swallows that padding so the violet runs straight into the footer's darker
 * ground. Keyed to Bootstrap's pb-5; if the container class changes, this
 * value follows it. */
.entry-content > .ep-hiw-block:last-child,
.ep-hiw-block:last-child {
  margin-bottom: -3rem;
}

.ep-hiw-block.is-admin:last-child {
  margin-bottom: 0;
}
