@use "settings";

// Article listings
.listing {
  position: relative;
}

.listing > section > article {
  position: relative;
  display: grid;
  grid-template-columns: var(--listing-meta-width) minmax(0, 1fr);
  gap: 0 var(--listing-gap);
  margin: 0;
  padding: 1.75rem 0 1.9rem;
  border-top: var(--rule-width) solid var(--border);

  &:last-child {
    border-bottom: var(--rule-width) solid var(--border);
  }

  @include settings.mobile {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }
}

.listing > section > article > header {
  display: contents;
}

.listing > section > article > header > p {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.listing > section > article > header > p small {
  display: block;
  color: var(--primary);
  font-size: inherit;
  font-weight: 700;
}

.listing > section > article h2 {
  grid-column: 2;
  grid-row: 1;
  margin: 0 0 0.7rem;
  font-family: var(--font-body);
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  font-weight: 700;
  line-height: 1.3;
}

.listing > section > article h2 a {
  color: var(--primary);
  text-decoration-color: transparent;
}

.listing > section > article h2 a:hover,
.listing > section > article h2 a:focus-visible {
  text-decoration-color: var(--primary);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.listing > section > article > :is(section, footer) {
  grid-column: 2;

  p {
    margin-bottom: 0;
  }
}

.listing > section > article > section {
  grid-row: 2;
}

.listing > section > article > footer {
  grid-row: 3;
  margin-top: var(--space-3);
}

@include settings.mobile {
  .listing > section > article > header > p,
  .listing > section > article h2,
  .listing > section > article > section,
  .listing > section > article > footer {
    grid-column: 1;
  }

  .listing > section > article > header > p {
    grid-row: 1;

    small {
      display: inline;
      margin-left: var(--space-2);
    }
  }

  .listing > section > article h2 {
    grid-row: 2;
  }

  .listing > section > article > section {
    grid-row: 3;
  }

  .listing > section > article > footer {
    grid-row: 4;
  }
}
