/* Mobile refinements, loaded after the shared four-family identity styles. */
@media (max-width: 760px) {
  .top {
    min-height: 0;
    padding: 12px 16px;
    gap: 12px;
  }

  .top .brand {
    flex: 1 1 100%;
    min-width: 0;
    gap: 5px;
  }

  .top .brand-logo {
    width: min(216px, 100%);
    height: auto;
    aspect-ratio: 20 / 9;
    object-fit: contain;
  }

  .top .brand h1 .edition-date {
    font-size: .75rem;
    line-height: 1.8;
    margin-inline-start: 0;
  }

  .top .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 8px;
    margin: 0;
    width: 100%;
  }

  .top .top-actions > a,
  .top .top-actions > button {
    min-width: 0;
    min-height: 48px;
    padding: 8px 6px;
    font-size: .875rem;
    line-height: 1.65;
    white-space: normal;
    text-align: center;
  }

  /* The account label has a full row on the narrowest phones. */
  .top .top-actions > a {
    grid-column: 1 / -1;
  }

  .top .top-actions .ui-icon {
    display: none;
  }

  /* These dialogs scroll as a whole; retain their existing heading markup. */
  #stat-dialog > .dialog-heading,
  #relatives-dialog > .dialog-heading,
  #favorites-dialog > .dialog-heading,
  #my-relatives-dialog > .dialog-heading {
    position: sticky;
    top: 0;
    z-index: 4;
    background: #fff;
    padding-block: 10px;
    margin-block-start: -10px;
    gap: 12px;
    border-bottom: 1px solid var(--line);
  }

  #stat-dialog > .dialog-heading > :first-child,
  #relatives-dialog > .dialog-heading > :first-child,
  #favorites-dialog > .dialog-heading > :first-child,
  #my-relatives-dialog > .dialog-heading > :first-child {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .dialog-heading .close {
    flex: 0 0 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .person-section .source-link,
  .coverage button {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding-block: 8px;
    font-size: .875rem;
    line-height: 1.8;
    white-space: normal;
  }
}

@media (min-width: 360px) and (max-width: 760px) {
  .top .top-actions {
    grid-template-columns: 1.2fr 1fr 1fr;
  }

  .top .top-actions > a {
    grid-column: auto;
  }
}

@media (max-width: 480px) {
  .relation-paths {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}
