/* Member directory and member profiles. */
@layer pages {
  .member-directory {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
    gap: var(--space-4);
  }

  .member-card {
    position: relative;
    display: flex;
    min-width: 0;
    align-items: center;
    gap: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    padding: var(--space-4);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
  }

  .member-card:hover {
    border-color: var(--color-border-strong);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
  }

  .profile-hero__avatar {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--color-border-strong);
    border-radius: 50%;
    background: var(--color-accent-soft);
    color: var(--color-accent);
    font-family: var(--font-display);
  }

  .member-card__photo {
    position: relative;
    z-index: 1;
    flex: 0 0 6rem;
    margin: 0;
  }

  .member-card__photo a {
    display: grid;
    aspect-ratio: 1;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-subtle);
  }

  .member-card__photo img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: contain;
  }

  .member-card__photo-unavailable {
    padding: var(--space-2);
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    text-align: center;
  }

  .member-card__photo figcaption {
    margin-top: var(--space-2);
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    text-align: center;
  }

  .member-card__photo time {
    display: block;
  }

  .member-card__content {
    display: grid;
    flex: 1;
    min-width: 0;
    gap: var(--space-1);
  }

  .member-card__content a {
    overflow-wrap: anywhere;
    color: var(--color-text);
    font-family: var(--font-display);
    font-size: var(--text-lg);
    text-decoration: none;
  }

  .member-card__content a::after {
    position: absolute;
    inset: 0;
    content: "";
  }

  .member-card__content span {
    overflow: hidden;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .member-card__stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2) var(--space-4);
    margin-top: var(--space-3);
  }

  .member-card__stats div {
    min-width: 0;
  }

  .member-card__stats dt {
    color: var(--color-text-muted);
    font-size: var(--text-xs);
  }

  .member-card__stats dd {
    margin: 0;
    font-size: var(--text-sm);
    font-weight: 700;
  }

  .profile-hero {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: clamp(1rem, 4vw, 2rem);
    margin-bottom: var(--space-7);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--space-7);
  }

  .profile-hero__avatar {
    width: clamp(4.5rem, 10vw, 7rem);
    height: clamp(4.5rem, 10vw, 7rem);
    font-size: var(--text-2xl);
    box-shadow: inset 0 0 0 0.5rem color-mix(in srgb, var(--color-surface) 60%, transparent);
  }

  .profile-hero__identity {
    display: grid;
    min-width: 0;
    gap: var(--space-2);
  }

  .profile-hero__identity h1 {
    overflow-wrap: anywhere;
  }

  .profile-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-3);
  }

  .profile-metadata {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
    gap: var(--space-4);
  }

  .profile-metadata div {
    min-width: 0;
    padding: var(--space-5);
  }

  .profile-metadata dt {
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .profile-metadata dd {
    overflow-wrap: anywhere;
    font-size: var(--text-lg);
  }

  .profile-biography {
    display: grid;
    gap: var(--space-3);
    max-width: var(--content-reading);
    margin-top: var(--space-7);
    border-left: 3px solid var(--color-accent);
    padding-left: var(--space-5);
  }

  .profile-biography > div {
    font-size: var(--text-lg);
  }

  .profile-metadata div {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    padding: var(--space-4);
  }

  .member-title {
    display: block;
    color: var(--color-text-muted);
  }

  .profile-metadata {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
    gap: var(--space-3);
  }

  .profile-metadata dt {
    font-weight: 700;
  }

  .profile-metadata dd {
    margin-top: var(--space-1);
  }
}

/* Small-screen overrides share the utilities layer with the ones in moneta-django.css. */
@layer utilities {
  @media (max-width: 40rem) {
    .profile-hero {
      grid-template-columns: auto minmax(0, 1fr);
      align-items: center;
    }

    .profile-actions {
      grid-column: 1 / -1;
      justify-content: flex-start;
    }

    .profile-actions > :where(a, form, button) {
      flex: 1 1 auto;
    }

    .profile-actions form button {
      width: 100%;
    }
  }
}
