/**
 * @file
 * Node Teaser specific styles.
 */

@import "../base/media-queries.pcss.css";

.node--view-mode-teaser {
  position: relative; /* Anchor after pseudo-element. */
  margin-block-end: var(--sp1-5);

  &::after {
    position: absolute;
    inset-block-end: 0;
    width: var(--sp3);
    height: 0;
    content: "";
    /* Intentionally not using CSS logical properties. */
    border-top: solid 2px var(--color--gray-95);
  }

  & .node__meta {
    margin-block-end: var(--sp);

    & a {
      color: var(--color-text-primary-medium);
      font-weight: bold;
    }
  }

  & .node__top-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin: 0;

    @media (--lg) {
      position: relative; /* Anchor the image */
    }
  }

  & .primary-image {
    flex-shrink: 0;
    margin: 0;
    margin-block-end: var(--sp1);
    margin-inline-end: var(--sp1);

    /* Ensure title does not wrap under image until necessary. */
    & + .node__title {
      flex-basis: calc(100% - calc(4.5 * var(--sp)));

      @media (--lg) {
        flex-basis: auto;
      }
    }

    & a {
      display: block;
    }

    & img {
      width: calc(3.5 * var(--sp));
      height: calc(3.5 * var(--sp));
      object-fit: cover;
      border-radius: 50%;

      @media (--lg) {
        width: var(--grid-col-width);
        height: var(--grid-col-width);
      }
    }

    @media (--lg) {
      position: absolute;
      inset-block-start: 0;
      inset-inline-start: calc(-1 * ((var(--grid-col-width) + var(--grid-gap))));
      margin: 0;
    }
  }

  & .node__title {
    margin: 0;
    margin-block-end: var(--sp1);
    color: var(--color-text-neutral-loud);
    font-size: 24px;
    line-height: var(--line-height-base);

    @media (--lg) {
      font-size: var(--sp2);
      line-height: var(--sp3);
    }
  }

  & .field--tag-ref {
    margin-block-start: var(--sp1);
    margin-block-end: 0;
    margin-inline-start: 0;
    margin-inline-end: 0;
    padding-block: 0;
    padding-inline-start: 0;
    padding-inline-end: 0;
    background-color: transparent;

    @media (--lg) {
      margin-block-start: var(--sp2);
    }
  }

  @media (--lg) {
    margin-block-end: var(--sp3);
  }
}

.views-row:last-child .node--view-mode-teaser {
  margin-block-end: 0;
}
