:root {
  --funnel: #485fc7;
  --funnel-soft: #eef1fb;
}

/* Custom elements default to display:inline, which breaks Bulma's block/flex
   layout (padding, margins, widths). See NOTES.md (bulma-js findings). */
b-section,
b-container,
b-columns,
b-box,
b-field,
b-input,
b-column,
b-title {
  display: block;
}

b-columns {
  min-width: 0;
}

b-column,
.funnel,
.funnel-mouth,
b-input,
b-field {
  min-width: 0;
  max-width: 100%;
}

.headline,
.answer,
.fineprint {
  overflow-wrap: anywhere;
}

.headline {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  min-height: 3em;
}

.funnel {
  text-align: center;
}

/* Close the gap Bulma's .columns:not(:last-child) margin leaves above the neck. */
.columns.funnel-top:not(:last-child) {
  margin-bottom: 0;
}

/* Funnel neck: an hourglass shape that runs from the outer bottom corners of
   the example boxes, pinches in the middle, and widens to the input's top
   edges. CSS clip-path only. */
.funnel-neck {
  height: 8rem;
  margin-top: -0.75rem; /* cancel the columns' bottom padding so the neck meets the boxes */
  background: var(--funnel);
  clip-path: polygon(0 0, 100% 0, 54% 50%, 100% 100%, 0 100%, 46% 50%);
}

/* The mouth: huge input. */
.funnel-mouth {
  margin: 0 auto;
  max-width: 100%;
}

#name .input {
  height: auto;
  padding: 0.6em 0.8em;
  font-size: clamp(2rem, 7vw, 4rem);
  text-align: center;
  border: 3px solid var(--funnel);
}

/* Bottom of the funnel: narrowing, with the answer in big type. */
.funnel-bottom {
  background: var(--funnel-soft);
  clip-path: polygon(0 0, 100% 0, 85% 100%, 15% 100%);
  margin-top: 0;
  padding: 1.5rem 15% 2.5rem;
}

.answer {
  font-size: clamp(2.5rem, 10vw, 6rem);
  font-weight: 700;
  line-height: 1.1;
  min-height: 1.1em;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.answer[data-empty] {
  color: #b5b5b5;
}

.reroll {
  margin-top: 2rem;
  text-align: center;
}

.fineprint {
  margin-top: 1rem;
  text-align: center;
  color: #7a7a7a;
  font-size: 0.875rem;
}

/* Below Bulma's tablet breakpoint: columns stack (Bulma does that), funnel becomes an arrow. */
@media screen and (max-width: 768px) {
  .funnel-neck {
    height: 2.5rem;
    width: 3rem;
    margin: 0.5rem auto;
    clip-path: polygon(35% 0, 65% 0, 65% 50%, 100% 50%, 50% 100%, 0 50%, 35% 50%);
  }

  .funnel-bottom {
    clip-path: none;
    border-radius: 0.5rem;
    margin-top: 0.5rem;
    padding: 1rem 0.75rem 1.25rem;
  }
}

@media (prefers-color-scheme: dark) {
  .funnel-bottom {
    background: #2b2f45;
  }

  .answer[data-empty] {
    color: #666;
  }
}
