@import url(lower.css);

.articles {
  margin: max(8vw, 60px) auto;
  background-color: var(--bg-c);
  border-radius: 2em;
  width: min(90%, 1000px);
  @media (width < 1100px) {
    border-radius: 1em;
  }
  ul {
    display: flex;
    flex-direction: column;
    gap: max(3vw, 1.6em);
    transform-style: preserve-3d;
    perspective: 100vmax;
  }
  li:hover {
    .thumbnail {
      opacity: 0.7;
    }
    h3 span {
      border-color: var(--primary-c);
    }
  }

  article {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.6em 1em;
    overflow: hidden;
    border-radius: 12px;
    container-type: inline-size;
    background-color: #fff;
    a {
      position: absolute;
      z-index: 2;
      inset: 0;
    }
    time {
      grid-area: 1/2/2/3;
      opacity: 0.4;
      align-self: end;
    }
    h3 {
      grid-area: 2/2/3/3;
      font-weight: 500;
      line-height: 1.6;
      max-height: calc(2em * 1.6);
      display: -webkit-box;
      overflow: clip;
      text-overflow: ellipsis;
      -webkit-box-orient: block-axis;
      -webkit-line-clamp: 2;
      span {
        border-bottom: 2px solid transparent;
        transition: border-color 0.4s;
      }
    }
    > span {
      grid-area: 1/3/3/4;
      align-self: center;
      margin-right: calc(1rem + 2vw);
      display: grid;
      place-items: center;
      color: var(--primary-c);
    }
  }
}
.thumbnail {
  aspect-ratio: 16/9;
  grid-area: 1/1/3/2;
  margin-right: 2vw;
  width: max(26cqi, 200px);
  transition: opacity 0.4s;
  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

/* ---------- pagination ---------- */

.pagination {
  padding-top: max(5vw, 50px);
  font-size: var(--fz);
  .inner {
    display: flex;
    justify-content: center;
    gap: 1.4em;
  }
}
.page-numbers {
  display: grid;
  place-items: center;
  width: 2em;
  border-radius: 4px;
  aspect-ratio: 1;
  &.current {
    background-color: #fff;
    color: #aaa;
  }
  &.next {
    letter-spacing: 0.1em;
  }
}
a.page-numbers {
  position: relative;
  transform-origin: right;
  overflow: hidden;
  isolation: isolate;
  transition: color 0.3s;
  &::before {
    content: "";
    position: absolute;
    inset: 0;
    background-color: var(--primary-c);
    scale: 0;
    transition: scale 0.3s;
    z-index: -1;
  }
  &:hover {
    color: #fff;
    &::before {
      scale: 1;
    }
  }
}

@media (width < 768px) {
  .articles {
    width: 100%;
    background: linear-gradient(#fff, var(--bg-c) 25%);
    border-radius: 0;
    margin: 0;
    ul {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
    article {
      grid-template-rows: auto auto 1fr;
      grid-template-columns: 1fr auto;
      padding-bottom: 1em;
      row-gap: 0.4em;
      height: 100%;
      time {
        grid-area: 2/1/3/2;
        padding: 0.6em 0 0 1em;
      }
      h3 {
        grid-area: 3/1/4/2;
        padding-left: 1em;
        max-height: none;
      }
      > span {
        grid-area: 2/2/4/3;
        margin-right: 1rem;
        width: auto;
        border: none;
      }
    }
  }
  .thumbnail {
    width: 100%;
    grid-area: 1/1/2/3;
    margin-right: 0;
  }
}
