/**
 * node.css
 * - standard page
 */

/**
 * STANDARD PAGE: Banner
 */
.banner {
  position: relative;
  min-height: 350px;

  & > div {
    display: grid;
    grid-template-columns: 1fr;
  }
}

#block-views-block-banner-block-banner {
  position: relative;

  & .views-field-field-featured-image {
    position: absolute;

    &::before {
      content: '';
      position: absolute;
      inset: 0;
      background: rgba(10, 70, 65, 0.5);
      z-index: 1;
    }

    & img {
      display: block;
      object-fit: cover;
      object-position: center;
      height: 350px;
      position: relative;
      z-index: 0;
    }
  }

  & .views-field-title {
    padding-top: 0.5rem;

    @media (min-width: 768px) {
      padding-top: 2.5rem;
    }
  }

  & .views-field-title,
  & .views-field-body {
    position: relative;
    color: white;
    padding-left: calc((100% - var(--layout-width))/2);
    z-index: 2;
    max-width: calc(100% - 4rem);
    margin: 0 auto;
  }

  & .views-field-title,
  & .views-field-body p {
    text-shadow: 2px 4px 4px rgba(0, 0, 0, 0.5);
  }

}

.taxa-search-redirect-form {
  & #edit-query--description {
    text-shadow: 2px 4px 4px rgba(0, 0, 0, 0.5);
  }
}

#block-views-block-banner-block-decorative-banner {
  position: relative;

  & .views-field-field-featured-image {
    position: absolute;
    overflow: hidden;

    &::before {
      content: '';
      position: absolute;
      inset: 0;
      background: rgba(10, 70, 65, 0.5);
      z-index: 1;
    }

    &::after {
      content: '';
      display: block;
      position: absolute;
      width: 1000px;
      height: 1000px;
      background-image: url(/themes/sprat/images/logos/dcceew-ripple.png);
      background-size: contain;
      background-repeat: no-repeat;
      background-position: center;
      right: -525px;
      top: -350px;
      z-index: 1;
    }

    & img {
      display: block;
      object-fit: cover;
      object-position: center;
      height: 350px;
      position: relative;
      z-index: 0;
      right: 250px; /* An after element covers the gap */
    }
  }
}

body.half-banner {
  .banner {
    min-height: 175px;
    #block-views-block-banner-block-decorative-banner  {
      & .views-field-field-featured-image {
        &::after {
          top: -400px;
        }
        & img {
          height: 175px;
        }
      }

    }
  }
  &.path-listing .layout-content {
    margin: 40px 0;
  }
}

/**
 * STANDARD PAGE: Paragraph - box
 */
.paragraph--type--box {
  position: relative;
  padding: 1rem;
  margin: 1.5rem 0;
  border: 1px solid var(--mid-green);
  border-radius: 8px;

  & h2, & h3, & h4, & h5, & h6 {
    margin-top: 0;
    margin-bottom: 1rem;
  }

  &.primary {
    background-color: rgb(from var(--deep-pink) r g b / 10%);

    & h2, & h3, & h4, & h5, & h6 {
      color: var(--violet);
    }

    & .styled-link a {
      color: white;
      background: var(--dark-purple);
    }
  }

  &.secondary {
    background: white;

    & h2, & h3, & h4, & h5, & h6 {
      color: var(--mid-green);
    }

    & .styled-link a {
      color: white;
      background: var(--mid-green);
    }
  }

  &.info {
    padding-left: 2.5rem;
    background-color: rgb(from var(--secondary-green) r g b / 10%);

    & > div:first-child::before {
      content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 192 512'%3E%3Cpath fill='%2326A399' d='M20 424.229h20V279.771H20c-11.046 0-20-8.954-20-20V212c0-11.046 8.954-20 20-20h112c11.046 0 20 8.954 20 20v212.229h20c11.046 0 20 8.954 20 20V492c0 11.046-8.954 20-20 20H20c-11.046 0-20-8.954-20-20v-47.771c0-11.046 8.954-20 20-20zM96 0C56.235 0 24 32.235 24 72s32.235 72 72 72 72-32.235 72-72S135.764 0 96 0z'/%3E%3C/svg%3E");
      position: absolute;
      left: 1.25rem;
      top: 1rem;
      width: 0.35em;
    }

    & h2, & h3, & h4, & h5, & h6, & p {
      color: var(--mid-green);
    }

    & .styled-link a {
      color: var(--mid-green);
      background: transparent;
      border: 1px solid var(--mid-green);
      padding: 0.25rem 1rem;
      font-size: 0.8rem;
      font-weight: var(--font-weight-strong);

      &::after {
        content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath fill='%2326A399' d='M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 448c-110.532 0-200-89.431-200-200 0-110.495 89.472-200 200-200 110.491 0 200 89.471 200 200 0 110.53-89.431 200-200 200zm107.244-255.2c0 67.052-72.421 68.084-72.421 92.863V300c0 6.627-5.373 12-12 12h-45.647c-6.627 0-12-5.373-12-12v-8.659c0-35.745 27.1-50.034 47.579-61.516 17.561-9.845 28.324-16.541 28.324-29.579 0-17.246-21.999-28.693-39.784-28.693-23.189 0-33.894 10.977-48.942 29.969-4.057 5.12-11.46 6.071-16.666 2.124l-27.824-21.098c-5.107-3.872-6.251-11.066-2.644-16.363C184.846 131.491 214.94 112 261.794 112c49.071 0 101.45 38.304 101.45 88.8zM298 368c0 23.159-18.841 42-42 42s-42-18.841-42-42 18.841-42 42-42 42 18.841 42 42z'/%3E%3C/svg%3E");
        color: var(--secondary-green);
        margin-left: 0.5rem;
        display: inline-block;
        width: 0.9rem;
        height: 0.9rem;
        vertical-align: middle;
      }
    }
  }
}

/**
 * STANDARD PAGE: Paragraph - cards
 */
.paragraph--type--cards {

  @media (min-width: 990px) {
    padding-top: 2.5rem;
  }

  & > div {
    display: grid;
    grid-template-columns: 1fr; /* Desktop repeat(3, 1fr) */
    gap: 1.5rem;
    width: auto;
    margin: 2rem 0;
    padding: 0;

    @media (min-width: 990px) {
      grid-template-columns: repeat(3, 1fr);
    }
  }

  & > div > div {
    position: relative;
  }

  & > div > p {
    @media (min-width: 990px) {
      grid-column: span 3;
    }
  }

  &:not(.no-border) > div > div {
    border: 1px solid var(--border-grey);
    border-radius: 8px;
    -webkit-transition: box-shadow 0.3s;
    -khtml-transition: box-shadow 0.3s;
    -moz-transition: box-shadow 0.3s;
    -ms-transition: box-shadow 0.3s;
    -o-transition: box-shadow 0.3s;
    transition: box-shadow 0.3s;

    &:hover {
      -webkit-box-shadow: 5px 5px 5px 0 rgba(33, 33, 33, 0.2);
      -khtml-box-shadow: 5px 5px 5px 0 rgba(33,33,33,0.2);
      -moz-box-shadow: 5px 5px 5px 0 rgba(33,33,33,0.2);
      -ms-box-shadow: 5px 5px 5px 0 rgba(33,33,33,0.2);
      -o-box-shadow: 5px 5px 5px 0 rgba(33,33,33,0.2);
      box-shadow: 5px 5px 5px 0 rgba(33, 33, 33, 0.2);
    }
  }

  /* Homepage design change - 'resource cards' */
  &[id="resource_section"] {
    > div > div .paragraph--type--card > div > div > p {
      &:has(a.tertiary) {
        height: 3rem;
        & a.tertiary {
          position: absolute;
          bottom: 2rem;
        }
      }
      &:last-of-type {
        padding-bottom: 2rem;
      }
    }
  }

  @media (min-width: 990px) {
    &[id="resource_section"] > div {
      grid-template-columns: repeat(6, 1fr);

      & > div:nth-child(1),
      & > div:nth-child(2) {
        grid-column: span 3;
      }

      & > div:nth-child(n+3) {
        grid-column: span 2;
      }
    }
  }
}

.paragraph--type--card {
  height: 100%;

  .image-citation {
    bottom: 5px;
  }

  &.highlight {
    background-color: rgb(from var(--secondary-green) r g b / 10%);
  }

  & img {
    border-radius: 8px 8px 0 0;
  }

  & > div > div:has(img) {
    position: relative;
  }

  & > div > div img {
    width: 100%;
    object-fit: cover;
  }

  & > div > div > div > div img {
    padding-left: 2rem;
    padding-top: 1.5rem;
  }

  &:not(.highlight) > div > div > div > div img {
    float: left;
    margin-right: 1rem;
  }

  & h2, & h3, & h4, & h5, & h6, & p {
    margin: 0 0.25rem;
    padding: 1.5rem 2rem;
  }

  & h2, & h3 {
    padding-bottom: 0;
  }

  & .styled-link a {
    position: absolute;
    bottom: 1.75rem;
    left: 2rem;
  }

  & > div > div > p {
    padding-bottom: 0;

    &:last-of-type {
      padding-bottom: 6rem;
    }
  }
}

/**
 * STANDARD PAGE: Paragraph - text
 */
.paragraph--type--text {

  & .styled-link a {
    margin-top: 2rem;
  }

  & > div > a:hover {
    text-decoration: underline;
  }
}

/**
 * STANDARD PAGE: Paragraph - two column
 */
.paragraph--type--twocol {

  & > div {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;

    & > div {
      margin: 1rem 0;
    }

    @media (min-width: 768px) {
      grid-template-columns: repeat(2, 1fr);
      gap: 8rem;

      & > div {
        margin: 6rem 0;
      }
    }
  }

  & img {
    margin-top: 1.5rem;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 8px;
  }
}

.paragraph--type--image {
  position: relative;
}