/**
 * Author profile header on author archives (/author/<slug>/). SEO-395
 * Loaded only on author archives (see twenty_twenty_one_scripts in functions.php),
 * and every rule is scoped to .author-profile, so no other page is affected.
 *
 * Layout (CSS grid):
 *   desktop/tablet: photo on the left spanning all rows; name + role, bio, "Show more" stacked on the right.
 *   mobile (<576px): small photo beside name + role; bio and "Show more" full width underneath.
 */

.author-profile {
  padding: 48px 0 32px;
}

.author-profile__inner {
  display: grid;
  grid-template-columns: 160px minmax(0, 860px);
  grid-template-areas:
    "photo head"
    "photo bio"
    "photo toggle"
    "photo .";
  grid-template-rows: auto auto auto 1fr;
  column-gap: 48px;
  align-items: start;
}

.author-profile__inner--no-photo {
  grid-template-columns: minmax(0, 860px);
  grid-template-areas:
    "head"
    "bio"
    "toggle";
  grid-template-rows: auto;
}

.author-profile__photo {
  grid-area: photo;
}

.author-profile__photo img {
  display: block;
  width: 160px;
  height: 213px;
  object-fit: cover;
  border-radius: 8px;
  background: #f1f1f1;
}

.author-profile__head {
  grid-area: head;
  padding-top: 8px;
}

.author-profile__name {
  font-family: "Plus Jakarta Sans", "Inter", sans-serif;
  font-size: 42px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: #111;
  margin: 0;
  overflow-wrap: anywhere;
}

.author-profile__role {
  font-family: "Inter", sans-serif;
  font-size: 16px;
  line-height: 1.4;
  color: #111;
  margin: 6px 0 0;
}

.author-profile__bio {
  grid-area: bio;
  font-family: "Inter", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: #111;
  margin-top: 20px;
}

.author-profile__bio p {
  margin: 0 0 12px;
}

.author-profile__bio p:last-child {
  margin-bottom: 0;
}

/* Clamped only once JS has confirmed the bio overflows, so it stays fully readable without JS. */
.author-profile__bio.is-clamped {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.author-profile__bio.is-clamped p {
  display: inline;
}

.author-profile__toggle {
  grid-area: toggle;
  justify-self: start;
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: none;
  font-family: "Inter", sans-serif;
  font-size: 16px;
  color: #111;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.author-profile__toggle[hidden] {
  display: none;
}

.author-profile__toggle:hover,
.author-profile__toggle:focus-visible {
  color: #555;
}

/* Social icons sit inside the name/job-title block, directly under the job title. */
.author-profile__social {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.author-profile__social li {
  margin: 0;
  padding: 0;
}

.author-profile__social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid #e3e3e3;
  border-radius: 50%;
  color: #444;
  font-size: 15px;
  line-height: 1;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.author-profile__social a:hover,
.author-profile__social a:focus-visible {
  color: #fff;
  background-color: #111;
  border-color: #111;
}

@media (max-width: 991.98px) {
  .author-profile__inner {
    grid-template-columns: 140px minmax(0, 1fr);
    column-gap: 32px;
  }

  .author-profile__inner--no-photo {
    grid-template-columns: minmax(0, 1fr);
  }

  .author-profile__photo img {
    width: 140px;
    height: 187px;
  }
}

@media (max-width: 575.98px) {
  .author-profile {
    padding: 32px 0 24px;
  }

  .author-profile__inner {
    grid-template-columns: 88px minmax(0, 1fr);
    grid-template-areas:
      "photo head"
      "bio bio"
      "toggle toggle";
    grid-template-rows: auto;
    column-gap: 16px;
    align-items: center;
  }

  .author-profile__inner--no-photo {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "head"
      "bio"
      "toggle";
  }

  .author-profile__photo img {
    width: 88px;
    height: 110px;
  }

  .author-profile__head {
    padding-top: 0;
  }

  .author-profile__name {
    font-size: 28px;
    line-height: 1.2;
  }

  .author-profile__role {
    font-size: 14px;
    margin-top: 4px;
  }

  .author-profile__social {
    gap: 8px;
    margin-top: 10px;
  }

  .author-profile__social a {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .author-profile__bio {
    line-height: 1.6;
    margin-top: 16px;
  }

  .author-profile__bio.is-clamped {
    -webkit-line-clamp: 4;
    line-clamp: 4;
  }

  .author-profile__toggle {
    margin-top: 8px;
  }
}
