@import "colors";
@import "constants";

$procedure-context-breakpoint: $two-columns-breakpoint;
$procedure-description-line-height: 22px;

.procedure-preview {
  font-size: 24px;

  .paperless-logo {
    width: 100%;
    margin-bottom: 60px;

    @media (max-width: $procedure-context-breakpoint) {
      display: none;
    }
  }

  .simple {
    font-size: 24px;
    color: $blue;
    font-weight: bold;
  }

  .close-procedure {
    font-size: 12px;
  }

  .procedure-title {
    font-size: 26px;
    margin: 0 0 20px 0;
    text-align: center;

    @media (min-width: $procedure-context-breakpoint) {
      margin: 50px 0 32px;
      font-size: 30px;
      text-align: left;
    }
  }

  .procedure-auto-archive {
    cursor: pointer;

    margin-bottom: 32px;

    p {
      padding-top: 8px;
      font-size: 16px;
    }

    summary {
      font-size: 20px;

      // Hide the default triangle details marker
      list-style: none;
      // (using the non-standard way for Chrome.)
      &::-webkit-details-marker {
        display: none;
      }
    }
  }

  .procedure-auto-archive-title {
    border-bottom: 1px dotted $blue;
  }

  .procedure-description {
    font-size: 16px;

    p:not(:last-of-type) {
      // Space the paragraphs by exactly one line height,
      // so that the text always is truncated in the middle of a line,
      // regarless of the number of paragraphs.
      margin-bottom: 3 * $default-spacer;
    }
  }

  .read-more-button {
    display: none;
  }

  @media (max-width: $procedure-context-breakpoint) {
    // Truncate description and display the "Read more" UI if the text is too long
    .procedure-description-body.read-more-collapsed {
      // Setting the description at 25% of the viewport height:
      // - displays more text on screens having more vertical space (like small tablets);
      // - is enough for the action buttons to be visible on the bottom (even on mobiles).
      max-height: 25vh;

      // If the text exceeds the max-height,
      // truncate it and displays the "Read more" button.
      &.read-more-enabled {
        overflow: hidden;
        border-bottom: 1px solid $border-grey;

        + .read-more-button {
          display: block;
          position: relative;
          margin-left: auto;
          margin-right: auto;
          top: -19px;
          margin-bottom: -19px;
        }
      }
    }
  }

  .procedure-logos {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 20px;

    > :not(:last-child) {
      margin-right: $default-padding;
    }

    img {
      max-width: 100%;
      max-height: 50px;

      // Fix Chrome flexbox issue
      // See https://github.com/philipwalton/flexbugs/issues/225
      width: 100%;
      height: 100%;
      min-width: 0;
      object-fit: contain;

      @media (min-width: $procedure-context-breakpoint) {
        max-width: 500px;
        max-height: 130px;
      }
    }
  }
}

.procedure-context-content {
  @media (max-width: $procedure-context-breakpoint) {
    input[type=submit] {
      margin-bottom: 2 * $default-padding;
    }
  }
}
