/* Keep the shared Beck Samuel atmosphere continuous behind portal content. */
.academy-hero::after,
.consulting-hero::after,
.papers-hero::after,
.rainmaker-hero::after {
  display: none !important;
}

/* Both desktop paper columns share one card baseline; mobile cards flow normally. */
.paper-group-heading {
  height: 175px;
  min-height: 175px;
}

@media (max-width: 760px) {
  .paper-group-heading {
    height: auto;
    min-height: 0;
  }
}

/* Assistant cards stay compact until the user intentionally reveals one. */
@media (min-width: 761px) {
  .assistant-card {
    max-height: 156px;
    padding: 26px 28px;
  }

  .assistant-card:hover,
  .assistant-card:focus-within {
    max-height: 560px;
  }
}

/* Preserve Lucy's portrait ratio on the dedicated contact page. */
.lucy-contact-portrait {
  width: min(100%, 240px);
  height: auto;
  aspect-ratio: 1170 / 933;
  overflow: visible;
}

.lucy-contact-portrait .lucy-particle-canvas {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  transform: scale(1.18);
  transform-origin: left center;
}

/* A quiet atmospheric divider before the shared Lucy section. */
.papers-page .lucy-intro,
.rainmaker-page .lucy-intro,
.consulting-page .lucy-intro {
  border-top: 1px solid rgba(64, 83, 211, .45);
}

@media (max-width: 760px) {
  .lucy-contact-portrait {
    width: 164px;
    height: auto;
    aspect-ratio: 1170 / 933;
  }

  .lucy-contact-portrait .lucy-particle-canvas {
    transform: none;
  }
}

/* On the dedicated contact page Lucy becomes the quiet, full-height background. */
@media (min-width: 761px) {
  .lucy-page-body .lucy-contact-card {
    overflow: hidden;
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "heading heading"
      "portrait form"
      "copy copy";
  }

  .lucy-page-body .lucy-contact-heading,
  .lucy-page-body .lucy-contact-form {
    position: relative;
    z-index: 1;
  }

  .lucy-page-body .lucy-contact-heading {
    justify-content: center;
    padding-right: 0;
    text-align: center;
  }

  .lucy-page-body .lucy-contact-heading h1 {
    max-width: calc(100% - 160px);
  }

  .lucy-page-body .lucy-contact-profile {
    display: contents;
    transform: none;
  }

  .lucy-page-body .lucy-contact-portrait {
    position: relative;
    grid-area: portrait;
    z-index: 1;
    width: min(100%, 480px);
    height: auto;
    aspect-ratio: 1170 / 933;
    margin: 0;
    align-self: start;
    overflow: visible;
    opacity: 1;
    pointer-events: none;
  }

  .lucy-page-body .lucy-contact-portrait .lucy-particle-canvas {
    width: 100%;
    height: 100%;
    transform: scale(1.04);
    transform-origin: left top;
    opacity: 1;
  }

  /* Hide the canvas edge while the wider particle blast is assembling. */
  .lucy-page-body .lucy-contact-portrait .lucy-particle-canvas:not(.is-assembled) {
    -webkit-mask-image: radial-gradient(ellipse 72% 72% at 42% 50%, #000 36%, rgba(0, 0, 0, .9) 57%, transparent 88%);
    mask-image: radial-gradient(ellipse 72% 72% at 42% 50%, #000 36%, rgba(0, 0, 0, .9) 57%, transparent 88%);
  }

  .lucy-page-body .lucy-contact-copy {
    grid-area: copy;
    align-self: end;
    width: min(100%, 920px);
    max-width: none;
    justify-self: center;
    text-align: center;
    padding-bottom: 2px;
  }

  .lucy-page-body .lucy-contact-form {
    grid-area: form;
    align-self: stretch;
  }

  .lucy-page-body .lucy-message-field textarea {
    height: clamp(96px, 14vh, 112px);
  }

  .lucy-page-body .lucy-form-actions {
    transform: translateY(-10px);
  }
}
