/*
 * The content blocks (components/blocks/*.scss), converted to plain CSS
 * (ADR-0007). `.block` itself is in base.css.
 */

.block--heading {
  margin-top: var(--spacing-l);
  line-height: 1.1;
}

.block--app {
  display: flex;
  align-items: center;
}

.block--app--icon {
  width: 3.5em;
  height: 3.5em;
  margin-right: 1em;

  svg {
    width: 100%;
    height: auto;
  }
}

.block--app--text p:last-child {
  margin: 0;
}

.block--audio {
  margin: var(--spacing-lm) 0;

  --plyr-audio-controls-background: #ebebeb;
  --plyr-color-main: black;
  --plyr-audio-control-color-hover: rgba(0, 0, 0, 0.5);
  --plyr-audio-control-color: black;
  --plyr-audio-control-background-hover: rgba(0, 0, 0, 0);
  --plyr-range-thumb-height: 11px;
  --plyr-range-track-height: 1px;
  --plyr-range-thumb-background: black;
  --plyr-range-thumb-shadow: none;
  --plyr-tooltip-background: black;
  --plyr-tooltip-color: white;

  /* paragraphStyle('small'), with its own line height */
  .plyr__time,
  .plyr__tooltip {
    font-size: var(--font-size-small);
    letter-spacing: 0.03em;
    font-weight: 200;
    line-height: 1;
  }

  /* The browser's own player, in Plyr's box, until Plyr takes it over (and
     takes its controls away) and without scripts. */
  audio[controls] {
    display: block;
    width: 100%;
    height: 52px;
  }
}

/* The gallery as it shows in the page; its lightbox is in lightbox.css. */
.block--gallery {
  margin: var(--spacing-lm) auto;
  max-width: 80%;

  a:hover {
    opacity: 1 !important;
  }

  &.large-preview {
    max-width: unset;
    margin-left: calc(-1 * var(--spacing-m));
    width: calc(100% + var(--spacing-m) + var(--spacing-m));

    figcaption {
      max-width: calc(100% - var(--spacing-m) - var(--spacing-m));
      margin-left: auto;
      margin-right: auto;
    }
  }

  img {
    cursor: pointer;
  }
}

.block--quote {
  margin: var(--spacing-lm) 0;

  /* paragraphStyle('medium_text'), with its own line height */
  blockquote {
    font-size: var(--font-size-medium);
    font-weight: 200;
    line-height: 1.25;
    text-align: center;
  }
}

/* Plyr's video player (assets/js/video.js), in the old colours. */
.block--video {
  margin: var(--spacing-lm) 0;

  --plyr-color-main: #5e5e5e;
  --plyr-range-fill-background: #ebebeb;

  /* paragraphStyle('small'), with its own line height */
  .plyr__time,
  .plyr__tooltip {
    font-size: var(--font-size-small);
    letter-spacing: 0.03em;
    font-weight: 200;
    line-height: 1;
  }

  /* The volume as wide as in the old site's Plyr 3.6: 3.8 moved its limits
     from the volume to its slider. */
  .plyr__volume {
    max-width: 110px;
    min-width: 80px;
    width: 20%;

    input[type='range'] {
      max-width: none;
      min-width: 0;
    }
  }

  /* The 16:9 box the embed sits in until Plyr takes it over. */
  .iframe-wrapper {
    position: relative;
    overflow: hidden;
    width: 100%;
    padding-top: 56.25%;

    iframe {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      border: 0;
    }

    /* Before the visitor accepts (ADR-0010): 16:9 too, but taller if its
       text needs it, as on a phone. */
    &:has(.video-consent) {
      padding-top: 0;
    }
  }

  .video-consent {
    aspect-ratio: 16 / 9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-s);
    padding: var(--spacing-m);
    background: #ebebeb;
    text-align: center;
    /* paragraphStyle('small') */
    font-size: var(--font-size-small);
    letter-spacing: 0.03em;
    font-weight: 200;
  }

  .video-consent__text {
    max-width: 32em;

    p {
      margin: 0;
      hyphens: manual;
    }
  }

  .video-consent__load {
    font: inherit;
    letter-spacing: inherit;
    font-weight: 400;
    color: var(--color-bg);
    background: var(--plyr-color-main);
    border: 0;
    border-radius: 3px;
    padding: 0.6em 1.2em;
    text-decoration: none;
    cursor: pointer;

    @media (hover: hover) {
      transition: opacity var(--transition-fast);

      &:hover {
        opacity: 0.7;
      }
    }
  }
}
