/* One story card for the whole site. The card is a single link; hover and
   focus look the same everywhere: the photo grows slightly, the title gets a
   red underline. */

.g-card {
  display: flex;
  flex-direction: column;
  gap: var(--wp--preset--spacing--30);
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.g-card__media {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--wp--preset--color--mist);
}

.g-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Faces sit high in a photo; a centred crop cuts them off. */
  object-position: 50% 30%;
}

.g-ratio-16x9 { aspect-ratio: 16 / 9; }
.g-ratio-4x3 { aspect-ratio: 4 / 3; }

.g-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--wp--preset--spacing--10);
  min-width: 0;
}

.g-card__title {
  margin: 0;
  font-family: var(--wp--preset--font-family--display);
  font-size: var(--wp--preset--font-size--title-md);
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 150ms ease-out;
}

.g-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wp--preset--spacing--20);
  font-size: var(--wp--preset--font-size--meta);
  line-height: 1.4;
  color: var(--wp--preset--color--stone);
}

.g-card__category {
  /* The deep red keeps 4.5:1 on white, and turns light red in the dark theme. */
  color: var(--wp--preset--color--brand-deep);
  font-weight: 500;
}


.g-card:hover .g-card__title,
.g-card:focus-visible .g-card__title {
  color: var(--wp--preset--color--brand-deep);
  text-decoration-line: underline;
}

.g-card:focus-visible {
  outline: 3px solid var(--wp--preset--color--brand);
  outline-offset: 2px;
}

/* Round author portrait, or initials when there is none. Used on several pages. */
.g-avatar {
  display: block;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 20%;
  background: var(--wp--preset--color--mist);
}

.g-avatar--initials {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--wp--preset--color--stone);
  font-family: var(--wp--preset--font-family--display);
  font-size: 2rem;
  font-weight: 700;
}

/* Row: small square photo beside the title. */
.g-card--row {
  flex-direction: row;
  align-items: flex-start;
}

.g-card--row .g-card__media {
  flex: 0 0 120px;
}

.g-card--row .g-card__body {
  flex: 1 1 auto;
}

.g-card--row .g-card__title,
.g-card--text .g-card__title {
  font-size: var(--wp--preset--font-size--title-sm);
}

@media (min-width: 1024px) {
  .g-card--row .g-card__media {
    flex-basis: 144px;
  }
}

/* Overlay: title on the photo, kept legible by a gradient. */
.g-card--overlay {
  position: relative;
  gap: 0;
  color: #ffffff;
}

.g-card--overlay .g-card__body {
  position: absolute;
  inset: auto 0 0;
  padding: var(--wp--preset--spacing--60) var(--wp--preset--spacing--40) var(--wp--preset--spacing--40);
  background: linear-gradient(180deg, transparent 0, rgb(0 0 0 / 0.6) 40%, rgb(0 0 0 / 0.86));
}

.g-card--overlay .g-card__meta,
.g-card--overlay .g-card__category {
  color: #ffffff;
}

.g-card--overlay:hover .g-card__title,
.g-card--overlay:focus-visible .g-card__title {
  color: #ffffff;
}

/* Text: no photo; a story that has none never borrows a placeholder. */

@media (prefers-reduced-motion: reduce) {
  .g-card__title {
    transition: none;
  }
}

/* A writer: portrait and name to the profile, newest title to the piece. Home carousel and the writers page. */
.g-columnist {
  gap: 10px;
  padding: 12px;
  text-decoration: none;
}

.g-columnist__head,
.g-columnist__post {
  color: inherit;
  text-decoration: none;
}

.g-columnist__head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.g-columnist .g-avatar {
  flex: none;
  width: 52px;
  height: 52px;
  font-size: 1.25rem;
}

.g-columnist__name {
  min-width: 0;
  font-family: var(--wp--preset--font-family--display);
  font-size: var(--wp--preset--font-size--pano-author);
  font-weight: 700;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.g-columnist__post {
  display: grid;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--wp--preset--color--line);
}

.g-columnist__title {
  font-family: var(--wp--preset--font-family--display);
  font-size: var(--wp--preset--font-size--pano-card-md);
  font-weight: 700;
  line-height: 1.08;
}

.g-columnist__date {
  color: var(--wp--preset--color--stone);
  font-size: var(--wp--preset--font-size--pano-meta);
}

.g-columnist__head:hover .g-columnist__name,
.g-columnist__post:hover .g-columnist__title {
  text-decoration: underline;
  text-decoration-color: var(--wp--preset--color--brand);
  text-decoration-thickness: 2px;
}

.g-columnist__head:focus-visible,
.g-columnist__post:focus-visible {
  outline: 3px solid var(--wp--preset--color--brand);
  outline-offset: 2px;
}

@media (min-width: 1200px) {
  .g-columnist {
    gap: 12px;
    padding: 16px;
  }

  .g-columnist .g-avatar {
    width: 72px;
    height: 72px;
  }
}
