/* Responsive relationship actions on the public user profile. */
@media (max-width: 700px) {
  body[data-page="user-profile"] #viewRoot[data-profile-owner="false"] .profile-cta {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, .78fr) minmax(0, 1.08fr);
    gap: 6px;
    overflow: visible;
  }

  body[data-page="user-profile"] #viewRoot[data-profile-owner="false"] .profile-cta .profile-action {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding-inline: 8px;
    gap: 5px;
    font-size: 10.5px;
    line-height: 1;
    text-align: center;
  }

  body[data-page="user-profile"] #viewRoot[data-profile-owner="false"] .profile-cta .profile-action > span {
    min-width: 0;
    white-space: nowrap;
    text-align: center;
  }

  body[data-page="user-profile"] #viewRoot[data-profile-owner="false"] .profile-cta [data-profile-friend] {
    grid-column: 1;
  }

  body[data-page="user-profile"] #viewRoot[data-profile-owner="false"] .profile-cta .profile-action-message {
    grid-column: 2;
    color: var(--text);
    background: var(--surface-2);
    border-color: var(--line-strong);
    box-shadow: none;
  }

  body[data-page="user-profile"] #viewRoot[data-profile-owner="false"] .profile-cta [data-profile-follow] {
    grid-column: 3;
  }

  body[data-page="user-profile"] #viewRoot[data-profile-owner="false"] .profile-cta:not(:has(.profile-action-message:not([hidden]))) {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  }

  body[data-page="user-profile"] #viewRoot[data-profile-owner="false"] .profile-cta:not(:has(.profile-action-message:not([hidden]))) [data-profile-follow] {
    grid-column: 2;
  }

  body[data-page="user-profile"] #viewRoot[data-profile-owner="false"] .profile-cta [data-profile-follow].following,
  body[data-page="user-profile"] #viewRoot[data-profile-owner="false"] .profile-cta [data-profile-follow].active {
    color: #211507;
    background: linear-gradient(135deg, var(--gold-bright), var(--gold));
    border-color: rgba(113, 70, 11, .22);
    box-shadow: 0 8px 20px rgba(156, 103, 21, .16);
  }

  body[data-page="user-profile"] #viewRoot[data-profile-owner="false"] .profile-cta [data-profile-friend].active {
    color: var(--gold-deep);
    background: var(--gold-wash);
    border-color: var(--gold);
    box-shadow: none;
  }
}

@media (max-width: 379.98px) {
  body[data-page="user-profile"] #viewRoot[data-profile-owner="false"] .profile-cta {
    grid-template-columns: minmax(0, 1.42fr) minmax(0, .7fr) minmax(0, 1.03fr);
  }

  body[data-page="user-profile"] #viewRoot[data-profile-owner="false"] .profile-cta:not(:has(.profile-action-message:not([hidden]))) {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  }

  body[data-page="user-profile"] #viewRoot[data-profile-owner="false"] .profile-cta .profile-action {
    min-height: 44px;
    padding-inline: 7px;
    gap: 0;
    font-size: 10.25px;
  }

  body[data-page="user-profile"] #viewRoot[data-profile-owner="false"] .profile-cta .profile-action > i {
    display: none;
  }
}

@media (max-width: 700px) {
  body[data-page="user-profile"] .profile-cta .profile-action:focus-visible {
    outline: 2px solid var(--gold-deep);
    outline-offset: 2px;
  }

  html[data-theme="dark"] body[data-page="user-profile"] #viewRoot[data-profile-owner="false"] .profile-cta .profile-action-message {
    color: var(--text);
    background: var(--surface-2);
    border-color: var(--line-strong);
  }

  html[data-theme="dark"] body[data-page="user-profile"] #viewRoot[data-profile-owner="false"] .profile-cta [data-profile-friend].active {
    color: var(--gold-bright);
    background: var(--gold-wash);
    border-color: color-mix(in srgb, var(--gold) 62%, var(--line-strong));
  }
}

/* Dark theme: the friendship action changes between an outlined state and a
   filled confirmation state, so it cannot inherit one color from the shared
   .profile-action-primary rule. */
html[data-theme="dark"] body[data-page="user-profile"]
  #viewRoot[data-profile-owner="false"] .profile-cta
  [data-profile-friend]:not(.incoming):not(.friends):not(.confirming) {
  color: var(--gold-bright) !important;
  background: color-mix(in srgb, var(--gold) 7%, var(--su-dark-panel-raised)) !important;
  border-color: color-mix(in srgb, var(--gold) 68%, var(--su-dark-border-strong)) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] body[data-page="user-profile"]
  #viewRoot[data-profile-owner="false"] .profile-cta
  [data-profile-friend]:not(.incoming):not(.friends):not(.confirming):is(:hover, :focus-visible) {
  color: var(--gold-light) !important;
  background: color-mix(in srgb, var(--gold) 12%, var(--su-dark-panel-hover)) !important;
  border-color: var(--gold-bright) !important;
}

html[data-theme="dark"] body[data-page="user-profile"]
  #viewRoot[data-profile-owner="false"] .profile-cta
  [data-profile-friend]:is(.incoming, .friends):not(.confirming) {
  color: var(--su-gold-ink) !important;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold)) !important;
  border-color: var(--gold) !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .24) !important;
}

html[data-theme="dark"] body[data-page="user-profile"]
  #viewRoot[data-profile-owner="false"] .profile-cta
  [data-profile-friend].confirming {
  color: var(--danger) !important;
  background: color-mix(in srgb, var(--danger) 10%, var(--su-dark-panel-raised)) !important;
  border-color: color-mix(in srgb, var(--danger) 58%, var(--su-dark-border)) !important;
  box-shadow: none !important;
}

@media (prefers-reduced-motion: reduce) {
  body[data-page="user-profile"] .profile-cta .profile-action {
    transition: none;
  }
}
