/* ==========================================================================
   List.
   ========================================================================== */
.list {
  margin: 0;
  list-style: none;
}
.list-item {
  position: relative;

  > a {
    display: block;
    width: 100%;
    height: 100%;
    color: inherit;
    font-family: inherit;
    user-select: none;
    box-sizing: border-box;
    text-decoration: none;

    &:hover,
    &:focus {
      color: inherit;
    }
  }

  .item-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
    box-sizing: border-box;
  }

  .item-media {
    position: relative;
    margin-bottom: var(--space-l);
    overflow: hidden;

    img {
      display: block;
      margin: 0 auto;
    }
  }

  .item-footer,
  .item-content {
    padding: 0 var(--gutter-l);
  }

  .item-content {
    position: relative;
  }

  .item-title {
    margin-bottom: var(--space-l);
    color: inherit;
  }

  .item-body {
    margin-bottom: var(--space-l);
    font-size: var(--font-size-s);
    line-height: normal;
    box-sizing: border-box;

    p {
      margin-bottom: 0;
    }
  }
}

/* ==========================================================================
   Primary.
   ========================================================================== */
.list--primary {
  .item-wrapper {
    display: flex;
    flex-direction: column;
  }

  .item-media {
    flex-shrink: 0;
    width: 100%;
    margin-bottom: 0;

    img {
      object-fit: cover;
      height: 100%;
    }
  }

  .item-content {
    padding: var(--space-l) 0 0;
  }
  .content-details {
    margin: 0 0 var(--space-s);

    + .item-title {
      margin-top: 0;
    }
  }

  .item-date {
    position: absolute;
    top: -66px;
    right: 0;
    padding: var(--space-l) var(--space-xl);
    color: var(--color-text-dark);
    font-family: var(--font-family-heading);
    font-size: var(--font-size-xl);
    text-align: center;
    line-height: 1.1;
    background: var(--color-bg);
    border-top: 4px solid var(--color-fg-primary);

    span {
      display: block;
    }
  }
  .item-title {
    margin-bottom: var(--space-xs);
    color: var(--color-text-dark);
    font-size: var(--font-size-h3);

    &:before {
      content: none;
    }
  }
  .item-body {
    color: var(--color-text-light);
    font-size: var(--font-size-m);
    line-height: var(--line-height);
  }
  .list-item {
    .item-footer {
      padding: 0;
      text-align: left;

      .button {
        margin-bottom: var(--space-l);
      }
    }
  }
}

/* ==========================================================================
   Secondary.
   ========================================================================== */
.list--secondary {
  .item-wrapper {
    display: flex;
  }

  .item-media {
    flex-shrink: 0;
    max-width: 80px;
  }

  .item-date {
    margin-bottom: var(--space-s);
    color: var(--color-text-light);
  }

  .list-item {
    a:not(.btn) {
      text-decoration: none;
    }

    .item-title {
      margin-top: 0;
      margin-bottom: var(--space-s);
    }

    .item-body {
      margin-bottom: var(--space-s);
    }
  }

  &.l-big {
    .item-media {
      max-width: 180px;
    }
  }
}

/* ==========================================================================
   Search result.
   ========================================================================== */
.list--search-result {
  .list-item {
    + .list-item {
      border-top: 1px solid color-mix(in oklab, var(--color-border) 25%, white);
    }

    a {
      display: flex;
      align-items: center;
      padding: var(--space-m);

      &:hover,
      &:focus {
        background-color: var(--color-bg-primary);
      }
    }
  }

  .item-media,
  .item-title {
    margin-bottom: 0;
  }

  .item-media {
    flex-shrink: 0;
  }
}

/* ==========================================================================
   Comments.
   ========================================================================== */
.js-comment,
.list--comments {
  padding: var(--space-l) var(--gutter-l);

  .list-item {
    padding: var(--space-s);
    padding-bottom: 0;
    margin-bottom: var(--space-s);
    border-radius: 4px;
    transition: .3s;

    &.is-selected,
    &:hover,
    &:focus {
      background: var(--color-bg);
      padding-bottom: var(--space-l);

      .links {
        opacity: 1;
      }
    }
  }

  .indented {
    margin-left: var(--gutter-l);
  }

  .item-footer,
  .item-content {
    padding: 0;
  }

  .item-content {
    overflow: visible;

    p {
      margin-bottom: var(--space-s);
    }
  }

  .item-footer {
    margin-bottom: var(--space-s);

    p {
      margin: 0;
    }
  }

  .item-author {
    font-family: var(--font-family-heading);
  }

  .links {
    position: absolute;
    bottom: -26px;
    left: 0;
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    margin: 0;
    list-style: none;
    opacity: 0;
    transition: .3s;

    li {
      margin-right: var(--gutter-xs);
      font-size: var(--font-size-s);
    }

    a {
      font-size: var(--font-size-s);
      color: var(--color-text);
      text-decoration: none;
      transition: .2s;

      &.is-active,
      &:hover,
      &:focus {
        color: var(--color-fg-primary);
        text-decoration: underline;
      }
    }
  }

  .item-form {
    &.is-loaded {
      margin-top: var(--space-xl);
    }

    form,
    .form-actions {
      margin-bottom: 0;
    }
  }

  .view-empty {
    padding-bottom: 0;
    margin-bottom: 0;
  }
}

/* ==========================================================================
   Page selection.
   ========================================================================== */
.list--page-selection {
  display: flex;
  flex-wrap: wrap;
  margin-left: calc(var(--gutter-xs) * -1);
  margin-right: calc(var(--gutter-xs) * -1);

  .item-wrapper {
    background: var(--color-bg);
    border-radius: var(--border-radius-xl) var(--border-radius-xl) var(--border-radius-xl) 0;
    transition: .2s;
  }

  .item-header {
    position: absolute;
    bottom: 0;
    z-index: 25;
    padding: var(--space-xs) var(--gutter-m);
    color: var(--color-bg);
    background: var(--color-fg-primary);
    box-sizing: border-box;
    transition: .2s;
  }

  .item-title-icon {
    display: flex;
    align-items: center;
  }

  .item-title {
    margin: 0;
    font-family: var(--font-family-heading);
    font-size: var(--font-size-l);
  }

  .icon {
    --icon-size: var(--icon-size-xl);
    margin-right: var(--gutter-xs);
    order: -1;

    &:before {
      background-color: var(--color-bg);
    }
  }

  .item-content {
    padding: 0;
  }
  .item-introduction {
    display: none;
  }
  .item-thumbnail {
    position: relative;
    height: 316px;
    background: var(--color-bg-tertiary);

    .is-empty {
      position: absolute;
      top: 50%;
      left: 50%;
      z-index: 5;
      transform: translate(-50%, -50%);
      --icon-size: var(--icon-size-xl);

      &:before {
        content: "";
        display: inline-block;
        width: var(--icon-size);
        height: var(--icon-size);
        mask-repeat: no-repeat;
        mask-position: center;
        mask-size: var(--icon-size);
        mask-image: var(--icon-datagone-image);
        background-color: color-mix(in oklab, var(--color-text-light) 50%, white);
      }
    }

    img {
      height: inherit;
      object-fit: cover;
    }
  }

  .item-footer {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-align: center;
    box-sizing: border-box;
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: .3s;

    &:before {
      position: absolute;
      top: 0;
      right: 0;
      z-index: 5;
      content: "";
      width: 0;
      height: 0;
      border-style: solid;
      border-width: 0 114px 114px 0;
      border-color: transparent var(--color-fg-primary) transparent transparent;
    }

    .btn {
      position: relative;
      margin: 0 auto;
      background: none;
      border-radius: 0;
      display: inline-flex;
      flex-direction: column;
      justify-content: center;
      font-size: var(--font-size-m);
      border: 0;
    }
  }

  /* Layout.
       ========================================================================== */
  &.l-twolines {
    /* Responsive.
       ========================================================================== */
    @media screen and (min-width: 48em) {
      display: grid;
      grid-template: 1fr 1fr/2fr 1fr;
      gap: 0 0;
      justify-items: stretch;
      align-items: stretch;

      .list-item {
        width: 100%;
        max-width: none;

        &.l-twothird {
          grid-column: 1/2;
          grid-row: 1/3;

          .item-thumbnail {
            height: 656px;
          }
        }
        &.l-third {
          grid-column: 2/3;
          grid-row: 1/2;

          &:last-child {
            grid-row: 2/2;
          }
        }
      }
    }
  }

  /* States.
     ========================================================================== */
  a {
    &:hover,
    &:focus {
      .item-wrapper {
        border-radius: var(--border-radius-xl) 0 var(--border-radius-xl) var(--border-radius-xl);
      }
      .item-header {
        background: none;
      }
      .item-footer {
        visibility: visible;
        opacity: 1;

        .btn {
          border: 0;
        }
      }
    }
  }
}

/* ==========================================================================
   Glossary.
   ========================================================================== */
.list--glossary {
  display: flex;
  flex-wrap: wrap;
  margin-left: calc(var(--gutter-xs) * -1);
  margin-right: calc(var(--gutter-xs) * -1);
  background: var(--color-bg-secondary);

  .glossary-letter {
    color: var(--color-text-dark);
    font-family: var(--font-family-heading);
    font-size: 34px;
  }

  .item-title {
    margin-bottom: var(--space-xs);
    color: var(--color-fg-primary);
    font-size: 22px;

    &:before {
      content: none;
    }
  }

  .item-content {
    padding: 0;
    line-height: 1.3;
  }

  /* Responsive.
     ========================================================================== */
  @media screen and (min-width: 48em) {
    .l-full {
      padding-left: var(--gutter-l);
      padding-right: var(--gutter-l);
    }

    .l-half {
      padding-left: var(--gutter-l);
      padding-right: var(--gutter-l);

      + .l-half {
        border-left: 1px solid var(--color-border);
      }
    }
  }
}

/* ==========================================================================
   Media library.
   ========================================================================== */
.list--media-library {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  margin-left: calc(var(--gutter-xs) * -1);
  margin-right: calc(var(--gutter-xs) * -1);
  background: var(--color-bg-secondary);

  &:before,
  &:after {
    content: "";
    position: absolute;
    top: 0;
    z-index: -1;
    width: 1000px;
    height: 100%;
    background: inherit;
  }
  &:before {
    left: -1000px;
  }
  &:after {
    right: -1000px;
  }

  .item-wrapper {
    display: flex;
    align-items: center;
    padding: 15px;
    background: var(--color-bg);
  }

  .item-content {
    padding: var(--space-s) 0;
  }

  .item-thematic {
    display: inline-block;
    margin-bottom: var(--space-s);
    color: var(--color-fg-primary);
    line-height: 1;
  }

  .item-title {
    margin-bottom: var(--space-l);
    color: var(--color-text-dark);
    font-size: 22px;

    &:before {
      content: none;
    }
  }

  .item-details {
    .item-date {
      &:before {
        content: "-";
        margin-right: 5px;
      }
    }
  }

  .item-thumbnail {
    margin-right: var(--gutter-l);
  }
}
