/* ==========================================================================
   List.
   ========================================================================== */
.list {
  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;
    background-color: var(--color-bg);

    img {
      display: block;
    }
  }

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

  .item-content {
    position: relative;
  }

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

  .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 {
  a {
    &:hover,
    &:focus {
      .item-wrapper {
        border-color: var(--color-border);
      }
    }
  }

  .item-wrapper {
    display: flex;
    border: 1px solid var(--color-bg);
    transition: .3s;
  }

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

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

  .item-content {
    padding-top: var(--space-l);
  }

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

  .item-date {
    color: var(--color-text-light);
  }
  .item-title {
    font-size: var(--font-size-h2);
  }
  .item-body {
    color: var(--color-text-light);
    font-size: var(--font-size-m);
    line-height: var(--line-height);
  }
  .item-footer {
    .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);
    font-family: var(--font-family-secondary);

    p {
      margin: 0;
    }
  }

  .item-author {
    font-family: var(--font-family-secondary-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-family: var(--font-family-secondary);
      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);
  }

  .item-header {
    position: absolute;
    z-index: 25;
    padding: var(--space-s) var(--gutter-m);
    width: 100%;
    min-height: 100px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-fg-primary);
    box-sizing: border-box;
  }

  .item-title-icon {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-s);
  }

  .item-title {
    margin: 0;
    color: var(--color-fg-primary);
    font-size: var(--font-size-l);
    font-weight: bold;
    text-transform: uppercase;
  }

  .icon {
    color: var(--color-fg-primary);
    --icon-size: var(--icon-size-xl);
    width: var(--icon-size);
    height: var(--icon-size);

    &:before {
      content: "";
      display: inline-block;
      width: inherit;
      height: inherit;
      mask-repeat: no-repeat;
      mask-position: center;
      mask-size: var(--icon-size);
      background: var(--color-fg);
      mask-image: var(--icon-datagone-image);
    }
  }

  .item-content {
    padding: 100px 0 0;
  }

  .item-thumbnail {
    position: relative;
    height: 340px;
    background: var(--color-bg-secondary);

    .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;
    opacity: 0;
    visibility: hidden;
    transition: .3s;

    &:after {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      z-index: 10;
      width: 100%;
      height: 100%;
      background: var(--color-fg-primary);
      opacity: .25;
    }

    .btn {
      position: relative;
      z-index: 15;
      top: 50px;
      margin: 0 auto;
    }
  }

  /* States.
     ========================================================================== */
  a {
    &:hover,
    &:focus {
      .item-footer {
        visibility: visible;
        opacity: 1;
      }
    }
  }
}

/* ==========================================================================
   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-secondary-medium);
    font-size: 34px;
  }

  .item-title {
    margin-bottom: var(--space-s);
    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);
  }
}
